06-18-2010 02:21 AM
Hi,
Currently, i can read data off multiple DAQ devices using the attached VI by manually changing the slave address on the front panel which determines which slave to read data from. However, i would like the VI to do this automatically for me instead of me manually clicking the front panel buttons to change the slave address. In other words, the VI should read data off the 3 slave devices and write them to a data base every 1 second (sampling interval of 1 sec). I have tried using case structures, timed sequences and time delays but i am still unable to get what i wanted. My current VI is a modified version of a VI in the modbus library - "MB Serial Master Query Read Input Registers". Any idea how to do this?
Solved! Go to Solution.
06-18-2010 03:06 AM
Im quite new to LabVIEW, so dont kill me if im far off here 🙂
Could replacing the "Serial Parameters" cluster with the attached structure solve this?
The true case will just set the value back to default(1).
-Tom
06-18-2010 07:33 PM
Yes, that could do the job, but instead of doing it in small separate loop, you must do it in a main loop.
06-18-2010 08:14 PM - edited 06-18-2010 08:15 PM
Yes. The serial parameters cluster that contains the slave address is something you will just programmatically change as needed as opposed to using a front panel control.
By the way, you don't need to have 30 copies of the index array. Create one copy. Expand the bottom downwards. It looks like you start at #16, so just wire a 16 at the top, the ones below it will be successively 17, 18, 19..... If you need to jump to another number, then just wire a constant in for that one.
You also have some awkward datatype conversion to the dynamic datatype. This is going to cause you problems somewhere down the line. If you want an array from 3 scalars, just use Build Array!
06-21-2010 09:42 PM
Hi all,
Thanks for the replies, with your help i've managed to get what i wanted. Really appreciate it.
04-21-2011 04:02 PM
hey man, how did you make that vi? I need to make a vi that read data from a multmeter that use a modbus-rtu protocol and use a USB to RS-485 converter to communicate to the computer but I don't know how to do that. I have the ni modbus library and dsc library but I don't know how use it. When i connect the converter on my computer that appear as COM4.
06-23-2017 06:08 PM
I have 32 Modbus RTU sensors connected to one USB to RS485 converter.
The IDs are from 1 to 32. How can I programmatically select any device without stopping the VI.
Thanks for any help.
06-23-2017 07:40 PM
Just iterate through them in a loop.
When you want to talk to #1, then put one in the slaved address. For #28, put in a 28.
It is just basic programming concepts.