102
•
Chapter 7 Application Programming
DMC-1500
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.
Instruction Interpretation
#JOYSTIK Label
JG 0,0
Set in Jog mode
BGXY Begin
Motion
#LOOP Loop
VX=@AN[1]*20000
Read joystick X
VY=@AN[2]*20000
Read joystick Y
JG VX,VY
Jog at variable VX,VY
JP#LOOP Repeat
EN End
Operands
Operands allow motion or status parameters of the DMC-1500 to be incorporated into programmable
variables and expressions. An operand contains data and must be used in a valid expression or
function. Most DMC-1500 commands have an equivalent operand - which are designated by adding
an underscore (_) prior to the DMC-1500 command. Commands which have an associated operand
are listed in the Command Reference as "Used as an Operand" .. Yes.
Status commands such as Tell Position return actual values, whereas action commands such as GN or
SP return the values in the DMC-1500 registers. The axis designation is required following the
command.
Examples of Operand Usage
POSX=_TPX
Assigns value from Tell Position X to the variable POSX.
GAIN=_GNZ*2
Assigns value from GNZ multiplied by two to variable, GAIN.
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: _GNX=2 is invalid.
The value of an operand can be output to the computer with the message command, MG. IE. MG
_TEX sends the current position error value on axis X to the computer.
Содержание DMC-1510
Страница 6: ......
Страница 18: ...6 Chapter 1 Overview DMC 1500 THIS PAGE LEFT BLANK INTENTIONALLY...
Страница 88: ...76 Chapter 6 Programming Motion DMC 1500 Figure 6 7 Motion intervals in the Home sequence...
Страница 90: ...78 Chapter 6 Programming Motion DMC 1500 THIS PAGE LEFT BLANK INTENTIONALLY...
Страница 137: ...DMC 1500 Chapter 7 Application Programming 125 THIS PAGE LEFT BLANK INTENTIONALLY...
Страница 157: ...DMC 1500 Chapter 10 Theory of Operation 145 THIS PAGE LEFT BLANK INTENTIONALLY...
Страница 160: ...148 Appendices DMC 1500 Card Level Layout...
Страница 178: ...166 Appendices DMC 1500 ICM 1100 Drawing 1 3 4 0 0 4 4 0 2 4 0 7 0 0 4 5 3 7 0 5 7 0 2 8 5 1 0 0 1 0 1 0 7 0 1 0 0...
Страница 180: ...168 Appendices DMC 1500...
Страница 198: ...186 Appendices DMC 1500 THIS PAGE LEFT BLANK INTENTIONALLY...