> A sneaky trick is to use 'tuning' to get your timing right. Instead of ju= st loaded > a value into the baud rate divisor and forgetting it, you sample incoming= data > bits to determine their length, and then use the results to set the baud = rate > divisor appropriately. This is very useful in a poll and respond scenario= .. >=20 > On one project I used it by polling the incoming data line, looking for a > transition to high (the start bit). By having the host start each message= with a > byte of 0x0F you will see a 5 bit high time (the start bit and 4 one-bits= of data) > followed by a 5 bit low time (the high order zero bits of the data follow= ed by > a zero for the stop bit). I just time the 5 bit high time and compute the > apparent baud rate from that (which will of course be different from the = real > baud rate depending on the accuracy of the PICs clock). Then I program th= e > baud rate generator and enable the receiver. The receiver will start scan= ning > for the next start bit sometime in the middle of the 5 zero bits, so it w= ill pick > up the first data byte following the 0x0F trigger. This is very similar to the LIN protocol, which is used in the PIC chips th= at will autobaud. Microchip have a couple of application notes on it. --=20 Scanned by iCritical. --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .