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.
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.
05-25-2007 12:08 PM
05-25-2007 01:48 PM
Okay...I removed the number to hex function and dec. str. to number function from my read sequence and it is working like I need it to work. However, can someone let me know if it is possible to enter/write multiple registers from one modbus command? Use an array or something?
Thanks!
Jim
05-25-2007 02:24 PM - edited 05-25-2007 02:24 PM
@jdover wrote:
.... However, can someone let me know if it is possible to enter/write multiple registers from one modbus command? Use an array or something?
Take a look at the Modbus Command cluster in your VI .... one of the choices for the function code is Write Multiple Registers ... and Data is an U16 array. I've used it with DL205 and 305 PLCs.
Good luck.
Message Edited by Donald on 05-25-2007 03:24 PM
05-25-2007 02:55 PM
Donald,
Thanks for the help. When I change the selection to Write Multiple Registers, do the array elements in the numeric field correspond with the register values? For example, does element 1 write into the starting register address, does element 2 write to the the next register address, etc?
Also, I need some of these element values to be user-defined when I run the VI and I'm not sure how to connect a control to each element...(other than using an individual command for each value and simply using a single command for each input.) I've attached the current version that does this but I'm thinking there is a better way to write this code to make it more efficient.
Any ideas?
Thanks!
Jim
05-25-2007 04:02 PM
jdover wrote:
... For example, does element 1 write into the starting register address, does element 2 write to the the next register address, etc?
Yes.
Also, I need some of these element values to be user-defined when I run the VI and I'm not sure how to connect a control to each element...(other than using an individual command for each value and simply using a single command for each input.) I've attached the current version that does this but I'm thinking there is a better way to write this code to make it more efficient.
In the end, you need to send an array of U16 to your registers. There are a lot of ways to present the user with means to enter values for your setpoints, etc. I tend to use clusters and convert to an array as req'd. A (very) quick and dirty example is attached.
05-31-2007 09:46 AM
Donald,
Thanks for the example. Your solution is MUCH simpler than what I came up with in the meantime. I will use it in the future.
Thanks very much!
Jim