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.
Example - Using Variables for Joystick
The example below reads the voltage of an X-Y joystick and assigns it to variables vX and vY to drive the motors at
proportional velocities, where:
10 Volts = 3000 rpm = 200000 c/sec
Speed/Analog input = 200000/10 = 20000
#JOYSTIK
Label
JG 0,0
Set in Jog mode
BGXY
Begin Motion
AT0
Set AT time reference
#LOOP
Loop
vX=@AN[1]*20000
Read joystick X
vY=@AN[2]*20000
Read joystick Y
JG vX,vY
Jog at variable vX,vY
AT-4
Wait 4ms from last time reference, creates a deterministic loop time
JP#LOOP
Repeat
EN
End
Operands
Operands allow motion or status parameters of the DMC-42x0 to be incorporated into programmable variables and
expressions. Most DMC commands have an equivalent operand - which are designated by adding an underscore
(_) prior to the DMC-42x0 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 in the DMC-42x0 registers. The axis designation is required following the command.
Examples of Internal Variables:
posX=_TPX
Assigns value from Tell Position X to the variable posX.
deriv=_KDZ*2
Assigns value from KDZ multiplied by two to variable, deriv.
JP #LOOP,_TEX>5
Jump to #LOOP if the position error of X 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: _KDX=2 is invalid.
Special Operands (Keywords)
The DMC-42x0 provides a few additional operands which give access to internal variables that are not accessible by
standard DMC-42x0 commands.
Chapter 7 Application Programming ▫ 125
DMC-42x0 User Manual
Содержание DMC-42 0 Series
Страница 85: ...Chapter 6 Programming Motion 81 DMC 42x0 User Manual Figure 6 14 ECAM cycle with Z axis as master...
Страница 195: ...ICM 2900 PCB Layout Appendices 191 DMC 42x0 User Manual...
Страница 205: ...CB 50 100 Drawings Appendices 201 DMC 42x0 User Manual...
Страница 206: ...Appendices 202 DMC 42x0 User Manual...
Страница 207: ...Appendices 203 DMC 42x0 User Manual...
Страница 208: ...Appendices 204 DMC 42x0 User Manual...
Страница 209: ...Appendices 205 DMC 42x0 User Manual...
Страница 210: ...Appendices 206 DMC 42x0 User Manual...
Страница 211: ...Appendices 207 DMC 42x0 User Manual...
Страница 214: ...CB 50 80 Drawing Appendices 210 DMC 42x0 User Manual...
Страница 215: ...Appendices 211 DMC 42x0 User Manual...