Bird
Raised Fist0
PLC Programmingscripting~10 mins

PLC scan cycle (input scan, program execution, output update) in PLC Programming - Step-by-Step Execution

Choose your learning style10 modes available
Concept Flow - PLC scan cycle (input scan, program execution, output update)
Start Scan Cycle
↓
Input Scan
↓
Program Execution
↓
Output Update
↓
End Scan Cycle
↓
Repeat Cycle
The PLC scan cycle repeats continuously: first it reads inputs, then runs the program logic, and finally updates outputs.
Execution Sample
PLC Programming
Inputs = ReadInputs()
Outputs = {}
for instruction in Program:
    Outputs = Execute(instruction, Inputs, Outputs)
WriteOutputs(Outputs)
This pseudo-code shows a PLC scan cycle reading inputs, executing program instructions, and updating outputs.
Execution Table
StepActionInputs StateProgram LogicOutputs StateNotes
1Input ScanInput1=0, Input2=1No execution yetOutputs unchangedInputs read from sensors
2Program ExecutionInput1=0, Input2=1If Input2=1 then Output1=1Output1=1Logic sets Output1 based on Input2
3Output UpdateInput1=0, Input2=1Logic doneOutput1=1 sent to actuatorOutputs updated to devices
4Start Next CycleInputs refreshedProgram readyOutputs hold last stateCycle repeats with new inputs
💡 Scan cycle repeats continuously to keep PLC responsive to input changes
Variable Tracker
VariableStartAfter Input ScanAfter Program ExecutionAfter Output UpdateCycle End
InputsN/AInput1=0, Input2=1Input1=0, Input2=1Input1=0, Input2=1Ready for next scan
OutputsInitial=00Output1=1Output1=1Holds until next update
Key Moments - 3 Insights
Why do outputs only change after program execution, not during input scan?
Because the PLC first reads all inputs to get a stable snapshot, then runs logic to decide outputs, and only after that updates outputs. See execution_table rows 1 and 2.
What happens if inputs change during program execution?
Inputs are only read once at the start of the scan cycle, so changes during execution are ignored until the next cycle. This ensures consistent logic. See variable_tracker Inputs row.
Why does the scan cycle repeat continuously?
To keep the PLC responsive to changing inputs and update outputs accordingly. The cycle repeats as shown in execution_table row 4.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what is the output state after program execution?
AOutputs unchanged
BOutput1=1
COutput1=0
DOutputs unknown
💡 Hint
Check execution_table row 2 under Outputs State
At which step does the PLC read the inputs?
AStep 3
BStep 2
CStep 1
DStep 4
💡 Hint
See execution_table row 1 Action column
If inputs changed during program execution, when would the PLC see the new values?
AAt the next input scan in the next cycle
BAt the next output update
CImmediately during execution
DNever
💡 Hint
Refer to key_moments explanation about input reading timing
Concept Snapshot
PLC Scan Cycle:
1. Input Scan: Read all inputs once
2. Program Execution: Run logic using input snapshot
3. Output Update: Send results to outputs
Cycle repeats continuously to react to changes
Full Transcript
A PLC scan cycle runs repeatedly in three main steps. First, it reads all inputs to get a snapshot of the current state. Next, it executes the program logic using those inputs to decide what outputs should be. Finally, it updates the outputs to the devices. This cycle repeats continuously to keep the system responsive. Inputs are only read once per cycle, so changes during program execution are not seen until the next cycle. Outputs only change after the logic runs, ensuring consistent behavior.

Practice

(1/5)
1. What is the correct order of the PLC scan cycle steps?
easy
A. Output update, input scan, program execution
B. Input scan, program execution, output update
C. Program execution, input scan, output update
D. Program execution, output update, input scan

Solution

  1. Step 1: Understand the PLC scan cycle process

    The PLC first reads all inputs to get the current state of sensors and switches.
  2. Step 2: Follow the sequence of operations

    After reading inputs, the PLC runs the user program logic, then updates outputs accordingly.
  3. Final Answer:

    Input scan, program execution, output update -> Option B
  4. Quick Check:

    Scan cycle order = Input, Program, Output [OK]
Hint: Remember: Inputs first, then logic, then outputs [OK]
Common Mistakes:
  • Mixing up the order of program execution and input scan
  • Thinking outputs update before program runs
  • Assuming outputs update before inputs are scanned
