rs485 half duplex

Discussion to talk about software related topics only.
Post Reply
jleni
Posts: 15
Joined: Tue Nov 18, 2008 5:50 am

rs485 half duplex

Post by jleni »

I have the following issue and I would really appreciate if anyone could give me a tip.
I have one device connected to SB72EX port 0, using rs485 half duplex. I can perfectly read the data that comes from the device but when I answer the other device seems not to hear anything.
I tried uploading the SB72EX original firmware and to send the same information via TCP. The strange thing is that this works....
So I think there is something I am not doing well when writing to that port. I know there are some rs485 transceivers that I should toggle the ~RE bit to start writing, but I don't see that option in the API so I suppose it is done automatically...
Any tips why my code is not working? What would be the typical setup to be able to write some bytes to port 0 with rs485 half duplex?
Thanks in advance
Ran_Talbott
Posts: 10
Joined: Tue May 13, 2008 9:01 am

Re: rs485 half duplex

Post by Ran_Talbott »

I forget where I got this info: I'm pretty sure it came from a reply to a post I made, myself, asking this question a while back.

You need to declare the function yourself, because it's not in the headers:

Code: Select all

void Serial485HalfDupMode(int port,int enab);
"portnum" is the physical serial port number, not a C library file number.

Then invoke it with a TRUE for the "enab":

Code: Select all

Serial485HalfDupMode(portnum, TRUE);
You also need to change a couple of jumpers on the SB72 board. I wired a DPDT switch to the jumpers on my "development" SB72, because I was going back and forth a lot between targets that run on RS-232 and RS-485.

Ran
jleni
Posts: 15
Joined: Tue Nov 18, 2008 5:50 am

Re: rs485 half duplex

Post by jleni »

ay ay ay !!!
I was using the file descriptor instead of the port number... hehe
Thanks a lot
Post Reply