Parker Hannifin
home | products | how to buy | support & downloads | literature | search

Click Here to go to new EM&D Knowledge Base (FAQ) site


Sample SFC Program: time based counter

Here's a simple sample Sequential Function Chart SFC program. It starts when the PLC application starts and increments a counter variable every second.

PAC_Counter_SFC.zip

Note: When an action has been deactivated it will be executed for one more scan. Thus, each action will be execute a minimum of two times; even if it the action is set as P qualifier or the Step is set as Entry or Exit. Thus the second action of incrementing the count variable uses an IF statement; if not the variable would increment by 2.

Note this includes a Global Variable List (GVL) that has the CounterPLC variable (double integer DINT type). With it in the GVL, this will be available to other programs in the application.

For how to import, see this FAQ:


Note a PAC320 hardware controller isn't necessary to run this. You can use an application with a CODESYS Control Win V3. Under Online > Simulation. Then you can after Build (F11), click Online > Login. This will create a virtual PLC and allow you to run PLC simulation (Play or F5). Here's a screen capture and project archive: