LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial Modbus using LV8

I have a problem and need help understanding modbus. I have received the following from our vendor and I have to write a Modbus VI to communicate to the equipment.
Function Parameter Value Modbus Address Input / Output
Start #18.31 1 41831 Input
Stop #18.31 0 41831 Input
Direction #6.33 0 = Fwd, 1 = Rev 40633 Input
 
I do have NI Modbus.llb that i have downloaded from NI website. My problem is, how do I use the above values and convert into the data units for modbus.
For e.g., Parameter #18.31 means what for modbus and where do I pass into?. Same with the value and modbus address. When I look into the NIModbus vis, there ar different terms like function code, starting address, quantity and data.
 
Please help..
Thanks,
 
0 Kudos
Message 1 of 31
(5,694 Views)
If you are going to control this device, you will want to write holding register values. 1831 and 633 would be the address to write the data into. It assumes 40000 because it is a holding register. The value that you write in this case is either an I16 or a U16 and will be either 0 or 1. The address is the number of the device that you want to write data into. You can network modbus devices and have up to 255 devices present.
See the attached file for the modbus specification.
Message 2 of 31
(5,684 Views)
Hi,

Just to clairfy a little, you will use the "Write Single Register" function (Code 6) in the NI Modbus library (which is synonymous to the Holding register).

Secondly, for the "Starting address" -- assuming your device addresses are 1-based (as they usually are) -- you will want to try using 1830 and 632 (i.e., one less than the actuall device addresses; and omitting the preceding "4"). And "Quantity" will be 1 obviously.

Regards,

-Khalid
Message 3 of 31
(5,678 Views)

Thanks for the reply Khalid and Uncle bump,

I am using MB Serial Master Query.vi and as you mentioned, I used the func. code, starting address, qty and data. But, there is something called "Modbus Data Unit In" . Do I have to use that to actually send the data to the device?

Thanks,

0 Kudos
Message 4 of 31
(5,673 Views)


@chokro wrote:

... I am using MB Serial Master Query.vi and as you mentioned, I used the func. code, starting address, qty and data. But, there is something called "Modbus Data Unit In" . Do I have to use that to actually send the data to the device?


No, you don't need to use the "MDU In" cluster if you've entered your commands in the "Modbus Command" cluster ... this saves you the trouble of converting decimal to hex, etc.
=====================================================
Fading out. " ... J. Arthur Rank on gong."
0 Kudos
Message 5 of 31
(5,662 Views)

hi all,

I am looking at this vi from NIModbus.llb and I am bit confused in inputs and outputs.

MB Modbus Demo Box Example.vi

On the front panel of this vi, there are digital and analog inputs and outputs. What really confusing me is that in the block diagram, outputs are used as inputs and inputs as outputs. Also, when i run the vi, I can control the outputs but not the inputs.

Any suggestion or explanation? I am sure I am understanding it wrong.

Thank you,

0 Kudos
Message 6 of 31
(5,548 Views)
hi all i am new to lab view  serial modbus communication ,i know function codes of modbus but how to send  the data  to slave device in programming  we do not have hexdecimal part in modbus clster plese tell me how to send a data to adevice
 
0 Kudos
Message 7 of 31
(5,273 Views)

Hi jabili,

What version of LabVIEW are you using?  Does the device you are communicating with read hexadecimal or decimal registers? 

The developer zone article LabVIEW Through Modbus Serial Devices explains in good detail how to communicate to devices using modbus. 

A few other articles that might be useful in your application are located below. 

Modbus Register Mapping in LabVIEW 8.x
Conversion between Hex and Decimal
How do I Interpret Modbus Registers Written in Hexadecimal Format?

Regards,

Andy L.
Applications Engineer
National Instruments
0 Kudos
Message 8 of 31
(5,243 Views)
hi andyl  i am using 8.5 version .i understood the query example but the slave example did not understand  .my qusetion is how i  build slave  response vi in mod bus protocol . thanking u  sir responding. i am student of post gradutate plese help me in my  project  work.
0 Kudos
Message 9 of 31
(5,215 Views)
ello..plz help me..i have some problem when i want to write multiple register to my device. there will be a time out error.what should i do...plzz.
0 Kudos
Message 10 of 31
(5,128 Views)