Programming - First steps
P.
44 of 349
A hallway light control
Motion detectors and switches
Variables
Naming:
any combination of letters
and numbers.
No umlauts and special characters!
Example 3: An additional motion detector
The structure is now being extended to include the motion detector with the logical address
“MotionDetector-1/2/0“. The dimmer will either be connected through a switch or a motion detector.
The dimmer is parametrized in such a way that it is selectively turned on and off by a switch object
"Dimmer-1/1/1" (binary, i.e. data type b01). The brightness of the dimmer is transferred with the
group address "DimmerValue-1/1/2. Figure 9 shows the basic structure.
RS 232
EibPC
EibPC
“Lamp-1/1/1“
“Dimmer–1/1/1“
“DimmerValue-1/1/2“
“Switch-1/0/0“
“Motion detector
-1/2/0“
KNX-Bus
Figure 9: Block Diagram 3
Here our task
If the switch is pressed “ON“, the lamp should turn on and the dimmer to go to 80%. If it goes
to OFF, the lights will go out. If the switch is active, the motion is to be disabled.
If the motion detector sends an ON-telegram, the dimmer is to go to 50% of its luminosity.
Before we go further on with the implementation, we show an important element of programming:
variables. Variables are placeholders for numbers, values, and telegrams. In the Enertex
®
EibStudio
you can define a variable in several manners (see page 158). Again, one definition per line has to be
used.
1.
Variable=
Value
2.
Variable
=Group address
3.
Variable
=function()
The data type of the variable is not added at the end as with group addresses, as it is clearly known
either from the notation of the number or from the assignment to a group address. When creating the
program, the Enertex
®
EibStudio checks whether the assignment to a certain type is consistent within
the program. If you make a mistake, you will receive an error message from the Enertex
®
EibStudio
Thus
Dimmer=80%
MotionDetector=“MotionDetector-1/2/0“
are valid definitions. The first defines the variable
Dimmer
to 80% (=204
u08
). The second assigns
the variable
MotionDetector
to the
contents
of the telegram which is sent to the group address
"MotionDetector-1/2/0.
HandbuchEibPC_USA-30.odt, 2017-05-11
Enertex
®
Bayern GmbH - Erlachstraße 13 - 91301 Forchheim - [email protected]