# Leer variables reales desde un plc m580 de schneider electric

**URL:** <https://discourse.nodered.org/t/leer-variables-reales-desde-un-plc-m580-de-schneider-electric/89111>\
**Category:** Developing Nodes\
**Created:** [30 June 2024 14:56 UTC](https://discourse.nodered.org/t/leer-variables-reales-desde-un-plc-m580-de-schneider-electric/89111 "2024-06-30T14:56:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![deivisd](https://avatars.discourse-cdn.com/v4/letter/d/ecae2f/32.png) [@deivisd](https://discourse.nodered.org/u/deivisd)\
**Post date:** [30 June 2024 14:56 UTC](https://discourse.nodered.org/t/leer-variables-reales-desde-un-plc-m580-de-schneider-electric/89111/1 "2024-06-30T14:56:02Z")

</div>

Buenos días, estoy tratando de leer una variable REAL creada en un plc m580 de schneider con el módulo funtion pero no he podido, como puedo crear la función correcta he intentado con lagunas que he encontrado por internet pero no funcionan.  
estoy utilizando un módulo injet conectado a un módulo funtion, un módulo modbus flex getter otro módulo funtion t luego el debug para ver el mensaje.  
el primer módulo funtion contiene el siguiente código:  
let realvalue = {  
realvalvue: msg.payload,  
"fc": 4,  
"unitid": 1,  
"address":446,  
"quantity": 4  
}  
return {msgpayload (realvar)}

y el segundo contiene : msg.payload =[msg.payload[0], msg.payload[1]];

let pay = msg.payload;

const buf = Buffer.allocUnsafe(4);  
buf.writeUInt16BE(pay[0],2);  
buf.writeUInt16BE(pay[1],0);

msg.payload.chatId = "-4014128032"  
msg.payload.type = "message"  
msg.payload = buf.readFloatBE(0);  
return msg;

gracias por su ayuda

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [29 August 2024 14:56 UTC](https://discourse.nodered.org/t/leer-variables-reales-desde-un-plc-m580-de-schneider-electric/89111/2 "2024-08-29T14:56:35Z")

</div>

Closed on 29 August 2024 14:56 UTC

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
