Home
Prox / RFID
Verichips
Ladder Logic
[interfacing] †
Tube Joints
Key Code From Photo
SolveSpace (3d CAD)
SketchFlat (2d CAD)
Photographs
Miscellany
Resume / Consulting
Contact Me

LDmicro Forum - Access to relays internals variables ...

(you are viewing a thread; or go back to list of threads)

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
Tue Jan 21 2020, 06:29:30
(no subject) (by Ihor Nehrutsa)
This is a link to the "Compilations.." thread
https://cq.cx/ladder-forum.pl?...;parent=9342&tt=1578254368
Thu Jan 23 2020, 16:02:25
(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.
Thu Jan 23 2020, 17:50:10
(no subject) (by Antonio)
to Ihor

Fine. I try soon.


Thank you
Mon Jan 27 2020, 05:47:46
(no subject) (by Antonio)
to Ihor

Tested and functional !

Very Fine !
Mon Jan 27 2020, 06:39:34
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.
Wed May 20 2020, 23:55:55
Post a reply to this comment:
Your Name:
Your Email:
Subject:
(no HTML tags; use plain text, and hit Enter for a line break)
Attached file (if you want, 5 MB max):