From Saturday, Nov 23rd 7:00 PM CST - Sunday, Nov 24th 7:45 AM CST, 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: 

READING/WRITING REGISTERS TO A MODBUS TCP SLAVE TO RS485 MASTER GATEWAY

Solved!
Go to solution

Hello, i have been having issues with the connection to a modbus tcp slave gateway (HD67508-A1-485). The code is really simple and the connection works perfectly with MODBUS POLL (using the exact same register address as the labVIEW code below). Im using the free modbus library. 

As i dont think the archives are needed, here is the labview code, the working Modbus Poll configuration and the ERROR 56 (exiting while).

The problem is probably related to the slave ID and the initialization of the tcp instance.

 

Thannk you for your time!

If anyone needs further information pls let me know.

 

:MODBUS POLL Connection to GatewayMODBUS POLL Connection to GatewayMODBUS POLL Write Single RegisterMODBUS POLL Write Single RegisterlabVIEW CodelabVIEW CodeERROR Exiting WhileERROR Exiting While

 

 

0 Kudos
Message 1 of 5
(614 Views)
Solution
Accepted by topic author APG-B

your code keeps writing on the register every 20 ms. 

Do you need to repeatedly write at this frame rate ? I wonder if you increase the time  between writting if the error will go away. 

0 Kudos
Message 2 of 5
(570 Views)

What does the manual say about the registers, are they starting from 0 or from 1 ? 

Could be a misalignment, so have you tried address 2000? 

 

LabVIEW modbus has the address input as 0 based, but some models/devices has there address in manuals start at 1.   

0 Kudos
Message 3 of 5
(561 Views)
Solution
Accepted by topic author APG-B

Problem solved, it was related to timings and termination. Seems like i can now have the program working well with 20ms but had to turn it to 2000ms for it to work without termination.

 

Thanks!!

0 Kudos
Message 4 of 5
(521 Views)

dkfire, in this case register is set by a translate table. It works well now with register 2001, still, i will keep it in mind for other projects, seems like a really usual cause of error.

 

Thank you for the answer!

0 Kudos
Message 5 of 5
(519 Views)