Best way to decode Modbus - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: Best way to decode Modbus (/showthread.php?tid=3450) |
Best way to decode Modbus - gtsamis - 29.06.2021 Hi, I have a DSE7320 power generator controller and i need to read some alerts. I use Modbus mapper to store the alert registers to virtual objects and then decode them with script. Code: dword ='0x'.. event.datahex Can someone please verify if this is the most eficient way or sugest something better? Thank you in advance George RE: Best way to decode Modbus - admin - 30.06.2021 The most correct way to do this is via bit shifts (bit.rshift and bit.band) but since you need to split the value into 4 bit values you can simply use the datahex string: Code: value = event.datahex |