LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW Modbus

Solved!
Go to solution

Hi,

 

I am new to LabVIEW Modbus and trying to learn about it. Some of the VIs are Write Multiple Registers or Write Single Holding registers. In this one part is called registers to write.It is defined as 

registers to write defines the set of holding registers to be written to the device. These registers will be written to the device in a single atomic operation. A maximum of 123 registers can be written at once, due to size limitations of the Modbus protocol data unit.

Can anyone explain what exactly this means. Also for Write and Read Multiple Registers, it is write values. Is this same as the registers to write. I am  asking this because I have a system where there is a plc and I need to get data from the plc for eg : some voltage value. I believe for that I need to use the read holding registers, just give the address for the getting the data and the read count and that will give the value. But then I believe to get that data we need to tell the system that we need this data and i believe for that i need to use write holding register. So what should i write to the write holding register to get that value. So how does that work is my doubt. Thank You.

0 Kudos
Message 1 of 13
(2,787 Views)

In each Modbus slave an address space is defined for 4 types of I/O. One of them is Holding Registers which I think originally was any type of analog I/O, but is also used to pass multibytes values, for example device settings. Each register is a 16 bits value. The map of the available registers and their meaning is specific for each device.

There are hundreds of Modbus tutorials on the web, though. What is not clear for you exactly?

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 2 of 13
(2,777 Views)

I have updated what I didnt understand above. I will write it again here. I have a system where there is a plc and I need to get data from the plc for eg : some voltage value. I believe for that I need to use the read holding registers, just give the address for the getting the data and the read count and that will give the value. But then I believe to get that data we need to tell the system that we need this data and i believe for that i need to use write holding register. So what should i write to the write holding register to get that value. So how does that work is my doubt. Thank You.

0 Kudos
Message 3 of 13
(2,773 Views)
Solution
Accepted by topic author govindsankar

Values you are interested in are mapped to a given address range. Just read them at those addresses. Why would you need to write before reading? This would be very unusual.

However, at last only the device documentation can give you the correct answer.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 4 of 13
(2,758 Views)

Ok thank you, then may I ask what is the purpose of write registers. Why do I need to write registers or exactly in what scenario do I use this? Thank You. 

0 Kudos
Message 5 of 13
(2,755 Views)
Solution
Accepted by topic author govindsankar

As I mentioned before, they may represent Analog Outputs. Or some types of setting. For example a setpoint for a machine movement.

 

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 6 of 13
(2,751 Views)

Thank You. 

0 Kudos
Message 7 of 13
(2,747 Views)

Hi, 

 

I have a Modbus doubt. I have a plc manual that says the following.

 

The configuration can be set for each channel by using the function code FC16 / write multiple registers at the start address 100h/256d and ends as 117h/279d with one register per channel. Each channel can be configured accordingly.

Configuration Value ⇾ High Byte 11h and Low Byte 01h for channel type Digital Input and setting Switch 2 pole polarity changeable. 

Configuration Value ⇾ High Byte 11h and Low Byte 02h for channel type Digital Input and setting Switch 2 pole polarity changeable. 

etc. 

Now my doubt is what is this configuration value and what is high byte and low byte. I am a beginner to Modbus and hence I don't know most of the stuff. Thank you. 

0 Kudos
Message 8 of 13
(2,744 Views)

A register is a 16 bit value, this means 2 bytes. The first value you quote, expressed in hex form, is 1101h, where 11h is the high byte (most significant) and 01h the low byte (least significant). Now, 1101h is 4353d (decimal), so 4353 is the value you should write into the register.

The meaning of the configuration values is by no means a Modbus standard, you will find the description into the PLC documentation. Also, I guess that 1101h and 1102h would be different configurations so I would expect a different description for the two values.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 9 of 13
(2,738 Views)

Hi,

 

I will tell you what I think and let me know if this is correct or not. So I need the PLC to perform Digital Input functions and get the reading. So I use write multiple registers vi and give the start address 100h and then on registers to write I will give 1101h. This will configure the plc to perform digital input function. Now I can take the reading by using read holding register VI and then give the starting address 200h (this is given in the document for reading values). This will output the values. Is this how it works? Am I correct? Thank You. 

0 Kudos
Message 10 of 13
(2,730 Views)