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 - set-reset

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

set-reset (by FSL)
Is there any way to prioritize set in the set-reset function?
Fri Apr 13 2018, 12:21:28
(no subject) (by Ihor Nehrutsa)
What you mean?
Please give more info.
Fri Apr 13 2018, 15:17:52
RS or SR priority (by DanielH)
@FSL

Instructions are compiled (and then executed in microcontroller) following the ladder diagram, from left to right and from top to bottom.
Of course, operations on the same coil (Internal Relay, Pin on MCU), and other instructions on the same register like MOV, math, etc., follows top to bottom order.

Be careful: Set and Reset operations on a same coil will be executed immediatly when program pointer reach those ops.
Thus, is preferable to perform RS and SR operations on internal relays Rx , and at the end of the program (or at least at the end of the RS or SR logic) transfer the internal relay state to real outputs Yx.

To increase security performance, as in PLCs, operations on each real output must be executed only one time at the end of the program scan.

Better: digital inputs sates must be stored in internal relays (often called marks in PLCs), and ADC reads and serial data received must be stored in its own registers, at the beggining of the scan cycle (thus, program this kind of operations at top of the ladder diagram in LDmicro).

See http://cq.cx/ladder-forum.pl?a...;parent=7061&tt=1520944054

As a PLC programmer, I totally agree with Zdenek Hajek approach respect to LDmicro programming.
Of course, for exceptional cases, I break this directive in "tricky" programs (i.e. for stress testing).

Little example on Set-Reset priority: attached RS_vs_SR_priority.ld
Note: Pins and MCU parameters not assigned, microcontroller 16F887.

Best regards,
DanielH
Sat Apr 14 2018, 09:09:14, download attachment RS_vs_SR_priority.ld
PLC and safety (by Ihor Nehrutsa)
Tue Apr 24 2018, 09:41:09
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):