Commands and functions
P.
195 of 349
Afterc
Example: Different On- and Off-delay
If LightButton (data type b01) is
ON
, the variable LightActuator (data type b01) is set to
ON
after 1300 ms, if LightActuator (data type b01) is
OFF
, the variable LightActuator (data type
b01) is set to
OFF
after 4000 ms.
Implementation in the user program:
if (after(LightButton==ON,1300u64)) then LightActuator=ON endif
if (after(LightButton==OFF,4000u64)) then LightActuator=OFF endif
Example: Double assignment of a button:
See page 63.
Definition
●
Function
afterc
(
Signal
,
Time,xT
)
Arguments
●
Argument
Signal
is of data type b01
●
Argument
Time
is of data type u64
●
Argument
xT
of the data type u64
Effect
●
Works exactly as
after
(p. 193).
●
The remaining time of the internal timer can be read with variable
xT.
CAUTION: If you use the same variable
xT
for different
delayc
in the programm code, a
non predictable behavoir will be the consequence.
Data type result (Return)
●
Data type b01
Note:
●
If the
afterc
(using an
if
statement and a
write
) writes a telegram, there can arise an
additional delay time of a few ms - depending on the bus load and the bus speed.
Example: On-delay
If LightButton (data type b01) is
ON
, the variable LightActuator (data type b01) is to be set to
ON
after 1300 ms. The remaining time starting from the change to
ON
til end of the 1300ms
period will be written to address '2/2/2' every 300 ms.
Implementation in the user program:
xT=0u64
if (afterc(LightButton,1300u64)==1b01,xT) then LightActuator=1b01 endif
if (change(xT/300u64)) then write('2/2/2'u64, xT) endif
HandbuchEibPC_USA-30.odt, 2017-05-11
Enertex
®
Bayern GmbH - Erlachstraße 13 - 91301 Forchheim - [email protected]