7 virtual machine control statements, 1 wait control statement, 2 waitvar control statement – ElmoMC Multi-Axis Motion Controller-Maestro User Manual

Page 98

Advertising
background image

Example:

function @perror(int error_number)

if(number == 1)

TRACE (“Divided by zero! ”)

end

if

restart

end function

5.7

Virtual Machine Control Statements

5.7.1

wait control statement

The wait keyword suspends the execution of the program until the specified time has
elapsed. The expression may be within round parentheses or without parentheses. The
expression specifies the waiting time in milliseconds. It can be a numerical expression
only, which is evaluated in a single value.

Syntax

wait(numerical-expression)

Example:

function foo()

// do something

……

wait(1000) // program waiting one second

end function

5.7.2

waitvar control statement

The waitvar keyword suspends the execution of the program until the specified
variable value has changed or timeout elapsed. Variable name specifies the global
variable for waiting. The expression specifies the waiting time in milliseconds. It can
be numerical expression only, which is evaluated in a single value.

Syntax

waitvar(variable-name, numerical-expression)

Example:

function foo()

// do something

……

waitvar(g_var, 1000) // program wait for g_var to chang in one second

end function

Maestro

Software Manual

MAXL Program Language

MAN-MASSW (Ver. Q)

5-36

Advertising