PLC programming controls machines by reading inputs, running logic, and turning outputs on or off. Ladder logic is common in factories because it looks like electrical relay diagrams and is easy to troubleshoot. This cheat sheet helps students connect software instructions to real devices such as sensors, motors, lights, and switches.
It is useful for learning how industrial automation systems make safe, repeatable decisions.
Key Facts
- A PLC scan cycle usually follows this order: read inputs, execute program logic, update outputs, then repeat.
- A normally open contact, often called XIC, is true when its input bit is 1 or on.
- A normally closed contact, often called XIO, is true when its input bit is 0 or off.
- A coil, often called OTE, writes the rung result to an output bit, so Output = rung logic result.
- Series contacts act like AND logic, so Output = A AND B when two true conditions must both be met.
- Parallel contacts act like OR logic, so Output = A OR B when either condition can energize the output.
- A timer done bit turns on when accumulated time is greater than or equal to preset time, so DN = true when ACC >= PRE.
- A counter done bit turns on when count accumulated is greater than or equal to preset count, so DN = true when ACC >= PRE.
Vocabulary
- PLC
- A programmable logic controller is an industrial computer that controls machines by processing input signals and commanding output devices.
- Scan cycle
- The scan cycle is the repeating process in which a PLC reads inputs, solves the program, and updates outputs.
- Ladder rung
- A ladder rung is one horizontal line of ladder logic that represents conditions controlling one or more output instructions.
- Contact
- A contact is a ladder logic instruction that checks whether a bit is true or false before allowing logic power to pass.
- Coil
- A coil is a ladder logic output instruction that turns a bit on or off based on the rung result.
- Preset
- A preset is the target time or count value that a timer or counter must reach before its done bit turns on.
Common Mistakes to Avoid
- Confusing normally open with normally closed contacts is wrong because the ladder instruction tests a bit state, not the physical shape of a switch.
- Forgetting the scan cycle is wrong because outputs usually do not update until the PLC finishes solving the program for that scan.
- Using duplicate output coils for the same address is risky because the last rung scanned can overwrite earlier logic and cause unexpected behavior.
- Placing timer or counter reset logic in the wrong rung is wrong because the accumulated value may clear before the done bit can be used correctly.
- Treating series and parallel branches the same is wrong because series contacts require all conditions to be true, while parallel branches require at least one true path.
Practice Questions
- 1 A PLC scan time is 12 ms. About how many scans occur in 1 second?
- 2 A TON timer has PRE = 5.0 s and ACC = 3.2 s. Is the timer done bit true or false?
- 3 A counter has PRE = 8 and ACC = 8 after a sensor pulse. What is the state of the counter done bit?
- 4 A motor start rung uses a start pushbutton, a stop pushbutton, and a seal-in contact. Explain why the stop instruction is usually placed in series with the motor coil.
Understanding PLC Programming & Ladder Logic
A PLC works with stored copies of signal states. At the start of each scan, it takes a snapshot of the input terminals and places those values in memory. The program usually evaluates that memory image from the first rung to the last rung.
This means a change at a switch may not affect a decision until the next scan. For most machines this delay is far too small to notice. It matters when signals change very quickly, such as pulses from a conveyor sensor.
A very short pulse can be missed if it happens between input reads. Engineers solve this with faster hardware, pulse capture features, or sensors that hold their signal long enough to be read.
Contacts in ladder logic are instructions that test a bit, not necessarily drawings of real switch parts. A normally open instruction can test whether a motor command, timer status, sensor, or internal memory bit is on. A normally closed instruction tests whether that bit is off.
The labels normally open and normally closed describe how the instruction evaluates data. They do not prove the physical device is wired as a normally open or normally closed switch. This distinction prevents a common beginner error.
Read each rung from left to right as a condition statement. A permissive rung might require a guard closed, air pressure available, and no fault present before allowing a motor to start. Internal bits help split long decisions into smaller, readable steps.
Timers give machines a sense of duration. A delay-on timer is useful when a fan should run for several seconds after a heater stops, or when a sensor must remain active before a fault is accepted. Students should check whether a timer resets when its enabling rung becomes false.
Some timer types retain their accumulated value, while others clear it immediately. Counters respond to events rather than elapsed time. A counter can track bottles passing a photoelectric sensor, machine cycles, or rejected parts.
One important detail is that many counters count a transition from off to on. If the sensor stays on, it may count only once. A noisy sensor can create several false transitions, so real systems often use filtering or a short timer to reject noise.
Output logic needs careful planning because machines have physical limits. A forward motor command and a reverse motor command should never be allowed at the same time. This is called an interlock.
Start and stop controls often use a seal-in branch, where a running bit keeps the command active after the operator releases the start button. The stop path must still break that holding path. Safety functions need more than ordinary program logic.
Emergency stops, guard switches, and safety relays are often wired through dedicated safety circuits designed to fail in a safe direction. When troubleshooting, first watch the input status, then follow the rung conditions one by one, then inspect the output status and field wiring. This method separates a sensor problem, a program decision, and a device failure.