Variables / Registers / Arrays #V
Command group to execute calculations and logical operations. With the help of the string files, internationalization (multiple languages) can be realized. There are registers for numbers and strings (can record characters up to 200), integer registers use signed 32-bit, floating-point registers use 23-bit mantissa, 8-bit exponent, 1-bit signed.
String file / multilingualism
Load string file (Variable stringFile Load) |
<StringfileName> |
|
Delete string file (Variable stringFile Delete) |
<StringfileName> (all) |
|
Send number of loaded string files (Variable stringFile Count) |
String register
Set string register (Variable Stringregister Set) |
String-ID, "String"; "String" [ID+1]; ... |
|
Set string register from position (Variable Stringregister Postion) |
String-ID, Offset, "New String"; |
|
Replace string register from position (Variable Stringregister Replace) |
String-ID, Offset, "New String"; |
|
Cut out and replace sub-string from string register (Variable Stringregister Truncate) |
String-ID, Offset, Number(until end) |
|
Copy sub-string from string register (Variable Stringregister Copy) |
String-ID Target, String-ID Source, Offset (0), Number(until end) |
|
split string registers in sub-strings (Variable Stringregister dElimiter) |
String-ID Target Start, String-ID Source, Seperator, Register-ID (=String-ID Target Start) |
|
Set string register with date/time (Variable Stringregister Date) |
String-ID, "Dateformat"; date (act. time); 1/100sec |
|
Set formatted string register (Variable Stringregister Formated) |
String-ID, "Formatted string"; Value, Value2, ...., ValueN |
|
Read object strings (Variable Stringregister Object) |
String-ID, Obj-ID, ... |
|
Send string register (ASCII) (Variable string Send Ascii) |
String-ID, ... |
|
Send string register (Unicode) (Variable string Send Unicode) |
String-ID, ... |
|
Sort string register (Variable Quicksort Strings) |
String-ID Start, String-ID End, Number (0), Offset(0) |
|
Sort codes in string register (Variable Quicksort Codes) |
String-ID, Direction (1), Number (0), Offset (0) |
|
Last error message in string register (Variable Stringregister Last error) |
String-ID, Delete(1) |
|
Mix string register (Variable Mix Strings) |
String-ID Start, String-ID End |
|
Mix codes in string register (Variable Mix Codes) |
String-ID, Number (0), Offset (0) |
|
Define regular expression (Variable String regular eXpression) |
RegEx-ID, "regular expression" |
|
Observe string register (Variable Observe StringRegister) |
String-ID, "String" [ID+1]; ... |
|
Delete Changeflag of string register (Variable Delete StringRegister Changeflag) |
String-ID |
Register
Set register (integer) (Variable Register Integer) |
Register-ID, Value, Value1 [ID+1], ... |
|
Set register (float) (Variable Register Float) |
Register-ID, Value, Value1 [ID+1], ... |
|
Convert object string (Variable Register Object) |
Register-ID, Obj-ID, Obj-ID1[ID+1], ... |
|
Convert string register to register (Variable Register dElimiter) |
Register-ID Start, String-ID Source, Seperator, Register-ID Name |
|
Write register to RTC-RAM (Variable Register rtc Write) |
ID, Register-ID, Register-ID1, ... |
|
Read register from RTC-RAM (Variable Register rtc Read) |
ID, Register-ID, Register-ID1, ... |
|
Convert string register as calculation to register (integer) (Variable Calculate Integer) |
Register-ID, String-ID, String-ID1[ID+1], ... |
|
Convert string register as calculation to register (float) (Variable Calculate Float) |
Register-ID, String-ID, String-ID1[ID+1], ... |
|
Send register (Variable Register Send) |
Register-ID, ... |
|
Sort register (Variable Quicksort Register) |
Register-ID Start, Register-ID End |
|
Mix register (Variable Mix Register) |
Register-ID Start, Register-ID End |
|
Observe register (Variable Observe Register) |
Register-ID, "Register" [ID+1]; ... |
|
Delete Changeflag of register (Variable Delete Register Changeflag) |
Register-ID |
|
Assign a register to an analogue channel (Variable Register Analog) |
Register-ID, Channel |
|
Assign a register to an I/O Port channel (Variable Register Port) |
Register-ID, Port |
Array
Define array (Integer) (Variable Array Integer) |
Array-ID, Number, Type(0) |
|
Define array (Float) (Variable Array Float) |
Array-ID, Number, Type(0) |
|
Define array (Unicode string) (Variable Array Unicode) |
Array-ID, Anzahl, Stringlength, Type(0) |
|
Delete array (free memory) ((Variable Array Delete) |
Array-ID |
|
Fill array (Variable Array Set) |
Array-ID, Value(0, all Elements), element index |
|
Assign values to array elements (with index) (Variable Array Value) |
Array-ID, Index, Value, Value[Index+1], ... |
|
Assign values to array elements (with current write pointer) (Variable Array Write) |
Array-ID, Value 1, Value 2, ... |
|
Set writing and/or reading pointer (Variable Array Pointer) |
Array-ID, WritePointer(-1), ReadPointer(-1), max. WritePointer |
|
Sort array (Variable Quicksort Arrays) |
Array-ID, StartIndex, EndIndex(last Index), Stringlength(0), Stringoffest(0) |
|
Mix array (Variable Mix Arrays) |
Array-ID, StartIndex, EndIndex(last Index) |
|
Observe array (Variable Observe Array) |
Array-ID, "Array" [ID+1]; ... |
|
Delete Changeflag of array (Variable Delete Array Changeflag) |
Array-ID |
String file / multilingualism
"Hello World" is placed in 4 different languages. It must be ensured that the selected font supports all necessary characters. In the following example "Arial Unicode MS" was used. The commands below assume that the string files (Chinese.txt, English.txt, Cyrillic.txt and German.txt) are already available on FLASH in the project path in the string's subfolder:
... #VFL <P:string/German.txt> #SSP 1,1,10,10,7,!HELLO!; #VFD #VFL <P:string/English.txt> #SSP 2,1,10,50,7,!HELLO!; #VFD #VFL <P:string/Cyrillic.txt> #SSP 3,1,10,90,7,!HELLO!; #VFD #VFL <P:string/Chinese.txt> #SSP 4,1,10,130,7,!HELLO!; #VFD ... |
#VFL |
<StringfileName> |
Load a set of strings. A maximum of 1000 strings from 8 different files can be loaded at the same time.
#VFD |
<StringfileName> (alle) |
Delete a set of strings or all. The files are physically retained on the SD card so that they can be reloaded.
#VFC |
|
Places the number of loaded strings in the send buffer. The feedback is structured as follows:
ESC |
V |
F |
C |
Number |
... |
|
$1B |
$56 |
$53 |
$43 |
16-Bit value |
... #VFL ... #VFL ... #VFL ... #VFL ... #VFC ... |
String register
#VSS |
String-ID, "String"; "String" [ID+1]; ... |
The command saves the String in the register set (String ID [0 ... 199]).
|
... #VSS 0,"Hello World";"Test "S0;S0" Test"; ... |
Set string register from position
#VSP |
String-ID, Offset, "New String"; |
The string of the location String-ID is deleted from the position offset and the new data ("New String") are added.
|
... #VSS 0,"Hello World"; #VSP 0,6,"Test"; ... |
Replace string register from position
#VSR |
String-ID, Offset, "New String"; |
The string of the location String-ID is replaced with the new data (("New String") from the position offset.
|
... #VSS 0,"Hello World"; #VSR 0,6,"Test "; ... |
Cut out and replace sub-string from string register
#VST |
String-ID, Offset, Count(until end) |
Delete the "left" part of the string register and move the part from offset to offset + count to the front. If count is negative, count is taken as second offset. It is then an area specification.
|
... #VSS 0,"Hello World"; #VST 0,6,5 ... ... #VSS 0,"Hello World"; #VST 0,6-10 ... |
Copy sub-string from string register
#VSC |
String-ID Target, String-ID Source, Offset (0), Count(until end) |
Copy a substring from the string (String-ID Source), starting with the Offset and length Count, and paste it into another string register (String ID Target).
|
... #VSS 0,"Hello World"; #VSC 1,0,6,5 ... ... #VSS 0,"Hello World"; #VSC 1,0,6-10 ... |
Split string register in sub-strings
#VSE |
String-ID Target Start, String-ID Source, Seperator, Register-ID (=String-ID Targert Start) |
The string (String-ID Source) is split into substrings. The substrings are stored from the String ID Target Start. The number of substrings is stored in the Register-ID. The Seperator parameter specifies the separator.
|
... #VSS 0,"Entry1,Entry2,Entry3"; #VSE 1,0,?,,10 ... |
Set string register with date/time
#VSD |
String-ID, "Dateformat"; date (act. time); 1/100sec |
The time is stored in the string register as a formatted string. The presentation is based on the Dateformat. The structure is described in more detail in the sub-chapter Date formats.
|
... #VSD 1,"%h:%m:%s"; ... |
#VSF |
String-ID, "Formatted string"; Value, Value2, ...., ValueN |
A formatted string is stored in the string register (String-ID). If the variable set is repeated, the format string is used again and stored in String-ID + 1
|
... #VSF 1,"Analog %d";(analog(0)) ... |
#VSO |
String-ID, Obj-ID, ... |
Object strings (Obj-ID) are stored in the string register (String-ID). This function is mainly used for EditBoxes.
|
... #SED 1,"edit me" /**Default text for EditBox #VSO 1,1 ... |
Send string register (ASCII), proprietary interface (Short/Small protocol) only
#VSA |
String-ID, ... |
Place the content of the string register (ASCII formatted) in the send buffer. The feedback is structured as follows:
ESC |
V |
S |
A |
String-ID |
Length |
Char 1 |
Char 2 |
... |
Char n |
... |
|
$1B |
$56 |
$53 |
$41 |
16-Bit value |
16-Bit value |
8-Bit value |
8-Bit value |
8-Bit value |
8-Bit value |
... #VSS0,"str"; #VSA 0 ... |
Send string register (Unicode), proprietary interface (Short/Small protocol) only
#VSU |
String-ID, ... |
Place the content of the string register (Unicode formatted) in the send buffer. The feedback is structured as follows:
# |
V |
S |
U |
String-ID |
Length |
Char 1 |
Char 2 |
... |
Char n |
... |
$1B |
$56 |
$53 |
$55 |
16-Bit value |
16-Bit value |
16-Bit value |
16-Bit value |
16-Bit value |
16-Bit value |
... #VSS0,"str"; #VSU 0 ... |
#VQS |
String-ID Start, String-ID End, Number (0), Offset(0) |
The area of the string register (String-ID Start to String-ID End) is sorted. Number specifies the area that is considered for the sorting, with number = 0 the entire length is examined. Offset specifies the position in the string where the sorting begins.
|
... #VSS 0,"Sort";"Test";"Entry";"Exit"; #VQS 0,3,2,0 ... |
#VQC |
String-ID, Direction (1), Number (0), Offset (0) |
Codes within the string register (String-ID) are sorted. Number specifies the area that is considered for the sorting, with number = 0 the entire length is examined. Offset specifies the position in the string from which the sorting begins. The direction can also be specified:
Direction |
|
0 |
Descending |
1 |
Ascending |
|
... #VSS 1,"Hello World" #VQC 1 ... |
Last error message in string register
#VSL |
String-ID, Delete(1) |
Save the error messages from the terminal in a string register (String-ID). The parameter Delete specifies the deletion behaviour of the error message:
Delete |
|
0 |
Do not delete |
1 |
Delete |
#VMS |
String-ID Start, String-ID End |
The content of the registers remains, only the String-ID changes. A new assignment of string ID ⇔ content is now available.
Mix codes in string register (from V1.3)
#VMC |
String-ID, Number (0), Offset (0) |
The content of a string register (String-ID) is interchanged randomly.
Number indicates the number of digits (= 0 complete string), Offset the starting point within the register.
#VSX |
RegEx-ID, "regular expression" |
Define a regular expression and save to RegEx-ID[0..9]. This command works together with many calculation commands to find specific strings in StringRegisters or StringArrays.
... #VAU 0, 14,24, 0 /**Define unicode array, 14 entries, maximum stringlen=24 #VAW 0, "Alabama Slammer"; "Bloody Mary"; "Cosmopolitan"; "Fireball"; #VAW 0, "Kamikaze"; "Mai Tai"; "Mojito"; "Long Island Iced Tea"; "Pina Colada"; #VAW 0, "Gin Fizz"; "Jim Beam"; "Smirnoff"; "Tequila"; "Zombie" #VSX 2, ".*am.*" /**set regular expression to RegExp-ID 2. /**Positive result if character combination 'am' is in String #VRI 3, -1 /**Use Register R3 as result. Preload with -1 as result =-1 no occurrence #MFM 1 /**Loop start #VRI 3, (strXA(2,0,++R3)) /**get new index where RegExp is true, /**starting from last found index+1 #MFS (R3<0), 1 /**skip next line if no occurrence #YPA A0I(R3) "\r\n" /**print arraystring into terminal window and add a new line #MFJ(R3>=0) 1 /**loop end, Jump back to start if RegExp was true last time ... |
Supported regular expressions:
^ Start of string
$ End of string
. any single character
a? zero or one of a, i.e. the term is optional
a+ one or more of a
a* Zero or more of a
[ ] Range selection, e.g. [a-z]
[^ ] Range except selection range, e.g [^a-f]
( ) Capture everything enclosed max. 9 Subsections
| or
\ Cancel special character (standard character)
#VOS |
String-ID, "String" [ID+1]; ... |
The command defines the StringRegister as observed. If the register value changes, a macro can be called up automatically.
Delete Changeflag of string register
#VDS |
String-ID |
Deletes the Changeflag of the StringRegister.
Read WIFI SSID to string register
#VSW |
String-ID |
Writes the WIFI SSID to the String register with the specified String ID.
Read mDNS name to string register
#VSN |
String-ID |
Writes the mDNS/project name to the string register with the specified String ID. The command can only be used in the core.
Register
#VRI |
Register-ID, Value, Value1 [ID+1], ... |
The command saves an integer value (32 bits) in the register set (Register-ID [0 ... 199]).
|
... #VRI 0,10,42,-8 ... |
If the values are to be transmitted binary (communication with external µC), the switch "G" is used.
#VRF |
Register-ID, Value, Value1 [ID+1], ... |
The command saves a float value (32 bit) in the register set (Register-ID [0 ... 199]).
|
... #VRF 0,10.25,42.39,-8.19 ... |
If the values are to be transmitted binary (communication with external µC), the switch "G" is used.
#VRO |
Register-ID, Obj-ID, Obj-ID1[ID+1], ... |
Object strings are stored in registers. The object string is converted into a numerical value (automatically fitting as an integer or float). This function is mainly used for EditBoxes.
|
... #SED 1,"42.5" /**Default text for EditBox #VRO 1,1 ... |
#VRE |
Register-ID Start, String-ID Source, Separator, Register-ID Number |
Convert numeric string (String-ID Source) to register (Register-ID Start). Separator specifies the separator between the values. The number of valid values after the conversion is specified in the optional parameter Register-ID Number
|
... #VSS 0,"10,42.39,-8"; #VRE 0,0,?,,10 ... |
Write register to RTC-RAM (if assembled only)
#VRW |
ID, Register-ID, Register-ID1, ... |
Buffer a Register-ID in the RAM of the RTC. ID [0 ... 7] indicates the storage space. The value is retained even after the module is switched off.
Read register from RTC-RAM (if assembled only)
#VRR |
ID, Register-ID, Register-ID1, ... |
Read back a value from the RTC-RAM (ID) and transfer it to the register (Register-ID).
Convert string register as calculation to register (integer)
#VCI |
Register-ID, String-ID, String-ID1[ID+1], ... |
Interpret the content of a string register as a calculation string. The result is stored in the register (Register-ID)
|
... #VSS 0,"R0+R1"; #VCI 2,0 ... |
Convert string register as calculation to register (float)
#VCF |
Register-ID, String-ID, String-ID1[ID+1], ... |
Interpret the content of a string register as a calculation string. The result is stored in the register (Register-ID)
|
... #VSS 0,"R0+R1"; #VCF 2,0 ... |
#VRG |
Register-ID, ... |
Place the contents of the register in the send buffer. The feedback is structured as follows:
ESC |
V |
R |
G |
Register-ID |
Type |
Value |
... |
|
$1B |
$56 |
$52 |
$47 |
16-Bit value |
16-Bit value |
32-Bit value |
... #VRF 0,... #VRG 0 ... |
#VQR |
Register-ID Start, Register-ID End |
The area of the registers (Register-ID Start to Register-ID End) are sorted.
|
... #VRI 0,2,8,4,-5 #VQR 0,3 ... |
#VMR |
Register-ID Start, Register-ID End |
The content of the registers remains, only the Register-ID changes. A new assignment of Register-ID ⇔ content is now available.
#VOR |
Register-ID, "Register" [ID+1]; ... |
The command defines the register as observed. If the register value changes, a macro can be called up automatically.
#VDR |
Register-ID |
Deletes the Changeflag of the register.
Assign a register to an analogue channel
#VRA |
Register-ID, Channel |
The command assigns a register to an analogue channel.
Assign a register to an I/O Port channel
#VRP |
Register-ID, Port |
The command assigns a register to an I/O port channel.
Array
#VAI |
Array-ID, Number, Type(0) |
The command defines an integer array (Array-ID [0 ... 199]) with the given Number of entries. The maximum length of the array respectively if the array has the desired length, can be checked with the calculation arE(). The Type specifies the behaviour when writing at the end of the array.
|
#VAF |
Array-ID, Number, Type(0) |
The command defines a float array (Array-ID [0 ... 199]) with the given Number of entries. The maximum length of the array respectively if the array has the desired length, can be checked with the calculation arE(). The Type specifies the behaviour when writing at the end of the array.
Type |
|
0 |
Stop at end |
1 |
Wrap around (ring buffer) |
#VAU |
Array-ID, Number, Stringlength, Type(0) |
The command defines a string array (Array-ID [0 ... 199]) with the given Number of entries. The second parameter Stringlength gives the maximum length per entry. The maximum length of the array respectively if the array has the desired length, can be checked with the calculation arE(). The Type specifies the behaviour when writing at the end of the array.
Type |
|
0 |
Stop at end |
1 |
Wrap around (ring buffer) |
#VAD |
Array-ID |
The command deletes an array (Array-ID [0 ... 199]) and releases the memory.
#VAS |
Array-ID, Value(0, all Elements), element index |
The command fills all elements of the array (Array-ID [0 ... 199]) with the given Value. If Value paramter is not sent, then the whole array is filled with 0. On the other hand the element index can specify which elements get the new value.
Assign values to array elements (with index)
#VAV |
Array-ID, Index, Value, Value[Index+1], ... |
The command assigns new Values to array elements, starting with the array Index.
Assign values to array elements (with current write pointer)
#VAW |
Array-ID, Value 1, Value 2, ... |
The command assigns new Values to array elements, starting with the current write pointer.
Set write and*or reading pointer
#VAP |
Array-ID, WritePointer(-1), ReadPointer(-1), max. WritePointer |
The command sets the Write and / or Read pointer of the array (Array-ID [0 ... 199]). If the pointer should remain unchanged, the respective parameter must be set to -1.
#VQA |
Array-ID, StartIndex, EndIndex(last Index), Stringlength(0), Stringoffest(0) |
The values of the array (Array-ID [0 ... 199]) are sorted in the specified range (StartIndex to EndIndex). The last two parameters Stringlength and Stringoffset are only used if it is a stringarray (#VAU). Stringlength (total =0) specifies the number of characters, Stringoffset the character position to be considered for sorting.
#VMA |
Array-ID, StartIndex, EndIndex(last Index) |
The command shuffles the values of the array in the specified range (StartIndex to EndIndex). The values remain unchanged. Only the order (indexes) is adjusted. A new assignment of the array indexes ⇔ values is now available ....
#VOA |
Array-ID, "Array" [ID+1]; ... |
The command defines the array as observed. If the array value changes, a macro can be called up automatically.
#VDA |
Array-ID |
Deletes the Changeflag of the array.