Is it possible to change between auto/manual control through Modbus communication ?

Submitted byglx25v onFri, 08/17/2018 - 17:29

To change the controller from auto to manual control (Auto off) using the Modbus communications protocol, the Auto/Manual Control bit needs to be changed. This is done by sending a Modbus message of :

[01][05][0002][FF00][CRC]

A breakdown of this message is as below:

[01] Address of controller
[05] Function code 5. This is the write single bit (force single coil) function
[0002] this is the address of the auto/manual control bit
[FF00] this changes the bit status (FF00 turns auto off and manual mode on) / 000 turns auto on and manual mode off)
[CRC] This is a calculated 16 bit cyclic redundancy checksum which is calculated using the rest of this message.
The status of this bit can be read by sending the modbus message:

[01][01][0002][0001][CRC]

A breakdown of this message is as below.

[01] Address of controller
[01] Function code 01. This is read in bits (read single coil) function.
[0002] This is the address of the auto/manual control bit
[0001] This is the number of bits to be read (in this case just a single bit)
[CRC] This is a calculated 16 bit cyclic redundancy checksum which is calculated using the rest of this message.
The status of this bit can also be read using the read word function (function 03/04) although the returned information will need to be decoded in to binary to extract the auto/manual control bit.

Example:
[01] Address of controller
[03] Function code 03. This is the read in words (read holding registers) function.
[0007] This is the address of the control status word
[0001] This is the number of words to be read (in this case just a single word)
[CRC] This is a calculated 16 bit cyclic redundancy checksum which is calculated using the rest of this message
A typical reply would be:
[01] Echo of address of controller
[03] Echo of function code
[02] This is the number of bytes being received.
[0003] This is the data. In this case the data is 0003hex, converting this to binary the data becomes 00000011 using the controller status definition it can be seen that the auto/manual control is 1 (manual) as is communications write status (enabled). If the auto/manual control is then changed to be 0 (auto) the data would read 00000001binary, 0001hex,
The auto/manual control bit cannot be modified using the write word function (function code 06) as there are bits in this word that are read only.