zhangqian
2023-12-20 9e2fbcdc62bc4b45519715c8243446a11ee011cf
goborrow rtu地址-1
1个文件已修改
2 ■■■■■ 已修改文件
pkg/plc/modbusx/modbusrtu.go 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pkg/plc/modbusx/modbusrtu.go
@@ -5,6 +5,7 @@
)
func ReadByRTU(c *common.RTUConfig, address uint16, quantity uint16) (data []byte, err error) {
    address--
    cli := getModbusRTUConnection(c)
    data, err = cli.ReadHoldingRegisters(address, quantity)
    dealRTUErr(err, c.SerialName)
@@ -17,6 +18,7 @@
}
func WriteByRTU(c *common.RTUConfig, address uint16, value int, endian string, length int) (err error) {
    address--
    var bytesVal []byte
    bytesVal = intToBytes(value, endian, length)
    cli := getModbusRTUConnection(c)