From 11:00 PM CDT Friday, Nov 8 - 2:30 PM CDT Saturday, Nov 9, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

RS-485 to RS-232

Hello All,

 

I'm hoping that someone out there can assit me with a problem I'm having with some serial communications.  I'm using the NI 9068 which has three built in serial ports.  Port 1 and Port 2 are RS-232 and Port 3 is RS-485.  When I bought it I thought all three ports were RS-232 as I have three devices that I need to communicate with to the cRIO.  I have in the past had good luck using a B & B electronics RS-232 to RS-485 converter on the same chassis. 

 

I'm trying to communicate with a scale, and I have created VI's that work to communicate with the scale when I use one of the two RS-232 ports.  However I cannot communicate with the scale when I try to use the RS-485 port and the B&B converter (model number 4WSD9R).  I will either get a warning saying that the number of bytes at the port is equal to that which was read (i.e. 0 bytes) or an error -1073807298 when it actually does read something (for example /0/00/0) but not what it is supposed to be reading.

 

I have tested the hardware and the wiring to the converer by connected the RS-485 port to the converter then the converter to a RS-232 port.  I will then write to the 485 port and read from the 232 port.  The data transfers from one port to the other just fine.  I have also switched the configuration to write at the RS 232 port and read from the RS 485 port, and again the data transfer just fine.

 

To me it seems as though there is some issue with the Bidirectinal communications.  In case this is the problem I have the Rx crossing over to the Tx lines on the RS 485 side.  I'm pretty sure this is correct of the communication described above would not work at all.

 

Thanks for any help that can be offered

0 Kudos
Message 1 of 14
(4,897 Views)
The warning can usually be ignored. You are apparently missing a termination character when doing a read. Are you using VISA Bytes at Serial Port? Don't enable a termination character and use this function.

For the error, see if http://digital.ni.com/public.nsf/allkb/60DDFED7EFEFE7188625705700750821?OpenDocument helps at all.

Personally, I don't think a loopback test like what you did does much of anything.
0 Kudos
Message 2 of 14
(4,866 Views)

That is interesting, the code I'm running works fine to communicate to the scale when I use on of the RS-232 ports.  I am using the VISA bytes at port and I do ignore the warning.  but the data I get back is just gyberish when using the RS-485 port.  Is there something I need to do different because I'm using the RS-485 port?

0 Kudos
Message 3 of 14
(4,829 Views)
You use the code with the instrument connected to an RS-232 port and just change the resource name and it works? I'd say that you need to check the configuration of the RS-485 port in MAX. I would hope that you've tried the communication in MAX or another program such as putty.
0 Kudos
Message 4 of 14
(4,820 Views)
First I tried communicating with the device with hyper terminal. Then I developed my code and used the RS-232 on my computer. Then as I said in my original question, I used the RS-232 port on my cRIO 9068. But I have two instruments plus a third instrument of a different sort but only two RS-232 and one RS-485 port. The code works fine on the RS-232 port and not the RS-485.
0 Kudos
Message 5 of 14
(4,797 Views)
I know what you said In your original post but you have not answered my questions.
0 Kudos
Message 6 of 14
(4,790 Views)

What sort of RS-485 to RS-232 converter are you using and are you using 2-wire or 4-wire RS485? The ones I've used before had to have specific settings and/or had a small microcontroller inside them to do line driver control. If you look on this page (http://www.kksystems.com/inline-interface-converters/non-isolated) you'll see different types of converters - some need RTS control if using RS485 and others have a microcontroller onboard for doing automatic driver control. Something to consider?


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 7 of 14
(4,752 Views)

Sorry Dennis, What was your question, Yes i tried it on the 232 port then just chanaged the resource.  Yes I tried using Hyperterminal before I programmed anything in LabVIEW.  The ports are on a cRIO so I cannot use Max.

 

Sam,  I'm using a B and B electronics converter model 4WSD9R there are some dip switches on it and I'm using it in 4-wire mode with echo off. I did a loop back test which worked fine. But if Dennis is correct then that actually doesn't mean anything and I could have something connected wrong.

0 Kudos
Message 8 of 14
(4,732 Views)
I was asking if you had used an external program such as hyperterminal with the RS-485 port. From your last comment, can we imply that it worked?

Do you have a manual for the converter that you can attach?
0 Kudos
Message 9 of 14
(4,726 Views)

What is the Scale?  Is it supplying enogh power to power the converter?  Did you try the external supply?  Does the scale support hardware handshaking?  Does it need hadrware handshaking? (the converter won't drive those lines since it uses them for power)

 

What is your Hyper Terminal configuration that worked on the 232 port?


"Should be" isn't "Is" -Jay
0 Kudos
Message 10 of 14
(4,724 Views)