PLC programming Tags. ON/OFF Timer

Asynchronous Pulse Generator in TIA PORTAL.

Posted by george vakfaris on August 24, 2017

TIA Portal provides the in-built instructions PWM, PTO for a fixed cycle time output with a variable duty cycle. However, both are strictly programmed and configured. Further, it is not always allowed to change values on runtime. Here is another way to achieve it, using Count up (CTU) and Generate Pulse (TP).

The CTU is Enabled by the input positive edge signal (0 to 1) and value is increased on every positive edge. Here it is generated by the CPU 1Hz Clock, which generates pulses every 1second. So, setting to the Integer input (PV) the desired OFF Time in seconds, you enable the Output (Q) in the specified interval. The output triggers the Pulse generator (TP) input, which starts a pulse for the period set in (PT). This is the ON Time. The TP output is set to Q for this period and after its expire, it will also RESET the CTU counter to 0 and restart the cycle routine.

The values of CTU and TP are automatically stored in DBs, generated upon instructions insertion.

FBD Instructions in TIA Portal v14.

In order to use the clock memory bytes - here the Clock_1Hz, %M0.5- you must initially have Enabled the use of System and clock memory (bits) in PLC Configuration Properties. All time intervals are counted upon to CPU Clock.

CPU->Properties->System and clock memory Enabling.

Text and images by george vakfaris.