Does the PAC Have a First Scan Flag?

Many PLCs have a feature known as a "first scan flag".  The first scan flag is a bit or boolean variable in the PLC that is TRUE for the first scan cycle after power-up and FALSE on every cycle thereafter.  This is useful for triggering logic that only needs to run once when the machine starts up.

The PAC does not have a built-in first scan flag, but it is very easy to create one using a boolean variable.  A programmer creates a boolean variable, initializes it to TRUE and sets it to FALSE at the bottom of the program where it is used.  Examples are given below in Ladder Diagram (LD), Continuous Function Chart (CFC) and Structured Text (ST).

LADDER DIAGRAM (LD)

5001_pac_2D00_first_2D00_scan__5136-20240521-000919.png

 

CONTINUOUS FUNCTION CHART (CFC)

3527_pac_2D00_first_2D00_scan__5137-20240521-000919.png

 

STRUCTURED TEXT (ST)

 

On the first scan cycle, the outputs are TRUE:

 

However, the outputs are FALSE on all subsequent scans:

 

NOTES

  • In Ladder Diagram, the last rung should be the one that sets the first scan flag to FALSE.

  • In Continuous Function Chart, keep an eye on the green numbers in the upper right-hand corner of each output element.  This is the execution order.  The first scan flag should have a higher number than all other elements.  If it does not, right-click on it and select Execution Order > Send To Back.

  • If there are multiple programs that need to perform first scan operations, use multiple first scan flags.  This helps to prevent execution order issues between POUs.  This is especially important if programs are running in multiple tasks.

08JAN2018 DCLIFFE