Timing for serial dataEdit
The serial interfaces that we use use parameters 8N1, which means 8 bits at a time, no parity bit, and 1 stop bit. Each transmission starts with one stop bit, then the 8 bits being transmitted, then 1 stop bit for a total of 10 bits transmitted per byte of information. In order to calculate the time required for a transmission, we also need the baud rate, which is the number of bits transmitted per second.
Timing follows the formula of : total_transmission_time = (number of bytes transmitted * 10) / (baud rate)
In units, this translates to seconds = bits / (bits/second), where there are 10 bits per byte of information transmitted, as described above.
For example: A compass string, such as $PTNTHTM,71.3,N,-0.4,N,-1.4,N,75.9,2618*03 requires transmitting (42 + 2) bytes, where the +2 comes from the carriage return and newline (\r\n) which are invisible at the end of the string. Assuming the compass baud rate is set to 19200 (which it is as of January 2011), it should take
time = (44 bytes * 10 bits/byte)/ (19200 bits/second) = 440/19200 seconds = 0.022917 seconds = 22.9 milliseconds
Sending a signal to Pololu consists of 3 bytes. The baud rate can be set up to 38400 baud. Using the same formula this leeds to a timing of 0.78 milliseconds.