Galil DMC-3425 Home Security System User Manual


 
DMC-3425 Chapter 7 Application Programming 131
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
#JOYSTIK Label
JG 0,0 Set in Jog mode
BGAB Begin Motion
#LOOP Loop
VX=@AN[1]*20000 Read joystick A
VY=@AN[2]*20000 Read joystick B
JG VA,VB Jog at variable VA,VB
JP#LOOP Repeat
EN End
Operands
Operands allow motion or status parameters of the DMC-3425 to be incorporated into programmable
variables and expressions. Most DMC-3425 commands have an equivalent operand - which are
designated by adding an underscore (_) prior to the DMC-3425 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-3425 registers. The axis designation is required following the
command.
Instruction
Interpretation
POSA=_TPA Assigns value from Tell Position A to the variable POSA.
VAR1=_KPA*2 Assigns value from KPA multiplied by two to variable, VAR1.
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
The DMC-3425 provides a few additional operands that give access to internal variables that are not
accessible by standard DMC-3425 commands.
Operand Function
_BGn *Returns a 1 if motion on axis ‘n’ is complete, otherwise returns 0.
_BN *Returns serial # of the board.
_DA *Returns the number of arrays available
_DL *Returns the number of available labels for programming
_DM *Returns the available array memory