Function code to convert 4 modbus registers to 64 bit UINT - emoncms energy monitoring
1,251 views
Skip to first unread message
lmc7...@gmail.com
unread,
Aug 20, 2017, 7:26:53 AM8/20/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Node-RED
Please excuse the limited .js knowledge. I am stuck trying to convert the output of 4 x modbus holding registers into the 64 bit UINT data format they represent. i have searched extensively and found solutions for converting 2 x registers to a float which is working well but cannot work out how to handle the UINT64...
This is the message payload from the modbus read node -
The data is the output of 4 consecutive holding registers from a Carlo Gavazzi WM30 energy meter. The documentation advises that the format is UINT64 - unsigned long integer. Byte order is MSB>LSB and word order is LSW>MSW.
I am successfully polling, converting format and sending the results to emoncms for other registers using 32 bit float IEEE-754. Any advice would be greatly appreciated.
Thanks,
Luke
Dave C-J
unread,
Aug 20, 2017, 9:16:50 AM8/20/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to node...@googlegroups.com
I'm guessing - but I'd try something like
var m = msg.payload; // just to make it easier to read next
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Node-RED
I changed the "graphical wiring" in node red from the top - 1st i think to the lower or 2nd output pin on the modbus read node and the code now works and presents the actual meter reading in Wh perfectly. it looks like the top pin outputs the values and the bottom the raw data.