Cloud-Automation / node-modbus

Modbus TCP Client/Server implementation for Node.JS
456 stars 169 forks source link

loses "0" at the beginning bug? #303

Closed Aaqu closed 2 years ago

Aaqu commented 2 years ago

Hi I am new in modbus my problem is I use readInputRegisters. I must connect hex to 2 byte and parse ieee 754 (hex to dec). String in value not contain 0 at the beginning(bold text)

value parsed to hex from response [ '31a8', '41c1', '9db0', '41ca', 'ffff', 'ffff', 'ffff', 'ffff', 'ffd8', '439c', '4558', '439c', 'cbe8', '439d', '48d0', '41bf', 'ffff', 'ffff', 'ffff', 'ffff', 'ffff', 'ffff', 'd9f8', '41ac', '7898', '41ab', 'd1e0', '439c', '698', '41b1', '608', '41b9' ]

Buffer to hex string 31a841c19db041caffffffffffffffffffd8439c4558439ccbe8439d48d041bfffffffffffffffffffffffffd9f841ac789841abd1e0439c069841b1060841b9