In this example, the same POU header is used for all programming languages. For an example
Example
using IL (instruction list), please refer to the online help.
POU header
All input and output variables which are used for programming the function block CTU are declared
in the POU header. This also includes the function block (FB) itself. By declaring the FB you create
a copy of the original FB. This copy is saved under copy_name. A separate data area is reserved
for this copy.
Body
If reset is set (status = TRUE), current_value (CV) will be reset. If a rising edge is detected at
clock, the value 1 will be added to current_value. If a rising edge is detected at clock, this
procedure will be repeated until current_value is greater than/equal to set_value. Then,
signal_output will be set.
LD
ST
When programming with structured text, enter the following:
copy_name( CU:= clock, RESET:= reset, PV:= set_value, Q=> signal_output, CV=>
current_value);
Counter instructions
317