Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
03/17/05 02:25
Read: times


 
#89844 - Re:Weird result using timer1and0 togethe
Responding to: ???'s previous message
The problem is here
the first and second ISR addresses are true
but the second merge in first
update your code to this


ORG 000Bh
LJMP TIMER0_ISR

ORG 001Bh
LJMP TIMER1_ISR


TIMER0_ISR:
PUSH ACC
PUSH PSW
CLR TR0
MOV TH0,#HIGH RESET_VALUE2
MOV TL0,#LOW RESET_VALUE2
SETB TR0
DJNZ MTICKS,EXIT_RTC2
MOV MTICKS,#2
INC MSEC
MOV R6,MSEC
CJNE R6,#10,EXIT_RTC2
MOV MSEC,#0
INC SECOND
MOV R6,SECOND
CJNE R6,#60,EXIT_RTC2
MOV SECOND,#0
INC MINUTE
MOV R6,MINUTE
CJNE R6,#60,EXIT_RTC2
MOV MINUTE,#0
INC HOUR
EXIT_RTC2:
POP PSW
POP ACC
RETI

; Timer1 interrupt routines
TIMER1_ISR:
PUSH ACC
PUSH PSW
CLR TR1
MOV TH1,#HIGH RESET_VALUE
MOV TL1,#LOW RESET_VALUE
SETB TR1
DJNZ TICKS,EXIT_RTC
MOV TICKS,#20
INC SECONDS
MOV A,SECONDS
CJNE A,#60,EXIT_RTC
ADD A,TL1
ANL A,#00001111b
MOV password,A
MOV SECONDS,#0
INC MINUTES
MOV A,MINUTES
CJNE A,#60,EXIT_RTC
MOV MINUTES,#0
INC HOURS
EXIT_RTC:
POP PSW
POP ACC
RETI

in your code when you write [org 1bh] then
you damage to your interruot 0 service routine
because TIMER0_ISR is about 40 bytes
and the reserved space for TIMER0_ISR is only 8 bytes
so you must exit from TIMER0_ISR with LJMP at first.
I Hope It Will be useful for you!
Mehdi




List of 15 messages in thread
TopicAuthorDate
Weird result using timer1and0 together.            01/01/70 00:00      
   timer2??            01/01/70 00:00      
      My bad.            01/01/70 00:00      
      Yes, I assembled this code myself.            01/01/70 00:00      
         English            01/01/70 00:00      
         please complete user profile            01/01/70 00:00      
         you need working s/w for hello world            01/01/70 00:00      
            Re:            01/01/70 00:00      
   Re:Weird result using timer1and0 togethe            01/01/70 00:00      
      Thank you ^_^            01/01/70 00:00      
   Register Bank            01/01/70 00:00      
      R6 ?            01/01/70 00:00      
         All the R's            01/01/70 00:00      
   just one thing            01/01/70 00:00      
      TF0 and TF1 interrupts            01/01/70 00:00      

Back to Subject List