2. Which of the following is the correct syntax to represent the PLC scan cycle steps in order?
easy
A. InputScan(); ProgramExecution(); OutputUpdate();
B. OutputUpdate(); InputScan(); ProgramExecution();
C. ProgramExecution(); OutputUpdate(); InputScan();
D. OutputUpdate(); ProgramExecution(); InputScan();

Solution

  1. Step 1: Identify the correct function call order

    The PLC scan cycle functions must be called in the order: InputScan, ProgramExecution, then OutputUpdate.
  2. Step 2: Match the syntax with the correct order

    InputScan(); ProgramExecution(); OutputUpdate(); correctly shows the functions in the right sequence with proper syntax.
  3. Final Answer:

    <code>InputScan(); ProgramExecution(); OutputUpdate();</code> -> Option A
  4. Quick Check:

    Function calls order = InputScan, ProgramExecution, OutputUpdate [OK]
Hint: Functions follow the scan cycle order: input, program, output [OK]
Common Mistakes:
  • Placing OutputUpdate before InputScan
  • Swapping ProgramExecution and OutputUpdate calls
  • Incorrect function call syntax
3. Given the following PLC scan cycle pseudo-code, what will be the output state after one full scan if input sensor is ON?
InputScan(): sensor = ON
ProgramExecution(): if sensor == ON then output = ON else output = OFF
OutputUpdate(): set output device to output
medium
A. Output device state will not change
B. Output device will be OFF
C. Output device will be ON
D. Output device will toggle randomly

Solution

  1. Step 1: Analyze input scan step

    The sensor input is read as ON during InputScan.
  2. Step 2: Evaluate program execution logic

    Since sensor == ON, the program sets output = ON.
  3. Step 3: Understand output update effect

    OutputUpdate sets the output device state to ON based on program logic.
  4. Final Answer:

    Output device will be ON -> Option C
  5. Quick Check:

    Sensor ON leads to output ON [OK]
Hint: Input ON means output ON after program runs [OK]
Common Mistakes:
  • Confusing input and output states
  • Ignoring program logic conditions
  • Assuming output updates before program execution
4. A PLC program is not updating outputs correctly. The code snippet is:
OutputUpdate()
InputScan()
ProgramExecution()
What is the main problem here?
medium
A. OutputUpdate is called before inputs are scanned and program runs
B. InputScan should be last in the cycle
C. ProgramExecution should be before OutputUpdate only
D. No problem, this order is correct

Solution

  1. Step 1: Review the correct PLC scan cycle order

    The correct order is InputScan, ProgramExecution, then OutputUpdate.
  2. Step 2: Identify the error in the given code

    OutputUpdate is called first, before inputs are scanned and program logic runs, causing incorrect output updates.
  3. Final Answer:

    OutputUpdate is called before inputs are scanned and program runs -> Option A
  4. Quick Check:

    OutputUpdate must be last in scan cycle [OK]
Hint: Output update must come after input scan and program execution [OK]
Common Mistakes:
  • Calling OutputUpdate too early
  • Swapping InputScan and ProgramExecution order
  • Assuming any order works for scan cycle
5. You want to ensure a safety output turns OFF immediately when an emergency stop input is pressed. Which scan cycle step should you prioritize to minimize delay?
hard
A. None, PLC scan cycle cannot be changed
B. Program execution to run safety logic faster
C. Output update to apply changes immediately
D. Input scan to detect emergency stop as early as possible

Solution

  1. Step 1: Understand the scan cycle timing

    The input scan step reads all inputs at the start of the cycle, so detecting emergency stop early is critical.
  2. Step 2: Prioritize input scan for safety

    By ensuring input scan happens promptly, the PLC can detect emergency stop quickly and then run program logic to turn off outputs.
  3. Step 3: Output update applies changes but depends on earlier steps

    Output update applies the result but cannot act before inputs are scanned and logic runs.
  4. Final Answer:

    Input scan to detect emergency stop as early as possible -> Option D
  5. Quick Check:

    Early input scan = faster emergency response [OK]
Hint: Detect emergency input ASAP in input scan step [OK]
Common Mistakes:
  • Thinking output update speed alone improves safety
  • Ignoring input scan timing importance
  • Assuming program execution speed is the only factor
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard