LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Addressing multiple Modbus devices on the same COM port

Hi,

 

I have a number of Modbus devices, each with their own address, that I want to connect to a single COM port of my PC.

 

This works fine, and I can use LabVIEW to commuicate with all devices successfully.

 

However, I would like to be able to include the address of a given device on the VISA reference wire (to save having to pass an address value around my entire design).

 

I have attempted to do this using the "User Data" property (see attached).  This works fine for a single device, but does not seem to work for more than one device.  In the attached exampe, despite assigning one reference address 1 and the other address 2, they both report address 2 when read.

 

What am I doing wrong?  Is this even possible?  Is there a different way I can acheive the same thing?

 

Thanks!

 

 

Dan
CLD
0 Kudos
Message 1 of 2
(2,919 Views)

This is purely a guess. I haven't looked at your code and I never even heard of the user data property for VISA. My guess is that VISA resources are treated like references and have a single definition - I'm guessing if you configure COM1 to 9600 baud and then configure it on another wire to 2400 baud, both will show the same value (probably 2400). A further guess is that this also applies to the user data property. Again, I haven't checked to see that this is how it actually behaves.

 

My suggestion would be to consolidate all the communication to the same port to a single point in the code to avoid race conditions, but I'm not sure if this is relevant with the Modbus VIs, so instead I would suggest grouping the values in another way (a cluster or class is probably the most practical).


___________________
Try to take over the world!
0 Kudos
Message 2 of 2
(2,908 Views)