Hello guys ,
I want to use Node-Red to receive data from codesys via modbus tcp and then send to cloud using MQTT. The original data is a DINT (say -593) in codesys, I split it into two words to Modbus TCP (High word "FFFF" and low word "FDAF").
Now in Node-Red I have received two words in sequence and combined them to a DWORD "FFFFFDAF" , but after I use parseInt in JS I got the number 4294966703, instead of -593. I suppose it is converted into a 64-bit int rather then 32. How can I change it to a 32-bit int? Below is my convert code. Thank you for your support.
Zhiyao Yin