[Tutor] Pyserial and general python serial help

Chris Fuller cfuller084 at thinkingplanet.net
Thu Oct 9 20:30:07 CEST 2008


Are you reading everything in the buffer? How much data is sent every 
10ms? At 9600/8/N/1, the throughput is 960 byes a second, so if there's 
more than 9 bytes, something will give. Similarly, at 115200 baud, the 
limit is 115 bytes.

Some general advice: don't try to sync your program to the 10ms cycle, 
that will be very difficult to do under a modern operating system. Just 
grab all the data waiting in the buffer and find some way to divide it 
into the appropriate time slices.

PySerial has a method that returns the number of bytes in the buffer, so 
use that to set how many bytes you read.

Cheers



More information about the Tutor mailing list