PROGRAM CLEAR : REM Clear out any variables dimensioned DIM LV(2) : REM Dimension 2 Long Variables DIM DA(1) : REM Dimension 1 Double Array DIM $V(1,10) : REM Dimension 1 String Variable of length 10 'Go to SUBROUTINE Teach GOSUB Teach END _Teach RES X : REM Reset position to zero DRIVE OFF X : REM DISABLE DRIVE, teach points by manually move motor. 'Start of InputPoints Routine _InputPoints 'Print to the terminal "points to teach" and stores value into String Variable 0 INPUT; "Enter number of points to teach (value must greater than 0) = "; $V0 'Stores the Value of String Variable 0 into Long Variable 1 LV1 = VAL($V0) PRINT "" PRINT LV1 'If Statement to check if value entered is correct IF (LV1<=0) PRINT "ENTERED VALUE IS NOT VALID "; $V0 PRINT "Value must be a number greater than 0" GOTO InputPoints ENDIF DIM DA0(LV1) : REM dimension array equal to number of points to teach 'use input 24 to tell controller to collect a teach point 'FOR/TO/STEP/NEXT loop to teach points into array FOR LV0 = 0 TO (LV1-1) STEP 1 PRINT "TURN MOTOR, THEN HIT INPUT 24 TO TEACH POINT" INH 24 : REM Inhibits the program until Input 24 is pressed DA0(LV0)=P12290/P12375 : REM Stores Double Array entry with Encoder Positive divide by PPU of Axis0 INH -24 : REM Waits for Input 24 to turn off NEXT PRINT "Teach Completed, Total Points Taught = ";LV1 PRINT "Press Input 24 to enable drives and move to zero/start position " INH 24 INH -24 DRIVE ON X : REM Enable Axis0 "X" DWL 0.5 X0 : REM Moves to Zero Position INH -516 : REM Waits for Motion to be completed PRINT "Input 24 to run taught points" INH 24 'FOR/TO/STEP/NEXT loop to make absolute moves to position taught FOR LV0=0 TO (LV1-1) STEP 1 X(DA0(LV0)) INH -516 PRINT DA0(LV0) : REM Print to terminal the Position it move to. NEXT RETURN ENDP