Closed stevedh closed 2 years ago
Hi Stephen,
wouldn't simply using a cast work in this case? This is how I usually do it:
var reg uint16
err, reg = client.ReadRegister(0x1000, modbus.HOLDING_REGISTER)
if err != nil { ... }
fmt.Printf("unsigned value: %v, signed value: %v\n", reg, int16(reg))
var setpoint int16
setpoint = -100
err = client.WriteRegister(0x1000, uint16(setpoint))
Hope this helps,
-Simon
Closing this for inactivity. Feel free to reopen if needed.
Unless I am missing something, the documentation mentions supporting reading signed integers; but there's no ReadInt16/ReadInt32 method in the client.