Access to relays internals variables ... (by antonio)
Dear,
Is it possible to include in file *.ino for Arduino, access to the relays internal variables ?
See threads "Compilations" for examples.
Thank You
(no subject) (by Ihor Nehrutsa)
to Antonio
You have one internal relay "Ron" in your 'moteur_on_fc_v3.ld' file from the "Compilations.." thread.
Variable
STATIC ldBOOL Ub_Ron = 0;
is defined in the file moteur_on_fc_v3.cpp
and it corresponds to the internal relay "Ron".
By default, 'Ub_Ron' variable is defined as static and it is not accessible from the 'moteur_on_fc_v3.ino' file.
To get access to it from the 'moteur_on_fc_v3.ino' file you must uncomment
//#define EXTERN_EVERYTHING
in 'ladder.h'.
And then you can pack relays into the variable
...
byte loc_relay;
...
loc_relay = Ub_Ron ? 1 : 0;
...
loc_relay = loc_relay + (Ub_Relay1 ? 1 : 0) << 1;
loc_relay = loc_relay + (Ub_Relay2 ? 1 : 0) << 2;
...
loc_relay = loc_relay + (Ub_Relay7 ? 1 : 0) << 7;
...
without the multiplication operation. Bits shifting is faster.
Modbus (by Deck Medina)
To Ihor Nehrutsa,
Hello I came across your answer to Antonio and it enlightens me.
I got another problem on how to declare these internal relays and timers on the Arduino IDE and assign Modbus addresses to them so that I can control them on SCADA/HMI.
I'm not a programmer so I rely on Ladders like LDmicro
Thanks Deck M.