Commands and functions
P.
220 of 349
Stringfunctions
Concatenate
Find
Strings can be defined variable from 1 to 65534 bytes. Thereby the corresponding endpoint has to be
specified behind the character string. E.g. a string with the length of 55 bytes will be defined as
follows: string= $$c55
The data type c14 will be treated seperately by the compiler because he is compatible with the KNX
data type EIS15 and has in contrast to all other strings any zero termination at the end, Gegensatz
zu allen anderen Strings keine Nullterminierung am Ende hat, as well as any special characters are
not allowed. C.f. the notes to the encoding too on p. 108.
Definition
●
string1
+
string2
[
+
string3
...
stringN
]
Arguments
●
An arbitrary number of arguments, but either all of data type c14 or all of data type c1400.
Effect
●
The character strings are concatenated. If the resulting length exceeds the maximum
length of the data type, the result is truncated to this length.
Data type result (Return)
●
Data type of arguments
Example: Addition of character strings
The character strings string1 and string2 shall be “added“ or concatenated.
Implementation in the user program:
string1=$Character$
string2=$String$
// result: “CharacterString”
result=string2
Definition
●
Function
find
(
string1, string2, pos1
)
Arguments
●
3 arguments,
string1, string2
of data type c1400,
pos1
of data type u16
Effect
●
string1
: Character string a (partial) character string shall be searched for in.
●
string2
: Character string to be searched for.
●
pos1
: Ignore the first
pos1
incidences of the character string to be searched for.
●
The function returns the position of the first character of the found character string
(0..1399u16). It returns 1400u16 if the character string has not been found
●
For 65534u16, the constant END has been defined.
Data type result (Return)
●
Data type u16
Example: Search a character string
In the variable String=$CharacterString$, the character string “String” shall be searched for. No
(0) incidences shall be ignored.
If “String” is not found, the variable Error shall be set to 1.
Implementation in the user program:
Error
String=$CharacterString$
Find=$String$
Result=find(String,Find,0u16)
if Result==1400u16 then Error=EIN endif
HandbuchEibPC_USA-30.odt, 2017-05-11
Enertex
®
Bayern GmbH - Erlachstraße 13 - 91301 Forchheim - [email protected]