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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/06/03 23:36
Read: times


 
#44938 - RE: Serial interrupt driven issues--timer1/2
Responding to: ???'s previous message
Sorry again, should have provided more info with the beginning of the tread. here is the complete code, which works with timer 1:

.equ TxNow, 01h

.equ StackBase,50h


.ORG 0
ajmp Init


.ORG 23h
ajmp SerInt


;[]------------------------[]
;| Interrupt Routines |
;[]------------------------[]

SerInt:
push PSW
push ACC
push 00h
jbc TI,SerOut
jbc RI,SerRx


SerRx:
mov P0,SBUF

SerOut:
pop 00h
pop ACC
pop PSW
reti



CheckRdy:
mov A,P0
cjne A,#'U',cTxNow
setb TxNow
mov P0,#0h
ret
cTxNow:
clr TxNow
ret


;[]------------------------[]
;| Setup |
;[]------------------------[]

Init:

mov TMOD,#20h
mov PCON,#80h
mov TH1,#250
mov TCON,#40h
mov SCON,#50h
setb ES
setb EA


;[]------------------------[]
;| Main Program |
;[]------------------------[]

mov 30h, #'H'
mov 31h, #'e'
mov 32h, #'l'
mov 33h, #'l'
mov 34h, #'o'
mov 35h, #'!'
mov 36h, #' '
mov 37h, #'T'
mov 38h, #'x'
mov 39h, #'R'
mov 3Ah, #'x'
mov 3Bh, #' '
mov 3Ch, #'s'
mov 3Dh, #'u'
mov 3Eh, #'c'
mov 3Fh, #'c'
mov 40h, #'e'
mov 41h, #'s'
mov 42h, #'s'
mov 43h, #'!'
mov 44h, #' '
mov 45h, #':'
mov 46h, #')'
mov 47h, #' '
Main1:
lcall CheckRdy
jnb TxNow, Main1
jbc TxNow, Send

Send:
mov R0, #30h
Main:
clr TI
mov SBUF, @R0
Wait: jnb TI, Wait
inc R0
cjne R0,#48h, Main
clr TxNow
ajmp Main1

.END

but when timer2 was used, it woudl just hang after sending 'H'.....

List of 14 messages in thread
TopicAuthorDate
Serial interrupt driven issues--timer1/2            01/01/70 00:00      
   RE: Serial interrupt driven issues--timer1/2            01/01/70 00:00      
      RE: Serial interrupt driven issues--timer1/2            01/01/70 00:00      
         RE: Serial interrupt driven issues--timer1/2            01/01/70 00:00      
   RE: Serial interrupt driven issues--timer1/2            01/01/70 00:00      
      RE: Serial interrupt driven issues--timer1/2            01/01/70 00:00      
         RE: Serial interrupt driven issues--timer1/2            01/01/70 00:00      
            RE: Serial interrupt driven issues--timer1/2            01/01/70 00:00      
   RE: Serial interrupt driven issues--timer1/2            01/01/70 00:00      
      RE: Serial interrupt driven issues--timer1/2            01/01/70 00:00      
         RE: Serial interrupt driven issues--timer1/2            01/01/70 00:00      
            RE: Serial interrupt driven issues--timer1/2            01/01/70 00:00      
         RE: Serial interrupt driven issues--timer1/2            01/01/70 00:00      
            RE: Serial interrupt driven issues--timer1/2            01/01/70 00:00      

Back to Subject List