Description
Original instructions
Description of the function
The PL7_COUNTER function block is a counter/down counter that allows counting of pulses up or down.
The additional parameters EN and ENO can be configured.
NOTE: you cannot instantiate or modify the PL7_COUNTER function in online mode. This means you must be in offline mode and therefore you must transfer the project in the PLC.
NOTE: If you create more than 255 instances of PL7_COUNTER the application cannot be transfered in the PLC.
FBD representation
Representation:
LD representation
Representation:
IL representation
Representation:
CAL Counter_1(R := Raz, P := Preselect, CU := Count_Up, CD := Count_Down, E => Empty, D => Done, F => Full)
ST representation
Representation:
IF Raz THEN
   RESET_PL7_COUNTER (Counter_1) ;
END_IF ;

IF Preselect THEN
   PRESET_PL7_COUNTER (Counter_1) ;
END_IF ;

IF Count_Up THEN
   UP_PL7_COUNTER (Counter_1) ;
END_IF ;

IF Count_Down THEN
   DOWN_PL7_COUNTER (Counter_1) ;
END_IF ;

Empty := Counter_1.E ;
Done := Counter_1.D ;
Full := Counter_1.F ;
Description of parameters
The following table describes the input parameters:
Parameter
Type
Comment
R
Input of reset to zero, if Counter_1.R is equal to 1, the current value of the counter Counter_1.CV = 0
P
Preset input, if Counter_1.S equals 1, Counter_1.CV = Counter_1.PV
CU
Count input, the current value is incremented by 1 on the rising edge of Counter_1.CU.
CD
Down-count input, the current value is decremented by 1 on the rising edge of Counter_1.CD.
The following table describes the output parameters:
Parameter
Type
Comment
E
Empty counter output. Counter_1.E=1 when Counter_1.CV changes from 0 to 9999 and then to 0 again if the counter continues to count down.
D
Output which indicates that the counter has reached the preset value. Counter_1.CD = 1 when Counter_1.CV = Counter_1.PV.
F
Full counter output. Counter_1.F = 1 when Counter_1.CV changes from to 9999 to 0 and then to 0 again if the counter continues to count up.
Description of variables
The following table describes the public variables:
Parameter
Type
Comment
CV
Current value of counter. This value can be read and tested but not written by the program.
PV
This value, which is between 0 and 9999, is known as the counter preset value. It can be written, read and tested by the program; the default setting is 9999.