Appearance
Element Reference: Bits, Timers, Counters, Compare
Last updated
License feature: Ladder LogicThis page and Math, Data and Program Control list every instruction the palette offers and exactly what the engine does with it. "Power in" is whether the rung has power when the scan reaches the element; "power out" is what it passes to the next element.
Instructions that are not listed — ONS, CMP, MEQ, PID, MSG, GSV/SSV — do not exist. Parallel branches are drawn in the editor; see The Ladder Editor.
Contacts
All four have one operand, Tag.
| Mnemonic | Name | Power out |
|---|---|---|
| XIC | Examine If Closed | Power in AND tag is on |
| XIO | Examine If Open | Power in AND tag is off |
| OSR | One-Shot Rising | Power in AND the tag went from off to on since the previous scan |
| OSF | One-Shot Falling | Power in AND the tag went from on to off since the previous scan |
OSR and OSF look at the edge of their own tag, not at rung power as in RSLogix. They remember the tag's value every time they are scanned, so an edge that happens while the rung before them is false is used up. Put them first on the rung. In a routine that isn't called every scan, edges between calls are seen late or missed.
Coils
One operand, Tag. Power out = power in, so coils can be followed by more elements.
| Mnemonic | Name | Behavior |
|---|---|---|
| OTE | Output Energize | 1 when power in, 0 when not |
| OTL | Output Latch | 1 on a scan with power in; nothing otherwise |
| OTU | Output Unlatch | 0 on a scan with power in; nothing otherwise |
| RES | Reset | With power in, clears the timer or counter at its Timer or counter to reset address (accumulator 0, not done) |
A device tag is only actually written when its value changes (see Tags and Addresses); internal tags are set on every scan.
Two OTEs on the same tag fight: the last one in the scan wins. Use one OTE per tag, or OTL/OTU pairs.
Timers
Settings: Preset (ms) (default 1000) and Address (optional). The timer's done state is its power out. Give it an address such as T4:0 to read T4:0/DN, /TT, /EN and T4:0.ACC from other rungs and to reset it with RES — see Tags and Addresses.
| Mnemonic | Name | Behavior | Power out |
|---|---|---|---|
| TON | Timer On-Delay | Accumulates while power in is true; when the accumulator reaches the preset it is done. Power in false resets it to 0 at once | On while done |
| TOF | Timer Off-Delay | Power in true: done, accumulator 0. When power in goes false it starts timing and stops being done after the preset | On while power in, and for the preset after it goes off |
| RTO | Retentive Timer | Like TON, but keeps its accumulator when power in goes false | On once done — forever |
Warning: An RTO that has finished stays finished until it is reset: give it an address and reset it with RES.
- Monitor mode shows
ACC:1834 PRE:5000. - The Preset is a number on the element; a MOV to
T4:0.PREreplaces it at runtime (for example from a recipe), and that value is kept until written again. - Accumulators are kept through Stop/Run, Save and restarts.
- A timer in a routine that isn't called every scan: when it is next called with power in still true, the accumulator jumps by the whole time it wasn't called.
Counters
Settings: Preset (default 10) and Address (optional), such as C5:0, to read C5:0/DN and C5:0.ACC elsewhere, preload .ACC or change .PRE, and reset it with RES.
| Mnemonic | Name | Behavior | Power out |
|---|---|---|---|
| CTU | Count Up | Adds 1 each time power in goes from false to true. Done when the count ≥ preset | On while done |
| CTD | Count Down | Starts at the preset; subtracts 1 on each false→true of power in. Done when the count ≤ 0. It keeps going negative | On while done |
A CTU that reaches its preset stays done and keeps counting until it is reset with RES (it needs an address). Counts survive Stop/Run, Save and restarts (saved every 10 s).
Compare
Operands Source A and Source B (each a device tag, task/program tag or literal). The comparison is only made when power in is true.
| Mnemonic | Name | Power out when power in and |
|---|---|---|
| EQU | Equal | A = B |
| NEQ | Not Equal | A ≠ B |
| GRT | Greater Than | A > B |
| LES | Less Than | A < B |
| GEQ | Greater or Equal | A ≥ B |
| LEQ | Less or Equal | A ≤ B |
Both sides are converted to numbers (text → 0). EQU and NEQ compare exactly, so a float like 21.499999 is not equal to 21.5 — use GEQ/LEQ for floats.
LIM — Limit Test
Operands Low Limit, Test and High Limit (each a device tag, task/program tag or literal; a new LIM starts with literals 0 and 100). Like the other compares, it is only evaluated when power in is true.
| Limits | Power out when power in and |
|---|---|
| Low ≤ High | Low ≤ Test ≤ High — inside the band, both limits included |
| Low > High | Test ≥ Low or Test ≤ High — outside the band between them, which tests "out of window" with one instruction |
For example, Low 20, High 80 is true from 20 to 80; Low 80, High 20 is true at 80 and above or at 20 and below.