11-18-2020 08:42 AM
Hi,
I have a labview program that uses the Modbus VIs. In this there is a write multiple holding registers VI and in this VI on the pin registers to write, a register array of two values are given. Both values are 0. That is an array with 2 rows having both value 0. My question is what does this mean. I don't want to know the function of the device the Modbus VI is connected to. What I want to know is what is this register array of two values 0 and 0. Because I thought I was supposed to give a single hexadecimal value to Modbus and not an array. So what is this register array is my doubt.
Solved! Go to Solution.
11-18-2020 09:23 AM - edited 11-18-2020 09:28 AM
Since that VI is designed to Write to Multiple registers is needs multiple values as an input.
So that array would hold the values you intend to write.
The first index will be written to the first register and successive index's will be written to successive registers
You should be using Write to SINGLE Holding Register if you only need to write a single value to a single register
11-18-2020 09:27 AM - edited 11-18-2020 09:29 AM
Your array is connected to the "registers to write" input. That means you are writing data to two registers. (because there are two values in the array)
Your VI is missing some other critical inputs. Right above that input is "starting address" which is unwired. That means it will default to 0. 0 is modbus register 400001. So you are effectively writing a 0 to 400001 and a zero to 400002
The Modbus Instance In input is missing which comes from the Create Modbus Instance subVI.
It sounds like you are new to Modbus, so I'd suggest looking at some online resources to understand the protocol better.
11-19-2020 01:04 AM - edited 11-19-2020 01:18 AM
Thank you, that is exactly what I wanted to know, first value to first register and second value to second register. But I still have one more doubt. There is a document on this and there it says the at start address 300 write registers 0002h which is 2 bytes. But then why did the programmer write an array of two values of 0. My doubt is not the value. What is the difference in the value, I think it must be some reason with the configuration of the device. My doubt is the bytes. What I want is, the 0 in the array of registers, is it actually 00. So the array of registers with 2 values of 0 is actually 0000 and this is written to the two registers in the device, 00 to the first register and 00 to the second register. This is what I think. Is this correct.
11-19-2020 02:30 AM
You keep talking about having "doubts" which means you don't believe something. But it sounds like you actually have questions.
You have a question about what the programmer does in a document, but you didn't attach that document you are referring to.
0002h is two bytes in hex, that represents the number 2 in decimal.
A register is 16-bits (2 bytes). If the number of registers to write is 2, that is 2 16-bit values. Then they do want to send an array of 2 values.
Without the manual to refer to it is impossible to know what the programmer was trying to do and thus to be able to clearly answer your question.
11-19-2020 02:52 AM
Ok, I just want to know is the number 0 actually 00. That is what I want to know.
11-19-2020 07:18 AM
@RavensFan wrote:
You keep talking about having "doubts" which means you don't believe something. But it sounds like you actually have questions.
I see this a lot with our colleagues whose first language is not English. Somewhere "question" translates into "doubt" - presumably because to "doubt" something is to question it. What is interesting is that they tend to use it as a noun far more often than we do.
11-19-2020 09:19 AM
@govindsankar wrote:
Thank you, that is exactly what I wanted to know, first value to first register and second value to second register. But I still have one more doubt. There is a document on this and there it says the at start address 300 write registers 0002h which is 2 bytes. But then why did the programmer write an array of two values of 0. My doubt is not the value. What is the difference in the value, I think it must be some reason with the configuration of the device. My doubt is the bytes. What I want is, the 0 in the array of registers, is it actually 00. So the array of registers with 2 values of 0 is actually 0000 and this is written to the two registers in the device, 00 to the first register and 00 to the second register. This is what I think. Is this correct.
Check out this forum topic: NI LabVIEW Modbus API Discussion for detailed answers to your questions about the NI Modbus library