A53 Z0 9 0020 L En Technical documentation
Chapter : Text file & PLC
{INIT L2}
INIT 2
BLOC
E2440 := E1710;
E2441 := 0;
E2442 := 1
BEND
.
{EQUATIONS L2(every 100ms)}
PROG 2
BLOC
@ E2440 is used as a counter that decreases from parameter E1710 down to 0;
TEST E2440 GT 0 THEN
DEC E2440
ELSE
E2440 := E1710
TEND;
@ Set the values of E2441 and E2442 depending on digital input 1 (E0160) and the
counter E2440;
TEST E0160 AND (E2440 LT E1711) EQ 1 THEN
BLOC
E2441 := 1;
E2442 := 0
BEND
ELSE
BLOC
E2441 := 0;
E2442 := 1
BEND
TEND
BEND
.
{END OF FILE}
The INIT block initializes counter [E2440] to the value set by the user in parameter [E1710]. Variable
[E2441] is set to zero, and variable [E2442] is set to one. These initializations are done when the module
powers up.
The PROG block is executed once every 100ms. In this block, if variable [E2440] is not zero, it is decreased
by one. Otherwise, it is re-set to the value of parameter [E1710]. Then we check if CANopen digital input 1
is set to one and counter [E2440] is lower than the value set in user parameter [E1711]. If this is the case,
[E2441] is set to one and [E2442] is set to zero. Otherwise, [E2441] is set to zero and [E2442] is set to one.
For example if [E1710] is set to 100 and [E1711] is set to 20, [E2441] can be seen as a PWM with a cycle
time of 10s (100*100ms) and a duty ratio of 20% when CANopen digital input is set to one. Here, [E2442] is
simply the complement of [E2441].