38
•
Chapter 7 Application Programming
CDS-3310
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 CDS-3310 function can be used to assign a value to a variable. For example,
V1=@ABS[v2] or v2=@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 which must be in quotation.
Instruction Interpretation
posA=_TPA
Assigns returned value from TPA command to variable posA
SPEED=5.75 Assigns
value
5.75 to variable SPEED
input=@IN[2] Assigns
logical
value
of input 2 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 Var
Assigning Variable Values to Controller Parameters
Variable values may be assigned to controller parameters such as KD or PR.
PR v1
Assign v1 to PR command
SP vS*2000
Assign vS*2000 to SP command
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.
Operands
Operands allow motion or status parameters of the CDS-3310 to be incorporated into programmable
variables and expressions. Most CDS-3310 commands have an equivalent operand which is
designated by adding an underscore (_) prior to the CDS-3310 command. The command reference
indicates which commands have an associated operand.
Status commands such as Tell Position return actual values, whereas action commands such as KP or
SP return the values stored in the CDS-3310 registers. The axis designation is required following the
command.
Instruction Interpretation
posA=_TPA
Assigns value from Tell Position A to the variable posA.
JP #LOOP,_TEA>5
Jump to #LOOP if the position error of A is greater than 5
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: _TPA=2 is invalid.
Common Operands
Operand Function
_BGn
*Returns a 1 if motion on axis ‘n’ is complete, otherwise returns 0.
_BN
*Returns serial # of the board.
Содержание CDS-3310
Страница 26: ...18 i Chapter 2 Getting Started CDS 3310 THIS PAGE LEFT PLANK INTENTIONALLY...
Страница 32: ...24 i Chapter 3 Connecting I O CDS 3310 THIS PAGE LEFT PLANK INTENTIONALLY...
Страница 124: ...CDS 3310 Chapter 8 Hardware Software Protection i 63 THIS PAGE LEFT PLANK INTENTIONALLY...
Страница 138: ...CDS 3310 Chapter 10 Theory of Operation i 77 THIS PAGE LEFT BLANK INTENTIONALLY...