Command syntax
All commands have same structure:
Commands used in macros (PLCDesigner) always start with "#", followed by letters, digits and commas or semicolons. These are transmitted as ASCII or Unicodes.
Sometimes it is useful to transfer single parameters hexadecimal or binary (see "Parameters").
Start |
Command code |
Parameter |
Comment |
|
# |
XXX |
123, $52, %01101010, "Hello"; R0 |
/** This is a comment |
|
ASCII : 35 (0x23) UniCode: 35 (0x23 0x00) |
3-letter command |
Parameters |
ASCII 47 42 42 (0x2F 0x2A 0x2A) |
Parameters
Numbers |
||
123 |
decimal passed as ASCII characters |
|
$5A |
hexadecimal passed as ASCII character |
|
%1010001 |
binary passed as ASCII character |
|
5-8 |
Passing of a range. Commands influencing multiple objects can be passed using an object range. The given example relates to object-IDs 5,6,7,8 |
|
?x |
Code of a single character (Unicode/ASCII) |
|
R0 ... R499 |
Passing a register value |
|
Q0 ... Q499 |
Indexed passing of a register value (pointer) → R (R0 ... R499) |
|
(....) |
Calculation-string used for return value |
|
G len32 data.... |
Transfer binary data: len32 defines the data length (already passed as binary 32-bit value) |
|
!index! |
Use values of a string file's index |
|
A0..A199I0..maxindex |
Access array: A3I42 or A(R0)I(R5+1) |
|
Strings |
||
"string" or 'string' |
standard string passing |
|
"str" 32 "str" |
simple string with any code in between, which is incorporated into the final string |
|
"str1"; "str2" |
Semicolon represents the string ending. Important if passing two strings or following parameters after a string. |
|
S0 ... S499 |
Passing string registers |
|
T0 ... T499 |
Passing string registers using a register as index S(R0 ... R499). |
|
U"Hello" |
Interpret characters after U as 16 bit uni code (until next # or V, also CR + LF) |
|
V"Hello" |
Interpret characters after U as 8 bit ASCII (until next # or U, also CR + LF) |
|
!index! |
Use string of a string file's index |
|
A0..A199I0..maxindex |
Access array: A3I42 or A(R0)I(R5+1) |
|
X0 = Last found Regular Expression; X1..X9 = individual subranges of the Regular Expression |
Each parameter is separated by blank (' '), comma (','), semicolon (';') or point ('.'). For separating strings you have to use a semicolon.
Comments
A comment starts with /** and is valid until the end of the line. To save memory space in the display, these comments are not stored in the display. Comments appear in gray in the PLCDesigner.
Calculation
Every numerical parameter can be replaced by a calculation string. The calculation needs to be inside parentheses () to be passed as one parameter. The documentation on calculation commands lists all operations and functions, including mathematical, logical as well as module-specific operations, e.g. time or object properties.
Path specifications
There are three ways to locate a file with/without path specification. Attention: The path and file specification is case sensitive.
Absolute path specification |
</folder/folder/project/picture/test.epg> |
#PPP 1,</folder/folder/project/picture/Test.epg>,100,100 |
Relative path specification |
<p:/picture/Test.epg> |
#PPP 1,<p:/picture/Test.epg>,100,100 |
Default path |
"Test.epg" |
#PPP 1, "Test.epg";100,100 (Attention: Semicolon after the text) |
- The absolute path specification should be used to work with files outside the given project path.
- The project path, defined by the #XPS command, is used for simplification. There is no need to specify the parent directories. By entering "p:" in front of the path specification, the project path is inserted automatically.
- Furthermore, there are a number of default folders that are automatically created below the project folder and must never be changed. Otherwise, command parameters that automatically access these folders may no longer work! Subfolders are not allowed in this area.
Angle, definition
Angles are specified in the mathematical direction of rotation, i.e. counter-clockwise.
The input of negative angles is possible.
Object range, addressing several objects simultaneously
With commands which have the property to influence one or more objects (marked by: Object-id...), the specification of the object range can be indicated by a hyphen "-". For example, the command #ODI 1-99 deletes all objects with IDs 1 to 99.
Alternatively, a list of several objects can be defined. e.g. #ODI 1,2,5,100