Logic is integral to the programming of PLCs.

Logic gates

edit
  • And gate
  • Or gate
  • Nor gate
  • Nand gate

Programming types

edit
  • Ladder logic - simplified representation of electronic schematics

Common PLC functions

edit

Inputs

edit
  • I (Inputs) - These bits represent the connection to any external control input device wired to the PLC, including switches, buttons and motion sensors.

Outputs

edit
  • O (Output) - Each output bit can only be used as an output once.

Internal bits

edit

Internal bits make possible almost limitless necessary logical constructs to be made.

Latches

edit
 
Ladder logic symbol
(normally closed)

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.

Timers

edit
  • 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.

Counters

edit
  • 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

edit

Sequencers are capable of using internal (binary) logic bits to shortcut repetitive ladder logic.

See also

edit