複数のコイルを強制する (FC=15)
要求
このコマンドは、#20から#29までの一連の10個のディスクリートコイルの内容をアドレス17のスレーブデバイスに書き込みます。
11 0F 0013 000A 02 CD01 BF0B 11: The Slave Address (11 hex = address17 ) 0F: The Function Code 15 (Force Multiple Coils, 0F hex = 15 ) 0013: The Data Address of the first coil. ( 0013 hex = 19 , + 1 offset = coil #20 ) 000A: The number of coils to written ( 0A hex = 10 ) 02: The number of data bytes to follow (10 Coils / 8 bits per byte = 2 bytes) CD: Coils 27 - 20 (1100 1101) 01: 6 space holders & Coils 29 - 28 (0000 0001) BF0B: The CRC (cyclic redundancy check) for error checking.より重要なビットには、より高いコイル変数が含まれます。これは、コイル20がオン(1)で21がオフ(0)であることを示しています。要求されたコイルの数により、最後のデータフィールド01には2つのコイルのステータスのみが含まれます。最後のデータバイトの未使用ビットはゼロで埋められます。
応答
11 0F 0013 000A 2699 11: The Slave Address (11 hex = address17 ) 0F: The Function Code (Force Multiple Coils, 0F hex = 15 ) 0013: The Data Address of the first coil. ( 0013 hex = 19 , + 1 offset = coil #20 ) 000A: The number of coils to written ( 0A hex = 10 ) 2699: The CRC (cyclic redundancy check) for error checking.