GoTo SerISRAutor: er.lebaron(_at_)hccnet.nl

Interrupt Routine for serial Data. Uses UART
Get Serial Data via Interrupt
This program can be integrated in your own program when you need a routine that captures serial data on interrupt basis. I intend to use it in a RS485 network with several nodes. Each node has its own address.
To prevent unnecessary processor overhead the UART is set up for 9-bit communication. Only 9-bit bytes produce a serial interrupt. The isr checkes whether the address sent matches its own address.
When it does, the UART is set up for 8-bit communication as the sender will do the same after sending the address byte.
This way, futher transmitted data will not produce an interrupt on the nodes that were not addressed but only on the one that is.
The number of bytes in a single packet is variable but is at least 8 (for my application).
That is : the sender address, destination module address, destination device address 3 command bytes and 2 checksum bytes.
Timer2 is started upon receiving serial data and produces an interrupt (timeout) when the time after a serial interrupt exeeds a certain value, indicating that the packet can be processed.