From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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: 

modbus tcp - receiving messages from slave

One more thing Raven, for the Modbus API Library provided by NI the output register value does not include the unit ID, function code and the byte count in this case? Normally this will be in a typical Modbus Message...

0 Kudos
Message 21 of 27
(448 Views)

@cyongjed wrote:

Ok thanks Raven got it, can I ask why did you use a for loop in this case?

So it can process each byte.

 


@cyongjed wrote:

One more thing Raven, for the Modbus API Library provided by NI the output register value does not include the unit ID, function code and the byte count in this case? Normally this will be in a typical Modbus Message...


What do you mean by it doesn't include?  It is in the message it sends to and the response it gets back from the device.  It is within the protocol.  Are you expecting it to be output from the VI's as well?  That wouldn't make sense because it would be more stuff you'd have to strip off to get to the data you are trying to read from the messages.

 

If you want to show, then you can get it from your inputs and concatenate it to the beginning of your output string.

0 Kudos
Message 22 of 27
(442 Views)

Hi Raven,

Sorry to bother the no of bytes count in the message and function code how do I link it from the input to form the message?

0 Kudos
Message 23 of 27
(424 Views)

I'd have to see a VI where you point out what you are asking.

 

But I don't think you need to worry about it at all.  If you use the NI Modbus library has it's designed, it takes care of reading the proper number of bytes for you!

0 Kudos
Message 24 of 27
(419 Views)

Thanks again Raven, appreciate the help given

0 Kudos
Message 25 of 27
(409 Views)

Hello All,

 

I use this library for my client with success but today I need to simulate the server because I don't have the material available. This equipment has the particularity of having 12 modules (acquisition cards) each with its own modbus identifier. This slave set has only one IP address. Otherwise, I have a good experience with Modbus in serial and in TCP but I cannot recover the Unit ID of the messages received to distribute the messages received to the right module and organize tables for each module of the slave. My client (master) is operational with the equipment (temporarily inaccessible). This is the only thread that deals with Unit ID or MBAP that I have found on the forum. Do you have an example or some good (verified) tips to help me?

Il y a des bugs qui ne me méritent pas ! ... ou le contraire peut-être !?
0 Kudos
Message 26 of 27
(325 Views)

So this equipment uses many different unit ID's, one assigned to each module within it?

 

Exactly what are you asking for here?  A way to figure out what unit ID's are being used by this equipment?

 

The manual should really have some explanation of what module has what unit ID, otherwise it isn't worth the paper it is printed on.

 

When you say "My client (master) is operational with the equipment (temporarily inaccessible)", are you talking about the software that the equipment manufacturer provides, or the LabVIEW modbus library?

 

If you mean your LabVIEW program, then obviously you don't have problem since it works.

If you mean the manufacturer's software, what you could do is run a program like Wireshark.  Filter the the results you capture for port 502 and/or the equipment's IP address.  From the messages, you should be able to see what unit ID is being used.  It's been a while since I've done that, but I think Wireshark will help decode the parts of the message for you.

0 Kudos
Message 27 of 27
(312 Views)