ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to specify device ID for modbus polling

Hi all,

 

I am trying to poll modbus data from a device that requires that its slave/device id be specified. I'm not sure how to do that in LabVIEW. I have other devices on the network that do not require that parameter, and this code works for them:

readholdingreg.jpg

 

I also know that the rest of my parameters are correct and my slave is properly networked because I am able to poll it using CAS Modbus Scanner with the correct device ID specified.

 

Is there a way to do this in LabVIEW?

 

Thank you,

 

Amanda

0 Kudos
Message 1 of 4
(4,502 Views)

Depends on which Modbus API you are using. The Modbus API that comes with the LabVIEW DSC / Realtime modules has a "Set Unit ID" VI specifically for this. Are you using this one? Check to see if something similar exists for your API.

0 Kudos
Message 2 of 4
(4,484 Views)

I figured it out (of course, immediately after posting).

 

It's in the MBAP header. The MBAP header is a cluster of the transaction ID and unit ID, and is an input to the MB Ethernet Master Query.vi. I made it a control to specify on the front panel. I don't know anything about the Transaction ID, but specifying the Unit ID is what I was looking for and I'm able to poll the data now.

 

readholdingreg.jpg

0 Kudos
Message 3 of 4
(4,482 Views)

I ran into a similar problem, except I was using the Modbus Library that is part of RT/DSC Toolkit. Setting unit ID through property node works as well in additional how tyk007 described above.


I posted my query here - just for reference

Message 4 of 4
(4,427 Views)