| ??? 01/14/09 12:58 Read: times |
#161505 - the solution Responding to: ???'s previous message |
In case anyone else comes across this problem, I found the solution is NOT to clear TI bit in the ISR. The OutChar routine polls TI, and clears it once it is set. It works perfectly.
Main:
call Test
jmp $ ; endless
;------------------------------------------------------------
;serial interrupt
Ser_Int:
jb TI, ExitISR ; ignore if it is a transmission
jnb RI,ExitISR ; test if it is a reception
clr RI ; clear reception flag for next reception
mov A,SBUF ; read data from uart
ExitISR:
reti
;------------------------------------------------------------
Test:
mov dptr,#Test_String
call OutStr
ret
;********************************************************************
; Send a null terminated string out serial port
;********************************************************************
OutStr:
clr a
movc a,@a+dptr ; get character
jz exit ; stop if char = null
call OutChar
inc dptr ; point to next char
sjmp OutStr
exit:
ret
Test_String:
DB 'This is a Test',0dh,0ah,0
;-----------------------------------------------------------------
OutChar:
mov sbuf,a ;Load SBUF
jnb TI,$ ;wait for last bit to transfer
clr TI ;get ready for next byte
RET ;
|
| Topic | Author | Date |
| serial interrupt? | 01/01/70 00:00 | |
| Your Problem | 01/01/70 00:00 | |
| still not working | 01/01/70 00:00 | |
| you need to flag somehow the end of transmission | 01/01/70 00:00 | |
| reply to Jan | 01/01/70 00:00 | |
| Several | 01/01/70 00:00 | |
| To Hans | 01/01/70 00:00 | |
| And my reply to Charles | 01/01/70 00:00 | |
| no interrupts works | 01/01/70 00:00 | |
| the solution | 01/01/70 00:00 | |
| Isn't that what Hans said? | 01/01/70 00:00 | |
| Perfectly????? Prolly should look again. | 01/01/70 00:00 | |
| Got to look ahead... | 01/01/70 00:00 | |
| Another thing to consider | 01/01/70 00:00 | |
| reply to Andy Neil | 01/01/70 00:00 | |
| reply to Michael Karas | 01/01/70 00:00 | |
| why is this a bad idea | 01/01/70 00:00 | |
| Exactly why not perfect !!! | 01/01/70 00:00 | |
| response to Jan Waclawek | 01/01/70 00:00 | |
| interrupts forever | 01/01/70 00:00 | |
| nope | 01/01/70 00:00 | |
Re: Erik | 01/01/70 00:00 | |
| if you HAVE to mix ... | 01/01/70 00:00 |



