Programming - First steps
P.
40 of 349
Commissioning:
The Startup
A switch button
The default setting is always zero.
When using manual group
addresses:
read('1/0/0'b01)
Some important details
Again, look at the example above: If a ON is sent to the group address "Switch-1/0/0" (or the
manually entered address '1/0'0'b01), the light should be turned on. The default value of variables
(more later), group addresses and so on is zero (
OFF
, 0, 0.0 ...). All objects in your application
program are set to be valid.
But, if the light switch has been already pressed, i.e. is really ON, before the Enertex
®
EibPC is
started? How is the program to be optimally designed? You might say: "Sometimes you can live with
this fact, in such cases the user has to press
ON
and
OFF
and
ON
again, until something happens.
But, this could be done by the Enertex® EibPC much better.
We have designed the function:
systemstart()
Returns 1
b01
at system start
The function has no argument. After the Enertex
®
EibPC has started the application program, the
binary return value is 1b01 (for further documentation of the function, see page 213).
Before we show the application of this function, we still need:
read(
Group address
)
Read request for the group address
By the
read
function, we are capable to ”request“ the actuator to send its current value to the
specified group address (for further details see also page 165).
Important: In order to receive the
effective actuator response, the read flag has to be set within the ets.
Now to the actual program:
[ETS-ESF]
Haus.esf
[EibPC]
if (systemstart()) then read("Switch-1/0/0") endif
if ("Switch-1/0/0"==EIN) then
\\
write("Lamp-1/1/1",EIN);
\\
write("Dimmer-1/1/2"u08,80%) \\
else
write("Lamp-1/1/1",AUS);
\\
write("Dimmer-1/1/2"u08,0%) \\
endif
The read request will be now set at system startup. The actuator sends its value. Then, in the user
program the
if
-statement is executed: If the switch is
ON
and reports this, the lights are switched on.
If the switch sends an OFF after the read request caused by the function
if systemstart()
, the Enertex
®
EibPC does
nothing. Why? We might think that in this case the else-branch is executed after the arrival of the response by the
actuator. This is not the case, since at startup all objects and instructions will be accepted as valid. Objects are
invalid, if they vary (except only a few special functions). And just when they vary, they in turn trigger actions. The
Enertex
®
EibPC always "remembers" the states of its objects.
The else branch is already valid, since all objects are initialized to zero. However, if you start the application program
the else-branch is not executed. Now, if the response to the read request is OFF (0b01), the else-branch is not
executed, because the object "Switch-1/0/0" is already initialized with OFF. The re-arrival of the telegram does not
lead to a change of states and in the else-branch the Enertex
®
EibPC does not trigger any telegrams.
HandbuchEibPC_USA-30.odt, 2017-05-11
Enertex
®
Bayern GmbH - Erlachstraße 13 - 91301 Forchheim - [email protected]