MODBUS RTU 传输文件

File Transport Over MODBUS (FOM)

1. Use function code 0x17

2. Use relative address

3. Register description

Command Register (0x0000)

#define SOH 0x01    
#define STX 0x02    
#define EOT 0x04    
#define CA  0x18    
#define C   0x43    
#define NAK 0x15

Sequence Register (0x0001)
Data Register (0x0002~0x0401)

4. Sequence diagram

4.1 Write File
Write Command+Sequence+Data Register, Read Command Register by MODBUS 0x17 code

Master Slave Begin Write [0x17]SOH+Seq(0)::FileName+FileSize...192 Bytes C+Seq(0) Writing:normal [0x17]STX+Seq(>0)::raw bytes C+Seq(>0) Repeat until complete Writing:error [0x17]STX+Seq(>0)::raw bytes NACK+Seq(>0) Writing:abort [0x17]STX+Seq(>0)::raw bytes CA End Write [0x17]EOT+Seq(>0)::raw bytes(all zeros) CA Master Slave

4.2 Read File
Write Command+Sequence Register, Read Command+Sequence+Data Register by MODBUS 0x17 code

Master Slave Begin read [0x17]C+Seq(0)+FileName... SOH+Seq(0)::FileName+FileSize...192 Bytes Reading:normal [0x17]C+prevSeq(>0) STX+Seq(>0)::192 raw bytes Repeat until complete Reading:error [0x17]NAK+prevSeq(>0) STX+prevSeq(>0)::192 raw bytes Reading:abort [0x17]CA EOT+Seq(>0)::192 raw bytes(all zeros) End read [0x17]C+prevSeq(>0) EOT+Seq(>0)::raw bytes(all zeros) Master Slave
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值