15
SAMPLE #1 (PROGRAM SAMPLE1.BAS ON THE CLCI2000 DISK)
This is a sample program written for a single axis. If Input #1 is active, then the motor will move in the
clockwise direction 5000 steps. If input #2 is active then the motor will move in the counterclockwise direction
4000 steps. It continues this loop indefinitely.
'PROGRAM FOR QUICKBASIC OR 'VISUALBASIC USING CLCISUB1.BAS
DECLARE ()... 'this representation is for all the declare statements
ADDR = &H300 'sets up the variable for the board address
AXIS = 1 'sets up the variable for axis 1
INITIALIZE ADDR,AXIS 'initializes axis1
MOTION ADDR,AXIS,500,10000,230000 'sets up the base speed, max
'speed, and ramp values
TOP.OF.LOOP:
IF GET.INPUT(ADDR,1) = 1 THEN 'looks at input #1
INDEX ADDR,AXIS,5000 'sets up the index number
GO.CW ADDR,AXIS 'indexes the motor
WAIT.FOR.STOP ADDR,AXIS 'waits until the motor has stopped
END IF
IF GET.INPUT.2 = 1 THEN 'looks at input #2
INDEX ADDR,AXIS,4000 'sets up the index number
GO.CCW ADDR,AXIS 'indexes the motor
WAIT.FOR.STOP ADDR,AXIS 'waits until the motor has stopped
END IF
GOTO TOP.OF.LOOP