Installation guide
286 Application Examples
************************* EXAMPLE PROGRAM ********************************
‘***** This example program allows a two axis arbitrary path Pattern to be taught, executed or printed.
‘***** Event 1 input, toggle switch, on axis 1 selects the Teach mode.
‘***** Event 2 input, momentary switch, on axis 1 prints the resulting program.
‘***** Event 1 input, momentary switch, on axis 2 registers the pattern points.
‘***** Event 2 input, toggle switch, executes the taught pattern.
‘***** NVR(1-2) is the x-y coordinates for the starting position of the pattern
‘***** NVR(3) is the ending element of the point array
‘***** NVR(4-5) is the first coordinate points of the Pattern
‘***** each additional set of points are in pairs
#DEFINE AX1 1 ‘x axis defined
#DEFINE AX2 2 ‘y axis defined
#DEFINE DCNT 10 ‘input debounce count (msec)
POSMODE(AX1,AX2)=1,1 ‘set absolute position mode
MOVEHOME(AX1,AX2)= -1, -1  ‘GOTO Mechanical Home in -direction
WAITDONE(AX1,AX2) ‘wait until mechanical cycle complete
E1_1=0 ‘initialize variable state
E1_2=0 ‘initialize variable state
E2_1=0 ‘initialize variable state
E2_2=0 ‘initialize variable state
SPEED=10,10 ‘joystick speed for 10 volt differential voltage
DO
state=0
PRINT#1,”Select Teach Program, Print Program or Execute Program”
DO
GOSUB debounce_E1_1 ‘test Teach input
GOSUB debounce_E2_1 ‘test Print input
GOSUB debounce_E2_2 ‘test Execute input
IF E1_1=1 THEN
GOSUB teach ‘Teach input true
state=1
ELSE IF E2_1=1 THEN
GOSUB prt_program ‘Print input true
state=1
ELSE IF E2_2=1 THEN
state=1 ‘Execute input true
END IF
LOOP UNTIL state=1 ‘wait for an input being true
LOOP UNTIL E2_2=1 ‘wait for Execute input being true
IF NVR(3) > 700 then ‘prevents operating system crash
END
END IF
‘***** Execute Program and End
MOVE(AX1,AX2)=NVR(1),NVR(2) ‘goto starting position of pattern
WAITDONE(AX1,AX2) ‘wait until at starting position
element=4 ‘starting element for points
PATH=AX1,AX2 ‘define path axes
DO WHILE element < NVR(3)
POINT=NVR(element), NVR(element + 1)
element = element + 2
LOOP
PATH END
END










