ā12-10-2021 08:52 AM
I'm trying your suggestions. But there are still a few points that I don't fully understand.
I will try to interpret a little.
in labview
Unit ID=Device address.
Starting address=What does it mean? How do I use it?
Number of inputs=What does it mean? How do I use it?
Register Values=What does it mean? How do I use it?
P0-01ā ALE Alarm Code Display of Drive (Seven-segment
display)
Address: 0002H
0003H How do I use adress numbers in labview?
ā12-10-2021 09:40 AM
- Yes the LabVIEW Unit ID is synonymous to the drive's Station ID. Some other manufacturers call it Device ID, and the Modbus documentation calls it Server Address (might have been called Slave Address in the past but they did edit that document in 2020 to remove any mentioning of master and slave.
- The Start Address is the address of the first Modbus item (coil, register) you want to read. Note that LabVIEWs addressing convention is 0 based, the first register is address 0 and that it is for a 16 bit value, so byte addressing will use double the value to address the same value.
- Number of Inputs (or Outputs) is the number of registers to read starting from the Start Address.
- Register Value is the actual value a register contains. It is the value or values you receive from the Read Holding Register function or which you pass to the Write Holding Register function. Modbus registers are 16 bit integers.
Since your device seems to use byte addressing (P0-02 is at address 0x0004 and 0x0005) you would need to divide the first number of the two address values by two to get the LabVIEW Start Address to use for the Read Holding Register function, which here would be then 2.
Note that 0004H is a different way to write a hexadecimal address and is the same as 0x0004, and that also corresponds to 2 for the LabVIEW Address. If you want to read register P5-03, this would be at address 0506H and 0507H and since that is hexadecimal that would correspond to 1286 and 1287 decimal and translated to LabVIEW this would be 643 decimal.
Depending what display mode you set in LabVIEW for the control you can make it also use hexadecimal notation. It is only a display question the value underneath doesn't change, but the fact that this device uses byte addressing requires that you half the register value in the device documentation to get the actual Modbus address.
ā12-10-2021 11:34 AM
I think I understand the situation a little better.
The thing that confuses me for now is this.
The value I read is not the actual values shown by the driver, is this normal?
You've been very helpful, thank you, for now I'm just testing the readings, everything is going well.,
I think index 0 and index 1 are linked. How can I read this in one piece.
I think index 0 up to 0-65535 value
index 1 increases a number every time 0-65535 value is finished. Is it correct to add with normal math? for example index
1=3 index0=15896
index 0+(index 1*65535)=212.501
I guess it remains to write to the parameters.
ā12-10-2021 12:58 PM - edited ā12-10-2021 12:58 PM
I think you got it the wrong way around.
It seems that the address shown in the documentation is actually the Modbus address. And each P value has two Modbus addresses reserved but does not always use it.
P0-09 is address 0012H and 0013H
It is documented to be a 32-bit value
Each Modbus address is only 16 bit however
So you need to read register 0x12 and 0x13 and then combine them to a 32 bit number.
P0-17 is address 0022H and 0023H.
But it is documented to only be a 16-bit value (and only have a range of 0-127)
This means you can simply read 0x0022 and only the lowest significant 7 bits are relevant of those 16-bits
Now you have here all hex numbers. You can set the LabVIEW control to also use hex format display by right clicking on it and in the menu, select Display Format. In the dialog that opens select Hexadecimal and close the dialog with OK. To help you see that this control is not set to display decimal numbers, right click again and select Visible Items->Radix. This will show a lowercase letter in front of the numbers, d means decimal, x means hexadecimal, o means octal and b means binary. When this Radix glyph is visible you always can also click on it and select the display mode there.
With the Start address set to show hexadecimal numbers you can directly enter the address as documented in the manual.
This is for registers documented as 32-bit numbers
For a 16 bit register you simply read the first element for the relevant address and throw away the next register as it is not used.
ā12-11-2021 02:40 AM - edited ā12-11-2021 02:47 AM
Thank you Mr rolfk for your help. I did some experimentation but came to the following conclusion.I guess it doesn't output as you say here.
The value specified in the parameters is Hexadecimalden.Decimale conversion, I write directly to the Labview start address as decimal. The parameter values match the parameter I entered.
I've read and implemented your other suggestion and now the output is fine. Just now I'm trying to read the DI button states.
I'll move on to writing later.
ā12-13-2021 06:10 AM - edited ā12-13-2021 06:27 AM
Mr.rolfk
My current situation. Writing different values to different addresses, but I was not successful. What is the situation I missed?
I tried to explain the situation in the picture below.
I cannot print different values to different parameters.
Please, what am I missing about this? What can I do?
ā12-13-2021 06:30 AM
Why donāt you go through some of the LabVIEW tutorials linked on the main page of this forum? Hint: your problem has to do with array autoindexing
ā12-13-2021 07:36 AM
Thank you for the answer. mr. rolfk
I did the automatic indexing. When I do the following, the application works as I want, but there is a situation that confuses me. Why does it work this way. Is the method I use correct?
ā12-13-2021 07:47 AM
Not exactly. You now write 0 in the register immediately following the one you want to write. If it is only a16 bit register, the 0 value ends up being written into nirvana and probably has no effect but if it would be a 32-bit register you would overwrite the most significant 16 bit of that register with 0.
ā12-13-2021 08:06 AM
What exactly is the correct way to do this. Because if I don't create it that way I can't write different values to different parameters.
I have a second problem, I think it's related to modbus.
Since only values between 0-65536 can be written
I can't write negative value to Modbus. How can this be solved?