I am not sure this answers your question directly, but how about your clock source on the PIC? If it is a stable crystal, that is good. If it is a stable crystal of 18.432 MHz or some other frequecies that allow direct division to a standard baud rate, that is better. If it is a regular 4 MHz or 20 MHZ crystal, you are going to have some error in the baud rate generator, causing problems talking to a PC. If you are using an RC clock source, you are screwed as far as RS232 serial comms go, unless you are using I2C or some other scheme that also outputs the clock. Slow baud rates are better. If you can recompile your code for 9600, 2400 or even 1200 you will always have more stability. I ran into this the other day, and could not for the life of me get any data to the PC through a MAX232. I recompiled the code for INVERT (an option under CCS C, 1's complements the data to the UART or software Uart) and tossed the MAX232 in the trash, and things worked OK. The scope says that signal timing was correct on the MAX232 both ends, and I am still scratching my head about it. You may have a devil of a time doing this under Assembler. -- Lawrence Lile "Roberts II, Charles K." Sent by: pic microcontroller discussion list 09/29/2003 03:02 PM Please respond to pic microcontroller discussion list To: PICLIST@MITVMA.MIT.EDU cc: Subject: Re: [PIC]: Writing data out using USART I am taking a closer look at how the Baud Rate is generated in my code. Well it's not really my code. The project was handed to me by someone who is building off someone else's code. And now I am trying to iron out the kinks while learning about programming in PIC ASM. I am thinking now that it is the baud rate. It looks like the values are taken form the table in the 16f873A data sheet, which I have herd from sources on the web is wrong. Can anyone verify that the baud rate table on 16F873A data sheet, pg. 98 is incorrect? Charles K Roberts II ORNL-SNS Project -----Original Message----- From: Josh Koffman [mailto:listsjosh@3MTMP.COM] Sent: Monday, September 29, 2003 4:39 PM To: PICLIST@MITVMA.MIT.EDU Subject: Re: [PIC]: Writing data out using USART Well, other than your code being wrong, you could have the wrong settings on the PC terminal program. I wouldn't discount an error in your program though, that is where the problem is 9 times out of 10 when I have problems. Josh -- A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools. -Douglas Adams "Roberts II, Charles K." wrote: > I am trying to write a byte from the PIC to the PC on the USART. But > when I write a byte to TXREG the byte received at the PC is always > incorrect, and sometimes the PC reads two bytes. I am using a MAX232 to > do the level conversion and I am confident that the USART is set up > correctly. What are some possible causes for this? -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads