zhangqian
2023-12-20 9e2fbcdc62bc4b45519715c8243446a11ee011cf
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)