Modbus/TCP & Modbus RTU Function Codes
Function Code 06 - Preset Single Register
30 HC900 Hybrid Controller Communications User Guide Revision 4
9/03
4.7 Function Code 06 - Preset Single Register
Description
Presets integer value into a single register (also refered to as 4X references).
The HC900 does not support Broadcast.
The registers that are specified in Section 6 with an access type “W” and integer and bit packed (16-bit
register) data types, can be written to via Function Code 06. Also, digital variables in 32-bit floating point
format can be written using this function code. Writing a non-zero value to either register of the digital
variable will result in a floating point 1 to be written to the variable. Writing a zero value to either register
will result in the variable being set to 0.
Query
The query message specifies the register references to be preset. Registers are addressed starting at zero:
Register 1 is addressed as 0.
Example:
Set Rack #1, Loop #1 to Auto (address 00FAh) in the controller at slave address 1
Query message format for function code 06
Slave
Address
(00 for TCP)
Function
Code
Address
High
Address
Low
Preset
Data
High
Preset
Data
Low
CRC
(RTU)
CRC
(RTU)
TCP Example 00 06 00 FA 00 01
RTU Example 01 06 00 FA 00 01 CRC CRC
Response
The normal response is an echo of the query returned after the register contents have been preset.
Example:
Set Rack #1, Loop #1 to Auto (address 00FAh) in the controller at slave address 1.
Response message format for function code 06
Slave
Address
(00 for TCP)
Function
Code
Address
High
Address
Low
Preset
Data
High
Preset
Data
Low
CRC
(RTU)
CRC
(RTU)
TCP Example 00 06 00 FA 00 01
RTU Example 01 06 00 FA 00 01 CRC CRC