TEMP1
POINT
Invalid Variable Names
REALLONGNAME
; Cannot have more than 8 characters
123
; Cannot begin variable name with a number
STAT Z
; Cannot have spaces in the name
Assigning Values to Variables:
Assigned values can be numbers, internal variables and keywords, functions, RIO board parameters and
strings; the range for numeric variable values is 4 bytes of integer (2
31
) followed by two bytes of fraction (+/-
2,147,483,647.9999).
Numeric values can be assigned to programmable variables using the equal sign.
Any valid RIO functions can be used to assign a value to a variable. For example, s1=@ABS[V2] or
s2=@IN[1]. Arithmetic operations are also permitted.
To assign a string value, the string must be in quotations. String variables can contain up to six characters
that must be in quotation.
Examples:
INTWO=_TI2
Assigns returned value from TI2 command to variable INTWO.
INPUT=@IN[1]
Assigns logical value of input 1 to variable INPUT
V2=V1+V3*V4
Assigns the value of V1 plus V3 times V4 to the variable V2.
Var="CAT"
Assign the string CAT to variable Var
Displaying the value of variables at the terminal
Variables may be sent to the screen using the format, variable=. For example, V1= , returns the value of the
variable V1. V1=? or MG V1 are also valid ways of displaying a variable.
Operands
Operands allow status parameters of the RIO to be incorporated into programmable variables and
expressions. Most RIO commands have an equivalent operand - which are designated by adding an
underscore (_) prior to the command (see command reference).
Examples of Internal Variables:
IN1=@IN[1]
Assigns value of input 1 to the variable IN1.
JP #LOOP,@AN[0]<2
Jump to #LOOP if analog input 0 is less than 2
JP #ERROR,_TC=1
Jump to #ERROR if the error code equals 1.
Operands can be used in an expression and assigned to a programmable variable, but they cannot be assigned
a value. For example: _TI0=1 is invalid.
RIO-47xxx
Chapter 5 Programming
●
65