??? 12/20/06 07:40 Read: times |
#129799 - UART Question Part 2 Responding to: ???'s previous message |
A follow up question. I've searched the forum/google/datasheets, but am having a tough time figuring somethign really basic out. When you want to write to the UART, you get an interrupt only AFTER the transmission is complete. Given a highish system clock and a significantly lower UART->RS232 baud rate, there will be a serious latency associated with:
mov SBUF0, blah right? So that if you have: mov SBUF0, blah instruction1 instruction2 instruction3 It is very likely, indeed absolutely, the case that the processor will start fetching/decoding the instructions following the write to SBUF0 BEFORE the transmit interrupt occurs, right? So, my question boils down to what's the "right" method of waiting until you transmit everything before moving on to the next instruction? I want to make sure I wait because I have a loop with a write to SBUF0 and I'm getting all sorts of strange results. My guess is that my next write to SBUF0 occurs BEFORE the previous transmission is complete. I don't want to do a bunch of nop's because that seems really shaky and not very portable. Ideally I'd like to use the TI0 flag, but I'm having trouble getting it to work properly. I thought that maybe mov SBUF0, blah JNB TI0, $ next instruction would work provided that my ISR for transmit clears TI0 (which it does). My thinking was that TI0 would be clear until the interrupt trips at which point it would to the next instruction/ISR. That didn't work so I tried a "hack" using the carry bit. I thought that i'd do: mov SBUF0, blah setb c JC $ and have the isr clear the carry, but no dice. Any suggestions? Am I totally wrong on this? Thanks guys! |
Topic | Author | Date |
the nature of the UART/steping through interrupts | 01/01/70 00:00 | |
Uart is full duplex | 01/01/70 00:00 | |
Thanks Russell | 01/01/70 00:00 | |
UART Question Part 2 | 01/01/70 00:00 | |
You can not do both | 01/01/70 00:00 | |
In response to Neil | 01/01/70 00:00 | |
go with the bit | 01/01/70 00:00 | |
In response to Neil | 01/01/70 00:00 | |
In response to Neil | 01/01/70 00:00 | |
Sorry for teh tripple post... | 01/01/70 00:00 | |
More... | 01/01/70 00:00 | |
Search and Read | 01/01/70 00:00 | |
Thanks Russell | 01/01/70 00:00 | |
I hope Russell did not lead you down the garden pa | 01/01/70 00:00 | |
Erik - garden path indeed! | 01/01/70 00:00 | |
I'm using interrupts | 01/01/70 00:00 | |
Question about my interrupt driven UART | 01/01/70 00:00 | |
You know the answer. | 01/01/70 00:00 | |
Thanks Russell | 01/01/70 00:00 | |
answer is partially incorrect![]() | 01/01/70 00:00 | |
Can't single step on UART | 01/01/70 00:00 |