PLC code is a repeating control routine that reads physical inputs, evaluates logic, and updates physical outputs. The most practical way to learn it is to follow that scan cycle while building one small start-stop control in a simulator.
Unlike ordinary desktop code, a PLC program does not run once from top to bottom and then finish. The controller scans the logic continuously, so an input can change the result on the next scan. Begin with ladder logic, a clear I/O map, and a test sequence that predicts every state.
Understand PLC code through the scan cycle and I/O model
Connect physical inputs to input addresses
A sensor or pushbutton connects to an input terminal, which the controller represents with an input address such as I0.0. Create an I/O list that names each device, its address, and its normal state. For a start-stop circuit, use one start input and one stop input. A normally closed stop circuit should produce a true Stop_OK condition while the button is released.
Evaluate rung conditions on every scan
During each scan, the PLC first updates its input image, then evaluates ladder rungs from left to right. Contacts represent conditions, and a rung becomes true only when its series conditions are satisfied. The controller repeats this process continuously rather than executing the logic only once.
Write rung results to output addresses
A coil writes the rung result to an output address such as Q0.0. That address controls an output module, relay, or simulated motor. The physical output is updated after logic evaluation, so a change normally appears by the next scan. Contacts referencing an output or internal bit can then provide memory for a control sequence.
How to learn PLC programming: Choose one language and development environment
Prepare a simulator, I/O table, and test checklist
Choose one PLC family and its matching development environment or simulator. Avoid switching between controller dialects at the start. Before writing logic, record the device name, address, electrical or simulated type, normal state, and expected output. Add a checklist for initial, start, run, and stop conditions.
Use ladder logic to mirror physical control
Ladder logic is the best first language for this project because its contacts and coils resemble relay control diagrams. It makes input conditions, seal-in paths, and output status visible during monitoring.
Recognize when other languages help
Function block programming connects reusable blocks and suits analog processing, motion, and repeated control structures. Structured text is useful for calculations, data handling, and complex algorithms. Learn those after the scan model and basic ladder behavior are clear.
Build a first ladder program: PLC programming for beginners
1. Assign start, stop, and motor addresses
This is a practical first project in PLC programming for beginners. Assign I0.0 to the start pushbutton, I0.1 to the stop circuit, and Q0.0 to a simulated motor. Define Stop_OK as true when the stop button is released and healthy.
2. Build the start-stop seal-in rung
Place the Stop_OK condition in series with a parallel branch containing the Start contact and a Q0.0 holding contact. Drive the Q0.0 coil at the right side of the rung. In logic terms, the rung is: Stop_OK AND (Start OR Q0.0) → Q0.0. Pressing Start turns on Q0.0; its holding contact keeps the rung true after Start is released.
3. Define expected states: off, on, latched, and stopped
- Initial off: Start is false, Stop_OK is true, and Q0.0 is off.
- Starting: Start becomes true, the rung becomes true, and Q0.0 turns on.
- Latched run: Release Start. Its contact opens, but the Q0.0 holding contact keeps the motor on.
- Stopped: Press Stop. Stop_OK becomes false, the rung opens, and Q0.0 turns off.
Simulate, test, and diagnose the start-stop control
4. Simulate the input and output states in order
- Start with both buttons released. Confirm I0.0 is false, Stop_OK is true, and Q0.0 is off.
- Momentarily set I0.0 true. Confirm power flows through the rung and Q0.0 turns on.
- Return I0.0 to false. Confirm the holding contact keeps Q0.0 on.
- Set the stop input to its pressed state. Confirm Stop_OK becomes false and Q0.0 turns off.
Diagnose address, logic, and scan faults
Use the monitor view to compare each physical or simulated input with its assigned address. If an input never changes, check the mapping and normal-state definition. If the input changes but the rung remains false, inspect each contact from left to right, especially the stop condition and holding contact. If Q0.0 is true but the simulated device remains off, check the output mapping. A change that seems delayed by one scan usually reflects normal input sampling and output updating, not a failed rung.



