Guys, there wasn't a single reply -- did this post make it to the list? ----- Original Message ----- From: "Vitaliy" To: "piclist" Sent: Monday, February 06, 2006 5:45 AM Subject: [PIC]: putrsUSART() breaking DataRdyUSART() > Hello List, > > I have a little circuit which uses a PIC18F4320, whose Tx/Rx lines are > tied > together (Tx is connected through a diode, so it can only drive the bus > low). It's very similar to the Parallax AppMods. > > Now, any time I use putrsUSART(), it causes the DataRdyUSART() function to > stop working. I attached the source code to this message. If you were to > compile and run it as-is, and type "ABCDEFG" in HyperTerminal, you would > see: > > AABBCCDDEEFFGG > > However, if you were to uncomment the putrsUSART() function, you would > get: > > Hello World! > > ABCDEFG > > For some reason, after the putrsUSART() function is used, DataRdyUSART() > never evaluates to TRUE. > > A couple of observations: > > 1. Closing/opening the port after using the putrsUSART() fixes the > problem. > 2. putcUSART() does not have this issue. > > I have a feeling that I am overlooking something very obvious. Any help > with > this matter is greatly appreciated! > > Best regards, > > Vitaliy > > ---------- Source Code ------------------- > > #include > #include > #include > > /* Set configuration bits for use with ICD2 / PICDEM2 PLUS Demo Board: > * - set HS-PLL oscillator > * - disable watchdog timer > * - disable low voltage programming > * - enable background debugging > */ > > #pragma config OSC = HSPLL > #pragma config WDT = OFF > #pragma config LVP = OFF > #pragma config DEBUG = ON > > void main(void) > { > char c; > > //Open the USART configured as 8N1 in polled mode > OpenUSART (USART_TX_INT_OFF & > USART_RX_INT_OFF & > USART_ASYNCH_MODE & > USART_EIGHT_BIT & > USART_CONT_RX & > USART_BRGH_LOW, 255); > > //putrsUSART((const far rom char *)"\rHello World!\r"); > > while (BusyUSART()); // wait until transmission is complete > > for (;;) > { > if (DataRdyUSART()) // check USART read buffer > { > c = getcUSART(); // read character > putcUSART(c); // echo it back > while (BusyUSART()); // wait until transmission is complete > Delay1KTCYx(4); // wait some more > while (DataRdyUSART()) // empty the receive buffer > getcUSART(); > } > } > } -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist