2 single and multiple command execution, 3 standard conventions, 1 line and expression termination – ElmoMC SimplIQ Software Manual User Manual
Page 32: 2 single and multiple command execution -3, 3 standard conventions -3, Line and expression termination -3
SimplIQ
Software Manual
4BThe
SimplIQ
User Programming Language
MAN-SIMSW (Ver. 1.4)
5-3
5.2
Single and Multiple Command Execution
A single line in a
SimplIQ
program is executed as a single unit, preventing intervention by
the Interpreter or by a CAN command. For example, in the sequence:
UM=5;
MO=1;
an Interpreter command could be executed between the execution of the two program
statements. If, for example, the Interpreter statement between these two lines is UM=2, MO=1
would be specified for a wrong unit mode. The sequence:
MO=0; UM=5; MO=1; BG
guarantees that MO=1 is executed with the correct unit mode, because no other command
can intrude.
The policy of executing a full line ensures that commands are executed in a guaranteed
sequence and enables the user to regulate the speed of program execution. The more
commands in a single program line, the faster program execution will be, at the expense of a
slower response to host communications.
Note, however, that a drawback to this policy is that if the execution of a single program line
takes a long time, or if it loops internally forever, the
SimplIQ
drive may become totally
unresponsive to its CAN and RS-232 communication. In order to reduce this hazard, the
execution of a single program line is time-out protected by a limitation of 3 seconds as the
maximum time that program line execution can last. If a program line executes more than 3
seconds, the
SimplIQ
drive stops it with error code 96: User Program Time Out.
5.3
Standard Conventions
A user program contains lines of text code, which must use defined syntax in order for the
Compiler to recognize it. This section describes common elements of program text.
5.3.1
Line and Expression Termination
A line can have the following terminators: carriage return, line feed or their combination. A
line may contain a single expression or a sequence of expressions. Expressions in a sequence
on the same line can be separated with a semicolon or comma (not inside parentheses or
brackets).
Examples:
a = 3 , b = 2 , c = a + b ,
One line of three expressions separated by commas
a = 3 ; b = 2 ; c = a + b ;
One line of three expressions separated by semicolons
a = 3 , b = 2 ; c = a + b
One line of three expressions separated by a comma, a
semicolon and terminated with a line feed
[a,b] = func (23, c, 3.14)
An expression in which the comma is not an
expression separator because it is inside parentheses