Commands and functions
P.
171 of 349
Exclusive-OR-links
Example: OR-link
LightActuatorOn is the result of the OR operation of variable ButtonON and variable
LightRelease
The implementation is then:
LightActuatorOn = ButtonOn or LightRelease
If
TButtonOn
is 1b01 or
LightRelease
is 1b01 or both are 1b01, then
LightActuatorOn
is 1b01,
otherwise it is 0b01.
Example: OR-link with different variables
If the variable ButtonOn is '1' or the variable WindSpeed is exactly 2.9 m/s, the variable
LightActuatorOn is set to '1'.
For the implementation, we need the
if
statement and the comparison
==
. Here, the entire
if
-query is
set in parentheses. Then, the implementation reads:
if ((ButtonOn==1u08) or (WindSpeed==2.9f16)) then LightActuatorOn=1u08 endif
To create exclusive-or-links ("either or"), the xor
instruction is provided. This statement is constructed
as follows:
Definition
●
A xor B [ xor C ... etc.
Arguments
●
All arguments (
A, B, C
... ) are of the same data type. But otherwise, the data types are
arbitrary.
●
Any number of links
Effect
●
The variable
A
is bitwise "XORed" with the variable
B
(and the variable
C
etc.), which
means: the result of the operation
xor
is zero (bitwise), if both of the variables are zero or
one. In the other case, the n-th bit of the result is one, if
only one
of the bits of the input is
one.
Data type result (Return)
●
Data type of the arguments
Example: XOR-Link
If either KEY1 (type b01) or KEY 2 (type b01) is pressed, the LightActuatorOn is to go to 1b01.
If both are 0b01 and 1b01, LightActuatorOn is to go to 0b01.
The implementation is then:
LightActuatorOn = KEY1 xor KEY2
HandbuchEibPC_USA-30.odt, 2017-05-11
Enertex
®
Bayern GmbH - Erlachstraße 13 - 91301 Forchheim - [email protected]