RS 485 - Recieve Problem

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
PICFriend
Posts: 36
Joined: Sat Nov 13, 2010 6:50 pm
Location: Germany

RS 485 - Recieve Problem

Post by PICFriend »

Hello Guys,

Something strange with RS 232 Component (RS485 via SN75176 halfduplex) makes me :? .

I am using a PIC 18F2550 with USB Bootloader, Xtal 20Mhz PLL = 48Mhz systemclock.
Also i want to send RS232 9Bit signals with the hardware uart an the rs232 component in Flowcode v4.5.18.74.
RS 232 is running with 38400Bd.
The incoming signal on the PIC RX pin is attached, measured with a scope. My opinion is: The signal is well.
But when i read the INT variable what is given from the rs232 component macro, there is a value 263d means "1 0000 0111"
Why is the 9th Bit set? :?:
The send Signals from this device are ok too!
What i have to do in Flowcode, to get a right variable. The INT variable what is given from the rs232 component macro is
only this time used in the hole programm.

Is there a baudrate problem for this 18F2550 or a wrong Xtal?

Greets from Germany

Carsten
Attachments
DSCI0071.JPG
Signal on incoming line seems to be ok.
(167.66 KiB) Downloaded 691 times

PICFriend
Posts: 36
Joined: Sat Nov 13, 2010 6:50 pm
Location: Germany

Re: RS 485 - Recieve Problem

Post by PICFriend »

me again
try a better picture

sorry
Attachments
DSCI0071.JPG
DSCI0071.JPG (30.66 KiB) Viewed 3076 times

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: RS 485 - Recieve Problem

Post by Benj »

Hello,

Ok We have had a look into this problem for you and have discovered the cause of the bug in the component C file for PIC.

Here is an updated Component C file with the bug fixed. Simply download the file and drop it into the Flowcode v4/Components directory before starting Flowcode and the changes will be loaded next time you open and compile your program.
PIC_RS232.c
(18.69 KiB) Downloaded 262 times
The problem was caused by this portion of code in the receive function.

Code: Select all

if(ts_bit(rcsta, RX9D));
	retVal = 0x100;
Note the extra semi colon after the if statement which was causing the return value to always be loaded with 0x100 even if the received 9th bit was a 0.

PICFriend
Posts: 36
Joined: Sat Nov 13, 2010 6:50 pm
Location: Germany

Re: RS 485 - Recieve Problem

Post by PICFriend »

Hey benj,

It works. This seems to be the perfect solution!!

Thank you for support!

Carsten :mrgreen: :!:

Post Reply