Galil DMC-2X00 Projector User Manual


 
DMC-2X00 Chapter 7 Application Programming y 101
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 A-B joystick and assigns it to variables VA and VB to
drive the motors at proportional velocities, where
10 volts = 3000 rpm = 200000 c/sec
Speed/Analog input = 200000/10 = 20000
Instruction Interpretation
#JOYSTI
K
Label
JG 0,0 Set in Jog mode
BGAB Begin Motion
#LOOP Loop
va=@AN[1]*20000 Read joystick A
vb=@AN[2]*20000 Read joystick B
JG va,vb Jog at variable va,vb
JP#LOOP Repeat
EN En
d
Operands
Operands allow motion or status parameters of the DMC-2x00 to be incorporated into programmable
variables and expressions. Most DMC-2x00 commands have an equivalent operand - which are
designated by adding an underscore (_) prior to the DMC-2x00 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-2x00 registers. The axis designation is required following the
command.
Instruction Interpretation
p
osA=_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.
Special Operands (Keywords)
The DMC-2x00 provides a few additional operands which give access to internal variables that are not
accessible by standard DMC-2x00 commands.
Keyword Function
BGn *Returns a 1 if motion on axis ‘n’ is com
p
lete
,
otherwise returns 0.
BN *Returns serial # of the board.
DA *Returns the number of arra
y
s available
DL *Returns the number of available labels for
p
ro
g
rammin
g
DM *Returns the available arra
y
memor
y
HMn *Returns status of Home Switch
(
e
q
uals 0 or 1
)
LFn Returns status of Forward Limit switch in
p
ut of axis ‘n’
(
e
q
uals 0 or 1
)