Menu
CoddyTech

AND, OR and NOT

Part of the Structured Text section of Coddy's PLC Programming journey. Lesson 2 of 17.

Series and parallel contacts become words. Contacts in series are AND, a parallel branch is OR, and a normally closed contact is NOT.

The same two rungs as text:

Horn := (PB1 OR PB2) AND SW1;
Red := NOT SW1;

Watch the brackets. AND is worked out before OR, the way multiplication comes before addition. Without brackets, PB1 OR PB2 AND SW1 means PB1 OR (PB2 AND SW1): PB1 would sound the horn with SW1 off.

challenge icon

Challenge

Easy
  • Sound Horn while SW1 is on and PB1 or PB2 is held.
  • Light Red while SW1 is off.

Press Run, try it on the machine, then Check.

Try it yourself

// The horn: (PB1 or PB2) and SW1

// The red lamp: while SW1 is off

All lessons in Structured Text

Practice on your own: PLC playground