From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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: 

Problems with RS485 and Modbus

Hey everyone,

 

I am using RS-485 which is connected to cRIO-9056 to communicate with a temperature controller. On one side i have RJ50 plug connected to NI 9871.On the other side i need to make a 2 wire connection to A-, B+ & GND. I'm shorting the TXD- & RXD- and connecting them to A- and then shorting the TXD+ & RXD+ and connecting to the B+ of my RS485. In Labview i made simple program which i included below. So my question is what am i doing wrong because i get error: SubVIs.lvlib:RTU Data Unit.lvclass:Read ADU Packet.vi:5030001. Im searching answer for the past week, and i couldn't fine any understandable answers on any page. 

 

Thanks in advance.modbus.png

0 Kudos
Message 1 of 7
(2,775 Views)

Looking at the VI I'm assuming you are receiving error 56, is that correct? If that's the case, the most likely cause of the error is that we attempted to read the bytes available at the serial port but never saw anything come in.

 

I would first make sure that you can do a simple loopback to make sure the interface is working as expected but I would also double check the address that you are reading (are you actually trying to read address 40,001 or input register 1)?

Matt J | National Instruments | CLA
0 Kudos
Message 2 of 7
(2,740 Views)

First, thank you for your reply. 

 

Yes, that's right, im getting error 56. I made loopback test and it was working. Im trying to read first holding register. To datasheet which i have, it says those registers start at 40,001.

 

Best regards.

0 Kudos
Message 3 of 7
(2,696 Views)

Hi,

 

You should disable the termination character of the Config serial VI. 

I don;t use the library but is there no Config VI in the library ?

 

If the manual says register 40001 you have to translate that as using function code 3 register 0.

Most today devices will accept code 3 and 4 for reading registers. But the manual should mention this.

 

Some manufacturers swap the RS-485 wires (still don't know why ?!?) 

 

Kees

0 Kudos
Message 4 of 7
(2,673 Views)

Thanks for all the answers. I checked everything from your list and after I turned off the Config serial and changed wires it worked. 

0 Kudos
Message 5 of 7
(2,633 Views)

Can you explain what do u mean by turned off the config serial?? Where is that option.

 

It would be helpful if you can share the solution vi or image for reference.

 

Thank you and help is highly appreciated.

0 Kudos
Message 6 of 7
(1,938 Views)

What he means he disabled the termination character.

 

AeroSoul_0-1627992185240.png

Wire a false constant to this node to disable termination character.

0 Kudos
Message 7 of 7
(1,931 Views)