14.01.2015 Views

Gemini GV6K and Gemini GT6K Programmer's Guide

Gemini GV6K and Gemini GT6K Programmer's Guide

Gemini GV6K and Gemini GT6K Programmer's Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Step 2<br />

Define the SETUP Subroutine. The SETUP subroutine need only run once.<br />

DEF SETUP<br />

1INFNC1-M<br />

JOYVH3<br />

JOYAXH1-9<br />

VAR1=Ø<br />

VAR2=Ø<br />

DRIVE1<br />

MA1<br />

END<br />

; Begin definition of the subroutine called SETUP<br />

; Assign digital input 1 on SIM 2 (I/O point #1) of<br />

; I/O brick 1 to function as a "Joystick Release" input.<br />

; Set the maximum velocity (3 units/sec)<br />

; achievable when the joystick is at full<br />

; deflection<br />

; Assign ANI input 1 on SIM 2 (I/O point #9) of I/O<br />

; brick 1<br />

; Initialize variable #1 equal to zero<br />

; Initialize variable #2 equal to zero<br />

; Enable the drive<br />

; Enable the absolute positioning mode<br />

; End definition of the subroutine called SETUP<br />

Step 3<br />

Define the TEACH Subroutine.<br />

DEF TEACH ; Begin definition of the subroutine called TEACH<br />

HOM1<br />

; Home the axis (absolute position counter is set to<br />

; zero after the homing move)<br />

DATPTR1,1,1 ; Select data program #1 (DATP1) as the current active<br />

; data program, <strong>and</strong> move the data pointer to the first<br />

; data element. After each DATTCH value is stored to<br />

; DATP1, increment the data pointer by 1 data element.<br />

REPEAT<br />

; Set up a repeat/until loop<br />

JOY1<br />

; Enable joystick mode. At this point,<br />

; you can start moving into position with the<br />

; joystick. WHILE USING THE JOYSTICK, COMMAND PROCESSING<br />

; IS STOPPED HERE UNTIL YOU ACTIVATE THE JOYSTICK<br />

; RELEASE INPUT. Activating the joystick release input<br />

; disables the joystick mode <strong>and</strong> allows the subsequent<br />

; comm<strong>and</strong>s to be executed (assign the current positions<br />

; to the variables <strong>and</strong> then store the positions in the<br />

; data program).<br />

VAR1=1PM ; Set variable #1 equal to the position of motor 1<br />

DATTCH1 ; Store variable #1. (The first time through the<br />

; repeat/until loop, variable #1 is stored into data ;<br />

;element #1. The data pointer is automatically<br />

; incremented once after each data element <strong>and</strong> ends up<br />

;pointing to the third data element in anticipation of<br />

;the next DATTCH comm<strong>and</strong>.)<br />

WAIT(1IN.1=b1) ; Wait for the joystick release input to be de-activated<br />

UNTIL(DPTR=1) ; Repeat the loop until the data pointer wraps around<br />

; to data element #1 (data program full)<br />

END<br />

; End definition of the subroutine called TEACH<br />

Chapter 3. Basic Operation Setup 113

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!