TP (Functionblock) |
Top Previous Next |
The TP function block is a pulse timer that enables "q" (the output) for a preset amount of time.
When trig is set TRUE, the "q" output is set TRUE and the elapsed time counter (et) is reset to zero and incremented until the preset timer value is reached, after which the "q" output is set FALSE. Only during this period of time is "q" set to TRUE. Once the timer is running, any changes to the trig input are ignored until after the preset value is reached.
This image shows the TP function block timing:
Input: trig : BOOL (true/false) On the leading edge of this input, the timer will start and set the "q" output true for the specified "pt" time
pt : DINT (0..2147483648) Specifies how long the "q" output should be true - specified in ms.
Output: et : DINT (0..2147483648) The current value of the timer.
q : BOOL (true/false) Output from the timer. This will go high until "et" equals "pt"
Declaration: FUNCTION_BLOCK TP;
Example: INCLUDE rtcu.inc |