Include 'M64DEF.INC' 
ORG 0x0000 
JMP main 
ORG 0x0020 
JMP Timer0_ISR 
ORG 0x0050 
main : LDI R16, low(RAMEND) 
OUT SPL, R16 
LDI R16, high(RAMEND) 
OUT SPH, R16 
LDI R16, 0x02 ; Prescaler =8   16MHZ/8=2MHZ    1/2MHZ=500nsec         50usec/500nsec=100      256-100=156
OUT TCCR0, R16
LDI R16, 156 
OUT TCNT0, R16 
LDI R16, 0x01 
OUT TIMSK, R16 
LDI R16,0X0FF
OUT DDRA,R16
CLR R17
CLR R18
CLR R30
SEI

loop:
OUT PORTA,R17
JMP loop


Timer0_ISR:
LDI R16, 156 
OUT TCNT0, R16 
CPI R30,1
BREQ HIGH
CLR R17
INC R18
CPI R18,15
BRNE NEXT
CLR R18
LDI R30,1
HIGH:
LDI R17,1
INC R18
CPI R18,5
BRNE NEXT
CLR R30
NEXT:RETI




