Newbie of the forum and with Node Red.
I 'm doing a pumpstation dashboard with a raspberry connected to the Schneider PLC. I have managed to connect with the modbus node, and get some register (Int16) without issues, and i'm using the Buffer Parser node to separate the message/value.
Now i'm trying to get the flowmeter value, and the value is stocked in a double word (%MD) which is composed of two value of Int16. The guy who did the program told me the first value is LE and second one is BE.
I'm receiving from the PLC in Node red : [39696,145] which seems to be UInt16. I have managed to converse it to Int16, but the value is conform of the 16b value from the PLC only if is it BE (should be LE for the first one).
Then I have a function doing :
let pay = msg.payload; const buf = Buffer.allocUnsafe(4); buf.writeInt16LE(pay,0); buf.writeInt16BE(pay,2); msg.payload = buf.readInt32BE(0); return msg;
And of course the result should be 9542416 and I have it wrong...
In PLC : %MD84 = 9542416
%MW84 = -25840
%MW85 = 145
In Nodered : array of : 0 : 0x-64f0
1 : 0x91
Anyone could help or give a hint ? Thank you