0

I am trying to receive some data from an RS232 connection (9600 kbps - sending "s" while(1) ( and tested on hyperterminal ) )

I am using p18F8722 and writing in c the following on the processor:

Open1USART ( USART_TX_INT_OFF & USART_RX_INT_OFF & USART_ASYNCH_MODE &
             USART_EIGHT_BIT &  USART_CONT_RX & USART_BRGH_HIGH, 51 );
char message =Read1USART();

When I print on the LCD, I receive wrong characters, most of the time "p" "q" x (bar)...

I really appreciate any kind of help.

tinman
  • 6,348
  • 1
  • 30
  • 43
user2274358
  • 1
  • 1
  • 1
  • Having the baudrate wrong is likely here. – Hans Passant Apr 19 '13 at 14:53
  • Are you able to print arbitrary characters to the LCD from the PIC18 chip? If that issue is isolated, then it seems your problem is an issue with receiving data over your serial connection. Is this something like an RS232(ie: DB9F connector) to USB adapter that connects between a PC and the PIC18's board? How long is the cable? A lot of scientific instruments I use specifically mention not to use such a cable longer than 2 feet, as it degrades the digital signal enough to make it fail consistently. Let us know these details please by editing your original question. – Cloud Apr 19 '13 at 17:15
  • 1
    You need to show some more details, specifically the code you use to write to the LCD, and probably the loop surrounding your call to `Read1USART()`. You should say what library you are using that provide those functions. Also your use of the logical and operator in the first parameter to `Open1USART()` seems suspect. – tinman Apr 19 '13 at 20:15
  • 1
    Same as tinman: the '&' operator between your flags surprises me... – Alexandre Vinçon Apr 20 '13 at 13:46
  • Are you using the same number of parity and stop bits on both sides? – Akhil Apr 22 '13 at 09:23

0 Answers0