VersaPro Temperature Controller
Page 49
Copyright © 2013, United Process Controls Inc.
All rights to copy, reproduce and transmit are reserved
The Function Code field tells the addressed slave what function to perform. MODBUS function codes are
specifically designed for interacting with a PLC on the MODBUS industrial communications system. Command
codes were established to manipulate PLC registers and coils. As far as the VersaPro is concerned, they are
all just memory locations, but the response to each command is consistent with Modbus specifications.
The high order bit in this field is set by the slave device to indicate an exception condition in the response
message. If no exceptions exist, the high-order bit is maintained as zero in the response message.
Data Field
The data field contains information needed by the slave to perform the specific function or it contains data
collected by the slave in response to a query. This information may be values, address references, or limits.
For example, the function code tells the slave to read a holding register, and the data field is needed to
indicate which register to start at and how many to read.
Error Check Field (CRC)
This field allows the master and slave devices to check a message for errors in transmission. Sometimes,
because of electrical noise or other interference, a message may be changed slightly while it is on its way from
one device to another. The error checking assures that the slave or master does not react to messages that
have changed during transmission. This increases the safety and the efficiency of the MODBUS system.
The error check field uses a CRC-16 check in the RTU mode.
The following is an example of a function 03 call for timer setpoint value (TSETPT) at memory location 03. The
value returned by the instrument is the hex value 1E (30 seconds).
Transmit from Host or Master
Address
Cmd
Reg HI
Reg LO
Count HI
Count LO
CRC HI
CRC LO
01 03 00 03 00 01 74 0A
Response from Versapro
Address
Cmd
Byte
Count HI
Byte Count LO
Data HI
Data LO
CRC
HI
CRC Lo
01
03
00
02
00 1E 38 4C
Note that all the values are interpreted as hexadecimal values. The CRC calculation is based on the A001
polynomial for RTU Modbus. The function 04 command structure is similar to the 03 structure.
The following is an example of a function 06 call to change the remote setpoint (RSETPT) to 200 (2.00%). The
response from the instrument confirms the new value as being set.
Transmit from Host or Master
Address
Cmd
Reg HI
Reg LO
Data HI
Data LO
CRC HI
CRC LO
01 06 00 01 00 C8
D9
9C
Response from Versapro
Address
Cmd
Reg HI
Reg LO
Data HI
Data LO
CRC HI
CRC LO
01 06 00 01 00 C8
D9
9C