V G wrote: > I used a simple program that calculates PIC UART configuration > register values based on the clock frequency and desired bit rate. I > selected various common frequencies such as 16 MHz, 20 MHz, and so on, > but all of them resulted in the program calculating a non-zero error > percentage value (0.16% at 20 MHz and 9600 bits/s). A screenshot of > the program can be viewed here: > http://img249.imageshack.us/img249/8761/screenshotno.png > > Is this non-zero error value acceptable? Of course some amount of error is always acceptable. There is no such thing as zero error in cases like this. Even if the nominal crystal frequency can be divided down exactly to get the desired baud rate, you still have crystal error. So the real question is how much error is acceptable. There are 9 1/2 bit times from the start of a character to the middle of the last bit, assuming 8 data bits, no parity bit, and 1 stop bit. Ideally you have +- 1/2 a bit time wiggle room in sampling a bit in its center. 1/2 / 9.5 = 5.26%. Since that's the guaranteed to fail limit, you don't want to be close to it. Half that, or 1/4 bit time in the middle of the last bit it 2.63% error. That's OK if you know the other end is right on. If both ends are off by 2.63%, then you're back to the guaranteed to fail limit. If you need a consistant spec for all nodes, then half again that, or +-1.32%, guarantees that the total error stays within 1/4 bit in the middle of the last bit. Usually we try to be a little better than that because stuff happens and you want some margin. The general rule of thumb is try to keep the baud rate mismatch to 2% or below. That means 1% per end unless you know the other end to be better than that. Your 0.16% error is of no consequence. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist