> -----Original Message----- > From: pic microcontroller discussion list > [mailto:PICLIST@MITVMA.MIT.EDU]On Behalf Of David Dolheguy > Sent: Saturday, January 10, 2004 7:12 AM > To: PICLIST@MITVMA.MIT.EDU > Subject: Re: [PIC]: UART Help needed to PC > > > is a delay really required after sending each charater to TXREG? The hardware takes TIME to shift out the bits... Many clock cycles. I use the flags and IRQs to allow other processes to proceed while the hardware sends the byte. * | __O Thomas C. Sefranek WA1RHP@ARRL.NET |_-\<,_ Amateur Radio Operator: WA1RHP (*)/ (*) Bicycle mobile on 145.41, PL 74.4 http://hamradio.cmcorp.com/inventory/Inventory.html http://www.harvardrepeater.org > > -----Original Message----- > From: "Jason Harper" > Sent: 10/01/04 5:58:01 PM > To: "PICLIST@MITVMA.MIT.EDU" > Subject: [PIC]: UART Help needed to PC > David Dolheguy wrote: > > > static void usartput(unsigned char c) > > { > > while(!TRMT1) > > TXREG1=c; > > } > > This basically says: for as long as there is something in the transmit > buffer already, send the same character anyway... You need a > semicolon at > the end of the 'while' line. > > Note that TRMT isn't usually what you want to poll for serial > transmission: > it doesn't get set until the character is entirely sent, when you can > actually put another character into TXREG much sooner due to > the USART's > internal buffering. Poll the TXIF bit instead. > > Also note that continuously sending the same character is not > necessarily > going to result in that character being received at the PC, > since there's > no guarantee that it will sync to your start/stop bits. An occasional > pause, of at least one entire character time, will ensure > synchronization. > Jason Harper > > -- > http://www.piclist.com#nomail Going offline? Don't AutoReply us! > email listserv@mitvma.mit.edu with SET PICList DIGEST in the body > > -- > http://www.piclist.com#nomail Going offline? Don't AutoReply us! > email listserv@mitvma.mit.edu with SET PICList DIGEST in the body > -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body