Programming - First steps
P.
54 of 349
As often as you want
Cycle controlled
Data type u32
32Bit, unsigned integer
KNX
TM
character string
So, basically, instead of a variable also any other function can be used ('nesting'), it is only important that this function
or the expression of the appropriate data type has a return value. In the above example,
SwitchingOperation
is
already a binary data type, thus the comparison is not necessary. However, you can now use
after()
in this sense to
delay thresholds (e.g.
if after(Light>200u32,TimeValue)
). The delay time must not be constant. For example, it could
be entered via a telegram or a variable.
At this point, yet another clue: The number of high precision timer used in the program is not limited.
You can always use the function multiple times. For each called after function a new object is
created. Therefore, the functions do not limit each other in use. This holds always and for all other
functions when programming with the Enertex
®
EibStudio.
An important special function for automatically timed outputs is the
cycle
function. Using these functions, tasks can
be executed at certain time cycles. You can find more on page 196.
Still missing is the conversion function:
convert(
Variable1 {Type Source}, Variable {Type Target}
)
This function has that value as return value, which is stored in
Variable1
, but is converted into the
type of
Variable2
. The value of
Variable2
is ignored, it is only used to determine the new data types.
For example, a binary value can be converted into an 8-bit unsigned number by
convert
:
a='1/2/2'b01
b=convert(a,1u08)
In this example, we increase the variable
numerator
within the then branch at each switching cycle of
the lamp:
Counter=1u32
Here,
Counter
is of type integer, 32-bit unsigned. It allows, to count up to 2
32
-1 = 4,294,967,295. If
the lights have actually been activated so often, this variable would get an overflow at re-pressing the
switch and would begin to count at 0.
Character strings of up to 14 characters will be transmitted via group addresses of the type c14. The
definition of a
c14
-string is framed by two $-signs.
$ Text $c14
is equivalent to the character string „ Text “ (with spaces)
This data type can be directly printed on KNX
TM
display elements. Besides, at the programming of
the Enertex
®
EibPC, there are character strings with a length of up to 1400 characters. Later in this
introduction, we will need these to handle LAN telegrams.
With
EmptyString=$ Still nothing! $c14
a character string variable
EmptyString
with content "Still nothing! "(including spaces) is defined.
Finally, within the statement
write('1/2/2'c14,convert(Counter,EmptyString))
Counter
is shown on a KNX display element, converted into a character string.
HandbuchEibPC_USA-30.odt, 2017-05-11
Enertex
®
Bayern GmbH - Erlachstraße 13 - 91301 Forchheim - [email protected]