I'm using usart on an 18f series chip and need a way to detect 3 baud rates 19.2, 57.6 and 115.2 . The problem is I can't just use the autobaud detect in the PIC because I have to use the string the comm. channel is sending and detect with that data. The data stream is delimited with hex 00 and the data can be 2 to 9 bytes between the delimiter hex 00. There is a keep alive string of hex 00, 255, 129, 00 every 1 second. Other than that the data is random length and spaced.

I need to be able to connect the comm. cable in the middle of transmission and have it sync up.

I'm thinking of using a timer and testing for the keep alive string and if it times out then switch to the next baud rate and reset timer and test again.

Any suggestion on how to get the baud rate to sync as fast as possible would be greatly appreciated.