Kistler-Morse KM STXPlus User Manual

Page 57

Advertising
background image

APPENDIX C: MODBUS PROTOCOL SERIAL COMMANDS

Error
Error code: (1 Byte) 0x90
Exception code: (1 Byte) 01, 02, 03, or 04

5 (0x05) Write Single Coil
This function code is used to write a single output to either ON or OFF in a remote device. The
requested ON/OFF state is specified by a constant in the request data field. A value of FF 00 hex
requests the output to be ON. A value of 00 00 requests it to be OFF. All other values are illegal
and will not affect the output. The Request PDU specifies the address of the coil to be forced.
Coils are addressed starting at zero. Therefore coil numbered 1 is addressed as 0. The requested
ON/OFF state is specified by a constant in the Coil Value field. A value of 0XFF00 requests the
coil to be ON. A value of 0X0000 requests the coil to be off. All other values are illegal and will not
affect the coil. The normal response is an echo of the request, returned after the coil state has
been written.

Request
Function code: (1 Byte) 0x05
Output Address: (2 Bytes) 0x0000 to 0xFFFF
Output Value: (2 Bytes) 0x0000 or 0xFF00

Response
Function code 1 Byte 0x05
Output Address 2 Bytes 0x0000 to 0xFFFF
Output Value 2 Bytes 0x0000 or 0xFF00

Error
Error code 1 Byte 0x85
Exception code 1 Byte 01 or 02 or 03 or 04

When a request is sent, a normal response is expected. One of four possible events can occur:

• If the device receives the request without a communication error, and can handle the query

normally, it returns a normal response.

• If the device does not receive the request due to a communication error, no response is

returned. A timeout condition will occur for the request.

• If the device receives the request, but detects a communication error (parity, CRC, ...), no

response is returned. A timeout condition will occur for the request.

• If the device receives the request without a communication error, but cannot handle it, the

device will return an exception response informing the client of the nature of the error.

C-4

Advertising