LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Automate the "set holding registers" function in Modbus TCP Master VI

Solved!
Go to solution

Hi everyone,

I'm currently using the standard/sample Modbus TCP Master VI to send holding register values to a PLC. At the moment, I need to manually press the "Set Holding Registers" button each time I want to transfer data to the PLC.

I’m trying to modify the VI to automate this process and eliminate the need for manual interaction. However, I haven’t had any success so far.

Has anyone implemented this kind of automation or could provide guidance on how to achieve it?

The Modbus Master Sample VI is attached.

 

Thanks in advance!

 

Serdar Akin

0 Kudos
Message 1 of 3
(134 Views)
Solution
Accepted by topic author AH_Serdar

Hi Serdar,

 

  • Add the timeout event to the SetHoldingRegisters event case.
  • Hold the the timeout value in a shift register and intialize with "-1".
  • Once the PLC is connected you can set the timeout value to 100 (ms) in the shift register.

This would be the way to change that example VI.

 

The better way for automation could be to convert the whole VI into a simple state machine of "connect", "set registers", "disconnect"… (I guess you want to include this VI inside a main control routine/VI, don't you!?)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 3
(130 Views)

Hi Gerd,

 

Thank you for your quick response.

Your 1st solution was a" spot-on solution" for me and worked out well. 

Thank you for your support and effort.

 

Best regards,

Serdar

0 Kudos
Message 3 of 3
(59 Views)