コイルステータスの読み取り(FC=01)

要求

このコマンドは、アドレス17($11)のスレーブデバイスにディスクリートコイル#20〜56のオン/オフステータスを要求しています。

11 01 0013 0025 0E84

11: The Slave Address (11 hex = address17 )
01: The Function Code 1 (read Coil Status)
0013: The Data Address of the first coil to read.
( 0013 hex = 19 , + 1 offset = coil #20 )
0025: The total number of coils requested. (25 hex = 37, inputs 20 to 56 ) 
0E84: The CRC (cyclic redundancy check) for error checking.

応答

11 01 05 CD6BB20E1B 45E6

11: The Slave Address (11 hex = address17 )
01: The Function Code 1 (read Coil Status)
05: The number of data bytes to follow (37 Coils / 8 bits per byte = 5 bytes)
CD: Coils 27 - 20 (1100 1101)
6B: Coils 35 - 28 (0110 1011)
B2: Coils 43 - 36 (1011 0010)
0E: Coils 51 - 44 (0000 1110)
1B: 3 space holders & Coils 56 - 52 (0001 1011)
45E6: The CRC (cyclic redundancy check).

より重要なビットには、より高いコイル変数が含まれます。これは、コイル36がオフ(0)で43がオン(1)であることを示しています。要求されたコイルの数により、最後のデータフィールド1B には5つのコイルのステータスのみが含まれます。このデータフィールドの最上位3ビットはゼロで埋められます。