Page 1 of 1

RS 485 - Recieve Problem

Posted: Thu Sep 29, 2011 9:36 pm
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

Re: RS 485 - Recieve Problem

Posted: Thu Sep 29, 2011 9:38 pm
by PICFriend
me again
try a better picture

sorry

Re: RS 485 - Recieve Problem

Posted: Fri Sep 30, 2011 3:50 pm
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.

Re: RS 485 - Recieve Problem

Posted: Fri Sep 30, 2011 4:19 pm
by PICFriend
Hey benj,

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

Thank you for support!

Carsten :mrgreen: :!: