ModBus协议-功能码-0x05



05 (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.

Tx:01 05 00 AC FF 00
Rx:01 05 00 AC FF 00

Tx分析
01 从机地址
05 功能码
00 AC 输出地址
FF 00 输出值
Rx分析
01 从机地址
05 功能码
00 AC 输出地址
FF 00 输出值

0xAC = 172
[172] FF 00  ->ON

FF00:ON  0000:OFF




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值