In this article, we will learn about the execution of the program in the PLC.
Many people want to learn PLC programming directly without knowing what happens around it.
Before jumping into the programming, you must learn the basics of the PLC, how the program works, the flow of the program, and during execution how it uses memory, etc.
How CPU Execute Program in Siemens PLC?
Here we are going to learn about how CPU executes a program in the Siemens PLC, although execution will remain the same in every PLC, in Siemens PLC it will take a little extra for an execution.
Normally in every PLC execution takes place like reading the Input, evaluate the logic and writing the output,
However, in the Siemens PLC, it reads the inputs from the input module then values are saved to PII (Process Image Input).
PII is a small memory part that resides in the CPU to store the status of the inputs coming from the input module.
Now you may have a question that why to save the value to PII? It’s because by saving input to PII it reduces the amount of the scan cycle. Which is helpful in a case where you have a large number of I/Os are available.
So, every time instead of looking back to the input module, CPU only looks at PII to make the execution of the program fast enough.
After PII, CPU then starts to process the program. It checks the status of the Inputs and based on their condition (ON/OFF) it processes the logic.
First, it goes for the first network and sees whether the input is active or not, if not then it moves to the next network and checks the input status. This process will last until the end of the program.
So, in the processing of the program flow goes from the top to bottom and left to right.
Now, for example in the processing part CPU sees that some of the inputs are true, what it does that it saves that output to the PIQ (Process Image Output).
After saving the output to the PIQ, it then goes to the output module to energize output resides in the field.
After this process CPU goes to the first step and repeats the same step again n again.
This is how PLC executes the logic in Siemens PLC.
Now, you might have one more question that is this works for both the analog and digital signal? The answer is NO.
Only for the digital inputs and outputs CPU looks at PII and PIQ, but in case of the analog signal, it takes a value directly from the module.
As the analog signal takes a value from the module itself, to recognize the analog inputs and outputs it uses P before writing any addresses like PIW100, PQW100, etc.
Still, you have a question? Then ask me through the below comment section.
Author: Suhel Patel
- Allen Bradley Architecture
- Allen Bradley Powerflex VFD
- Motor Push button Logic
- Motor Forward and Reverse
- Solenoid and PLC Wiring