RS232 outputs garbled strings.

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
jim_g
Posts: 22
Joined: Tue Jan 13, 2015 12:47 pm
Has thanked: 6 times
Been thanked: 8 times

RS232 outputs garbled strings.

Post 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
Attachments
AMU_Slave.fcfx
(18.26 KiB) Downloaded 209 times

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1287
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 384 times
Been thanked: 614 times

Re: RS232 outputs garbled strings.

Post 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
Attachments
31.03.jpg
31.03.jpg (119.19 KiB) Viewed 4198 times

jim_g
Posts: 22
Joined: Tue Jan 13, 2015 12:47 pm
Has thanked: 6 times
Been thanked: 8 times

Re: RS232 outputs garbled strings.

Post by jim_g »

Thank you QMESAR, that fixed the problem. I had thought that Project options/clock speed set that.

Many thanks, Jim

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: RS232 outputs garbled strings.

Post 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

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1287
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 384 times
Been thanked: 614 times

Re: RS232 outputs garbled strings.

Post by QMESAR »

I am happy that it is working now Jim
good luck :D

Post Reply