Couple hints. 1. Check the signal on RxD and TxD lines with the scope ( look if there slow signal rise and fall edges ) 2. Debug PIC sending procedure first - make sure it is indeed send what you want at 57600, 8N1 to pc 3. Then debug PIC receiving procedure. Make sure you dont loose byte you received and there is no delay after byte received and processed otherwise next byte received might be corrupted. 4. Then close loop receiving to sending the way you just explained 5. 2% baud rate error should be acceptable if it is indeed 2% ( verify that 32 MHz is not actually 31 MHz or 33 MHz ) 0.5 / (1+8+1) = 0.05 which 5% border for baud error. Verify also prescaler value you load to create 57600. After all 57600,8N1 means approx. 173.61 uS per byte With cycle as 125 nS it gives 1388 command per byte Let estimate interrupt handler as 70 commands long or smaller, 5% of processor time is used which means FIFO can be easily done in software. WBR Dmitry. Laszlo Zsolt Nagy wrote: > > Hi All, > > I have a PIC18LF452, connected to my computer on the COM1 port (using a > MAX232 to interface between the USART and the serial line). > CLK = 32MHz, and I'm using 56700 bps speed. (Relative baud rate error is > about 2%.) > > The simplest program I could create: read a byte from the USART port, > add 16 and then write it back (in an infinite loop). > > On the computer's side, there is a Windows application, sending out the > byte '255' continuously. The value it reads back from the PIC is > 255,224,255,224 etc. > In binary, this is: 11111110b,1110000b,11111110b,1110000b etc. From the > windows side, the COM port was setup to 56700bps, 8 data bits + 1 stop > bits, no flow control & async mode. > > Looks like a synchronization problem, but I could not fix this. (I was > trying for days...) > Do you have an idea why am I getting the wrong values? > > Thanks > > Les > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist