Programming - First steps
P.
50 of 349
A release button and the
validation scheme
Properly resolved - how it's done
Nesting of if statements
While the syntax is valid (no error
by the compiler) ...
... but does not work as intended
EibPC
EibPC
RS 232
Switch
'1/0/0'
Lamp - binary
'1/1/1'
Dimmer – Percent
'1/1/2'
KNX Bus
ReleaseSwitch
'1/0/1'
Figure 13: Block diagram of switch and release button
We have a structure presented as shown in Figure 13.
If the switch is pressed “ON“, the lamp should turn on and the dimmer has to go to 80%. If it
goes to OFF, the lights will go out. If the release switch (group address 1/0/1) is set to OFF,
the switch ON will be ignored.
A simple task:
[ETS-ESF]
EibPC/Haus.esf
[EibPC]
if (systemstart()) then read("Switch-1/0/0"); read("ReleaseSwitch-1/0/1") endif
if ("Switch-1/0/0"==EIN) and ("ReleaseSwitch-1/0/1"==ON) then \\
write("Lamp-1/1/1",ON);
\\
write("Dimmer-1/1/2"u08,80%) \\
else
write("Lamp-1/1/1",OFF);
\\
write("Dimmer-1/1/2"u08,0%) \\
endif
if
statements can be nested. You might be of the opinion to proceed as follows:
[ETS-ESF]
/EibPc/Haus.esf
[EibPC]
if (systemstart()) then read("Switch-1/0/0"); read("ReleaseSwitch-1/0/1") endif
if ("ReleaseSwitch-1/0/1"==ON) then \\
if ("Switch-1/0/0"==ON) then \\
write("Lamp-1/1/1",ON);
\\
write("Dimmer-1/1/2"u08,80%) \\
else
\\
write("Lamp-1/1/1",OFF);
\\
write("Dimmer-1/1/2"u08,0%) \\
endif \\
endif
HandbuchEibPC_USA-30.odt, 2017-05-11
Enertex
®
Bayern GmbH - Erlachstraße 13 - 91301 Forchheim - [email protected]