PDA

View Full Version : Grabbing word from UART buffer



Macgman2000
- 11th August 2008, 16:07
Hello,

I wrote a snippet a while back (3yrs) and have recently picked it back up for reuse. I have a UART packing a variable and incrementing a counter before jumping out of an ASM interrupt routine. I want to pick up 2 bytes (1 word ) from the UART receive buffer. At this time I have the code working on grabbing 1 byte. How do i grab 2 bytes from the UART with one interrupt? Is there a special ASM designation to command a double byte transfer from the RCREG buffer into a variable?

Nick

skimask
- 11th August 2008, 16:13
How do i grab 2 bytes from the UART with one interrupt? Is there a special ASM designation to command a double byte transfer from the RCREG buffer into a variable?
You probably don't grab two bytes with one interrupt, unless you want to run the risk of overrun errors and missed data. You can really only grab one byte per interrupt and put those bytes as words in your main program.