Commands and functions
P.
193 of 349
Delayc
Example: Switch off delay
If the LightButton (data type b01) is
OFF
, the variable LightActuator is to go to
OFF
after 4000
ms.
Then, the implementation in the user program reads:
if (delay(LightButton==OFF,4000u64)) then LightActuator=0b01 endif
Example: Different On- and Off-delay
If LightButton (data type b01) is
ON
, the variable LightActuator (data b01) is to go to
ON
after
1300 ms. If LightButton (data type b01) is
OFF
, the variable LightActuator (data b01) is to go
to
OFF
after 4000 ms.
Implementation in the user program:
if (delay(LightButton==ON,1300u64)) then LightActuator=ON endif
if (after(LightButton==OFF,4000u64)) then LightActuator=OFF endif
Definition
●
Function
delayc
(
Signal
,
Time, xT
)
Arguments
●
Argument
Signal
of the data type b01
●
Argument
Time
of the data type u64
●
Argument
xT
of the data type u64
Effect
●
Works as
delay
(p. 192).
●
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:
●
Do not use
delayc
in the then or else branch of an
if
statement.
●
If the
delayc
(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: Delayed variable assignment
If LightButton (Type b01) is
ON
, the variable LightActuator (Type b01) is to go 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
debug='2/2/2'u64
if delayc(LightButton,1300u64,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]