Page 84 of 112
DMM-0200 Product User Guide
159 Swanson Road
Boxborough, MA 01719
Tel: 508-475-3400
Email: sales@dovermotion.com
Standalone Example Program 4 –Single Thread
Task: Move the motor back and forth between position 1000 and 0 only if the digital input 1 is turned on.
HSPD=20000 ;* Set the high speed to 20000 pulses/sec
LSPD=1000 ;* Set the low speed to 1000 pulses/sec
ACC=300 ;* Set the acceleration to 300 msec
EO=1 ;* Enable the motor power
WHILE 1=1 ;*Foreverloop
IF DI1=1 ;* If digital input 1 is on, execute the statements
X0 ;*Moveto zero
WAITX ;*Wait for X-axis move to complete
X1000 ;*Moveto 1000
WAITX ;*Wait for X-axis move to complete
ENDIF
ENDWHILE ;* Go back to WHILE statement
END
Standalone Example Program 5 –Single Thread
Task: Using a subroutine, increment the motor by 1000 whenever the DI1 rising edge is detected.
HSPD=20000 ;* Set the high speed to 20000 pulses/sec
LSPD=1000 ;* Set the low speed to 1000 pulses/sec
ACC=300 ;* Set the acceleration to 300 msec
EO=1 ;* Enable the motor power
V1=0 ;* Set variable 1to zero
WHILE 1=1 ;*Foreverloop
IF DI1=1 ;* If digital input 1 is on, execute the statements
GOSUB 1 ;*Movetozero
ENDIF
ENDWHILE ;* Go back to WHILE statement
END
SUB 1
XV1 ;*MovetoV1 targetposition
WAITX ;* Wait for X-axis move to complete
V1=V1+1000 ;* Increment V1 by 1000
WHILE DI1=1 ;* Wait until the DI1 is turned off so that
ENDWHILE ;* 1000 increment is not continuously done
ENDSUB
Standalone Example Program 6 –Single Thread
Task: If digital input 1 is on, move to position 1000. If digital input 2 is on, move to position 2000. If digital input 3 is on,
move to 3000. If digital input 5 is on, home the motor in negative direction. Use digital output 1 to indicate that the motor is
moving or not moving.
HSPD=20000 ;* Set the high speed to 20000 pulses/sec
LSPD=1000 ;* Set the low speed to 1000 pulses/sec
ACC=300 ;* Set the acceleration to 300 msec
EO=1 ;* Enable the motor power
WHILE 1=1 ;*Foreverloop