

That is, the master initiates all communication and is responsible for sending requests to which the slave must respond. Modbus is an application-level protocol which defines a set of functions used for interaction between a master device, such as an HMI or PAC, and a slave device, like a PLC, gateway, or sensor.Įvery interaction between master and slave is a request-response interaction. At present, National Instruments provides four options for Modbus connectivity. Modbus is a commonly used protocol for industrial communication.
#Labview modbus code how to#
The source string includes the name of the VI that produced the error, what inputs are in error, and how to eliminate the error.The current version of this library is provided in VI Package Manager.
#Labview modbus code code#
If status is TRUE, code is a negative error code. Use error in and error out to check errors and to specify execution order by wiring error out from one node to error in of the next node. If an error occurs while this VI or function runs, the VI or function runs normally and sets its own error status in error out. If an error occurred before this VI or function runs, the VI or function passes the error in value to error out.

Timeout specifies the maximum time period, in milliseconds, that the VI waits for the slave's response before throwing an error. For example, if Starting Address is 0 and Quantity is 4, the VI reads coils from the slave at address 0, 1, 2, and 3. Per MODBUS convention, the register address of the slave device is calculated by subtracting 1 from the register name that you specify in the master device configuration software. Refer to your device's documentation to find the coil address mapping. This address is sometimes referred to as offset. Starting Address is the first address location of the coil to read. This control also specifies the session and class. VISA resource name specifies the resource to be opened. Slave Address This is the address of the slave you are communicating with. Mode RTU Data is represented in binary format. This is the address of the slave you are communicating with. The master uses this VI to read the slaves' coils.
