LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview and Modbus RTU

I am trying to interface an NI cRIO with an Alycat Mass Flow Control, using Modbus RTU, with the cRIO as the master and the Alicat as the slave. I am able to read registers easy enough (16-bit and 32-bit) however, I am not able to write to any registers. For example: the Alicat Register for writing a value to a gas is #400046. I am able to write to that address from my RedLion HMI, so I am certain it is correct. The Alicat Modbus Manual says it uses "16-bit inter value 40046". Then, I create a Text Ring in the LV and then edit the values so that 0=Air, 1=Argon................etc.. . I am not super experienced with LabVIEW so I am not sure what my next step is. I tried using different data types and word sizes but nothing is working. So, I am using a UINT16. My Modbus settings are over serial (2-wire), mode is RTU, and I have the "Use function code 16 for single write" enabled but it doesn't appear to be working. Would anyone have an idea as to why this is happening? Thank you much for your time.

Sorry about the duplicate, I placed this in the wrong topic at first.

0 Kudos
Message 1 of 6
(4,059 Views)

Hi ceilingwalker,

 

Are you using the Modbus VIs that came with the LabVIEW Real-Time module? If you haven't already, it could be helpful if you explore the "Modbus Library.lvproj" shipping example to see how it codes for a master on an RT target. 

 

Could you post your code or a screenshot to help us see where you're at?

 

Lauren D

Applications Engineer

National Instruments

Message 2 of 6
(3,991 Views)

Greetings and thank you for your reply. I am attaching my project however, I am not sure if I saved it properly or not. I don't have internet access on my laptop with the LV running on it.

0 Kudos
Message 3 of 6
(3,966 Views)

Greetings and thank you for your reply. I am attaching my project however, I am not sure if I saved it properly or not. I don't have internet access on my laptop with the LV running on it.

Download All
0 Kudos
Message 4 of 6
(3,966 Views)

When I extracted the files, I was only able to open the project. It looks like the .lvlib files and the VI were not attached, could you attach those? Creating a zip of all of the files would probably be easiest.

 

-Lauren

0 Kudos
Message 5 of 6
(3,934 Views)

ceilingwalker,

 

Typically function code 06 is used for a single register write, not function code 16.  Perhaps your Mass Flow Controller doesn't support function code 16.

 

-DR2

0 Kudos
Message 6 of 6
(3,927 Views)