Galil DMC-3425 Home Security System User Manual


 
DMC-3425 Chapter 2 Getting Started 35
SP 5000 Set speed
BGA Start motion
AD 4000 Wait until A moved 4000
TPA Tell position
EN End program
To start the program, command:
XQ #B Execute Program #B
Example 12 - Control Variables
Objective: To show how control variables may be utilized.
Instruction
Interpretation
#A;DP0 Label; Define current position as zero
PR 4000 Initial position
SP 2000 Set speed
BGA Move
AMA Wait until move is complete
WT 500 Wait 500 ms
#B
V1 = _TP Determine distance to zero
PR –V1/2 Command move 1/2 the distance
BGA Start motion
AMA After motion
WT 500 Wait 500 ms
V1= Report the value of V1
JP #C, V1=0 Exit if position=0
JP #B Repeat otherwise
#C;EN End
To start the program, command
XQ #A Execute Program #A
This program moves the motor to an initial position of 4000 and returns it to zero on increments of half
the distance. Note, _TP is an internal variable that returns the value of the position. Internal variables
may be created by preceding a DMC-3425 instruction with an underscore, _.
Example 13 - Control Variables and Offset
Objective: Illustrate the use of variables in iterative loops and use of multiple instructions on one line.
Instruction
Interpretation
#A Set initial values
KI0
DP0
V1=8; V2=0 Initializing variables to be used by program
#B Program label #B
OF V1 Set offset value
WT 200 Wait 200 msec