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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/25/07 13:21
Read: times


 
Msg Score: -2
 -2 Answer is Wrong
#137926 - Use the Timer
Responding to: ???'s previous message
Basically what you need is an interrupt every 1 second, you can use Timer0 for the purpose. first put timer0 in 16 bit mode, enable timer0 overflow interrupt. Initially set these up

Mov R1,#16
Mov TH0,#31
Mov TL0,#4
Setb TR0

you will get an interrupt every one second.
Crystal frequency must be 11.0592MHz

;-------------------------------------------------------------
; INTERRUPT HANDLER -- TIMER0
;-------------------------------------------------------------
TIMER0:
Mov TH0,#31 // Reload Timer and Run
Mov TL0,#4
Setb TR0
Djnz R1,T0_RET
// One Second elapsed. Call any function you want.
Mov R1,#16
RETI
T0_RET:
RETI

List of 8 messages in thread
TopicAuthorDate
timing sequence generation using AT89S52            01/01/70 00:00      
   Can you count?            01/01/70 00:00      
      I used 1 sec delay            01/01/70 00:00      
   This is a typical PCA job            01/01/70 00:00      
      PCA?            01/01/70 00:00      
   start with assembler code generated from C            01/01/70 00:00      
      or rather try this highly pathological C code :^)            01/01/70 00:00      
   Use the Timer            01/01/70 00:00      

Back to Subject List