Logic is integral to the programming of PLCs.
- See also: Wikipedia:Logic gate
- And gate
- Or gate
- Nor gate
- Nand gate
- Ladder logic - simplified representation of electronic schematics
Common PLC functions
- I (Inputs) - These bits represent the connection to any external control input device wired to the PLC, including switches, buttons and motion sensors.
- O (Output) - Each output bit can only be used as an output once.
Internal bits make possible almost limitless necessary logical constructs to be made.
Holds an electrical function on. A momentary push-button, output (from a timer or counter) or an internal bit are capable of triggering a latch. Latches have the same reference as the output on the same rung. Ideally, a latch must be foolproof with an emergency stop from an input. Latches represent virtual relays.
- TON (Timer on) - once powered waits until its preset time to turn on the output.
- TOF (Timer off) - turns on when powered, then turns off when the preset time is reached
- RTF (Retaining timer) - are potentially dangerous as they keep count even if the PLC is reset.
- CTU (Counter up) - Every time this counter gets continuous power, this counter counts up. Once a function is reached it outputs.
- CTD (Counter down) - Similar to CTU, except this counts down.
Sequencers are capable of using internal (binary) logic bits to shortcut repetitive ladder logic.