eehero
Full Member level 3
timer1 timer0 atmel
hi all, i am going to setup my controller's timer "90s2313 timer1" in compare mode the code which i had written is an assembly code and shown below, some thing error may be with this code, any one can help me to detect this error can post below
.nolist
.include "2313def.inc"
.list
;.equ see=0xff00
.ORG $000
rjmp reset
.org OC1addr ;Output Compare1 Interrupt Vector Address
rjmp T1INT
reset:
ldi R16,RAMEND
out SPL,R16
LDI r16, 0b01000000 ; enable comapre interrupt
OUT TIMSK, R16
LDI r16, 0b00000101 ;set prescalar
OUT TCCR1B, R16
LDI R16,0xff
OUT TCNT1H, R16
LDI R16,0x00
OUT TCNT1L, R16
LDI R20,0x11
LDI R21,0xff
OUT OCR1AL, R20
OUT OCR1AH, R21
ser r16
out DDRB,r16
out portb,r16
sei
main:
ldi r17,0b01010101
out PORTB,r17
rjmp main
T1INT:
LDI r19, 0b00000000
out portb,r19
rcall delay100us
rcall delay100us
reti
Delay100us:
ldi r21,$88
Loop: dec r21
brne loop
ret
Added after 5 hours 37 minutes:
hi friends, i have detect my problem, the 100us delay does not allow the change on port b to be noted, so that i increase it and all thing work good.
The timer is installed in right wat
hi all, i am going to setup my controller's timer "90s2313 timer1" in compare mode the code which i had written is an assembly code and shown below, some thing error may be with this code, any one can help me to detect this error can post below
.nolist
.include "2313def.inc"
.list
;.equ see=0xff00
.ORG $000
rjmp reset
.org OC1addr ;Output Compare1 Interrupt Vector Address
rjmp T1INT
reset:
ldi R16,RAMEND
out SPL,R16
LDI r16, 0b01000000 ; enable comapre interrupt
OUT TIMSK, R16
LDI r16, 0b00000101 ;set prescalar
OUT TCCR1B, R16
LDI R16,0xff
OUT TCNT1H, R16
LDI R16,0x00
OUT TCNT1L, R16
LDI R20,0x11
LDI R21,0xff
OUT OCR1AL, R20
OUT OCR1AH, R21
ser r16
out DDRB,r16
out portb,r16
sei
main:
ldi r17,0b01010101
out PORTB,r17
rjmp main
T1INT:
LDI r19, 0b00000000
out portb,r19
rcall delay100us
rcall delay100us
reti
Delay100us:
ldi r21,$88
Loop: dec r21
brne loop
ret
Added after 5 hours 37 minutes:
hi friends, i have detect my problem, the 100us delay does not allow the change on port b to be noted, so that i increase it and all thing work good.
The timer is installed in right wat