Floating-point data handling (modbus master) – ProSoft Technology MVI56E-MCM/MCMXT User Manual
Page 46

Configuration as a Modbus Master
MVI56E-MCM ♦ ControlLogix Platform
User Manual
Modbus Communication Module
Page 46 of 199
ProSoft Technology, Inc.
June 18, 2014
Label
Description
Node = 1
Issues the Modbus command to node 1 on the network.
Func = 2
Issues Modbus Function Code 6 to write a single register.
DevAddress = 1040
Function Code 6, DevAddress of 1040 will write to address 41041 of the
Modbus Slave device.
2.3.8 Preset (Write) Multiple Registers 4x (Modbus Function Code
16)
Used to write to Modbus Holding Registers 4xxxx, this function code will write
multiple registers to the Slave device. The Enable code can be set to a value of 1
for a continuous write, or a value of 2 to write the data to the Slave device only
when the data associated with the IntAddress field has changed.
Below is a sample command to write Modbus addresses 41051 to 41060 of node
1 on the Modbus network.
Label
Description
Enable = 2
The module will send the command only when the data associated with
the IntAddress of the module has changed.
IntAddress =30
Writes the data from Internal Address 30 of the module memory to the
Slave device. Based on the MCM.CONFIG.M
OD
D
EF
configuration, this
will write the data from MCM.DATA.W
RITE
D
ATA
[30]
TO
[39]
to the Slave
device.
Count = 10
Writes 10 consecutive registers to the Slave device.
Node = 1
Issues the Modbus command to node 1 on the network.
Func = 16
Issues Modbus Function Code 16 to write Holding Registers.
DevAddress = 1050
Function Code 16, DevAddress of 1050 will write address 41051.
Along with a count of 10, this command writes 41051 to 41060 of the
Slave device.
2.4
Floating-Point Data Handling (Modbus Master)
In many applications, it is necessary to read or write floating-point data to the
Slave device. The sample program only provides an INT array for the ReadData
and Write Data array (16-bit signed integer value). In order to read/write floating-
point data to and from the Slave device, you must add additional ladder to handle
the conversion of the data to a REAL data type within the ControlLogix
processor. This is very easy to accomplish.