|
Re: Serial Port Interrupts
You need to treat the data from/to the serial port as a stream. Construct your code to process it one byte at a time, empty or not. Then you must make sure you read often enough that it is not possible to miss data. If you can't read it fast enough, slow the port down.
So look at the incoming stream, find the SOM char, buffer everything through the EOM char and finally pass the buffer to a function to handle the data. Check for overflows/underflows and invalid sequences while processing the stream. If you get any errors, toss the data and look for the next SOM char.
Check out Kevin's camera code for a good example.
HTH
|