
#pragma used+
sfrb PINA=0;
sfrb DDRA=1;
sfrb PORTA=2;
sfrb PINB=3;
sfrb DDRB=4;
sfrb PORTB=5;
sfrb PINC=6;
sfrb DDRC=7;
sfrb PORTC=8;
sfrb PIND=9;
sfrb DDRD=0xa;
sfrb PORTD=0xb;
sfrb PINE=0xc;
sfrb DDRE=0xd;
sfrb PORTE=0xe;
sfrb PINF=0xf;
sfrb DDRF=0x10;
sfrb PORTF=0x11;
sfrb PING=0x12;
sfrb DDRG=0x13;
sfrb PORTG=0x14;
sfrb TIFR0=0x15;
sfrb TIFR1=0x16;
sfrb TIFR2=0x17;
sfrb TIFR3=0x18;
sfrb TIFR4=0x19;
sfrb TIFR5=0x1a;
sfrb PCIFR=0x1b;
sfrb EIFR=0x1c;
sfrb EIMSK=0x1d;
sfrb GPIOR0=0x1e;
sfrb EECR=0x1f;
sfrb EEDR=0x20;
sfrb EEARL=0x21;
sfrb EEARH=0x22;
sfrw EEAR=0X21;   
sfrb GTCCR=0x23;
sfrb TCCR0A=0x24;
sfrb TCCR0B=0x25;
sfrb TCNT0=0x26;
sfrb OCR0A=0x27;
sfrb OCR0B=0x28;
sfrb GPIOR1=0x2a;
sfrb GPIOR2=0x2b;
sfrb SPCR=0x2c;
sfrb SPSR=0x2d;
sfrb SPDR=0x2e;
sfrb ACSR=0x30;
sfrb OCDR=0x31;
sfrb SMCR=0x33;
sfrb MCUSR=0x34;
sfrb MCUCR=0x35;
sfrb SPMCSR=0x37;
sfrb RAMPZ=0x3b;
sfrb EIND=0x3c;
sfrb SPL=0x3d;
sfrb SPH=0x3e;
sfrb SREG=0x3f;
#pragma used-

#asm
	#ifndef __SLEEP_DEFINED__
	#define __SLEEP_DEFINED__
	.EQU __se_bit=0x01
	.EQU __sm_mask=0x0E
	.EQU __sm_powerdown=0x04
	.EQU __sm_powersave=0x06
	.EQU __sm_standby=0x0C
	.EQU __sm_ext_standby=0x0E
	.EQU __sm_adc_noise_red=0x02
	.SET power_ctrl_reg=smcr
	#endif
#endasm

unsigned int duty=0;
unsigned int MotorDir=0;

interrupt [24] void timer0_ovf_isr(void)
{
static unsigned int cnt,cnt2=0;
cnt++;cnt2++;     
if(cnt==duty)
{
PORTC.4=PORTC.5=0;
}   
if(cnt==50)
{
PORTC.4=PORTC.5=1;   
cnt=0;
}    
if(cnt2==500)
{
duty++; 
if(duty>50) 
{
duty=0; 
duty=1;
MotorDir^=1;  

}
cnt2=0;
}
TCNT0+=0x06;
}

void main(void)
{

PORTC=0x00; 
DDRC=0xff;  

TCCR0A=0x00;
TCCR0B=0x03;
TCNT0=0x06;

(*(unsigned char *) 0x6e)=0x01;
#asm("sei")
duty=1;
while (1)
{
switch(MotorDir)
{
case 0: PORTC.0=1;PORTC.1=0;PORTC.2=1;PORTC.3=0;break; 
case 1: PORTC.0=0;PORTC.1=1;PORTC.2=0;PORTC.3=1;break; 
}     

};
}
