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

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


Sample ST Program: time based counter

Here's a simple sample Structured Text ST program. It starts when the PLC application starts and increments a counter variable every second. The CASE statement is used to control the program flow.

PAC_Counter_ST.zip

Note the PLCcounter variable should be added to the Global Variable List in your program. You can set this as a DINT. With it in the GVL, this will be available to other programs in the application.


For how to import, see this FAQ:
Programming Tip: Save Time by reusing Code (Export / Import Programs & Function Blocks)

Here's a video it running within PAC IDE software:

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:

ST_Counter_PCsimulation_projectarchive.zip

1/15jh