Page 1 of 1

RS232 outputs garbled strings.

Posted: Mon Mar 30, 2015 2:34 pm
by jim_g
Hi
I have a PIC 18F45K22 running at 8MHz and am trying to receive command strings in the form L_nnn~ where nnn is an unsigned integer and L is an identifier. The received string is garbled as if the baud rate were set wrongly, but it looks OK. I have tried two RS232 sources, one a terminal, with the same results and the RS232 signal on PortC.B7 decodes correctly using a Saleae analyser.Can anyone help please?
Thanks
Jim

Re: RS232 outputs garbled strings.

Posted: Mon Mar 30, 2015 3:01 pm
by QMESAR
Hi Jim
As you are using the Internal Hi frequency Oscillator you need to use a C component and configure your Internal Oscillator Register OSCCON to use 8 MHZ
your device seems to me not running at 8Mhz more likely on the 16MHZ standard setting

:D

Re: RS232 outputs garbled strings.

Posted: Mon Mar 30, 2015 3:36 pm
by jim_g
Thank you QMESAR, that fixed the problem. I had thought that Project options/clock speed set that.

Many thanks, Jim

Re: RS232 outputs garbled strings.

Posted: Mon Mar 30, 2015 3:43 pm
by Benj
Hi Jim,
I had thought that Project options/clock speed set that.
The Project options clock speed calculates things like delays and baud rates for you but assumes the value entered matches what the hardware is actually being clocked at.

The 1 second flash test is always a good sanity check: http://www.matrixtsl.com/wiki/index.php ... ED_flasher

Re: RS232 outputs garbled strings.

Posted: Mon Mar 30, 2015 3:45 pm
by QMESAR
I am happy that it is working now Jim
good luck :D