3 user variables, 4 built-in function calls – ElmoMC SimplIQ Software Manual User Manual
Page 27
SimplIQ
Software Manual
The Interpreter Language
MAN-SIMSW (Ver. 1.4)
4-9
Example:
A floating point variable “temp” is defined in a user program.
Expression Sent
Response
Received
Remarks
TC=1
–
Assign integer value to floating point command
TC.
TC
1.0
Assigned integer value is converted to float.
temp=12,345,678
–
Assign integer value to floating point variable.
temp
1.234568e+7
Assigned value is truncated to 12,345,680.0.
4.2.6.3 User Variables
User variables are defined within a user program. The description and syntax rules of the
variable definition are outlined in
.
User program variables may be used within the command line only if a program was
compiled successfully and downloaded to the drive. The user may then use the
Interpreter to query a user variable value or change it.
The user should pay special attention to the scope of a variable. A variable may be
defined at the global or local level. Local variables are available only within the function
in which they are defined, while global variables are available within any function and
outside a program.
A user variable may be queried or changed when the program is running or halted.
For example, suppose that a compiled program includes the following lines at the global
level:
int ZEBRA,GIRAFFE[3];
float GNU;
The expression GNU=ZEBRA*GIRAFFE[1]+2*sin(GIRAFFE[2]); is valid. User program
variables are case sensitive.
4.2.6.4 Built-in Function Calls
The built-in function call may be used in a single expression. For a list of mathematical
built-in functions, refer to
. Non-mathematical built-in functions are as follows:
Operator Description Returns
tdif
Time difference
x=TM
tdif(x)
returns the time in msec since x=TM has been
sampled.
Integer
emit(n)
Emits the n TPDO (CAN transmit process data object),
where n equals 1, 3 or 4. Details given in
section
Integer, 1 if
function is
completed
successfully;
otherwise 0