{\rtf1\animaticsfile\ansi\ansicpg1252\deff0\deftab720{\fonttbl{\f0\fswiss MS Sans Serif;}{\f1\froman\fcharset2 Symbol;}{\f2\fmodern\fprq1 Courier New;}} {\colortbl\red0\green0\blue0;\red255\green255\blue255;\red0\green255\blue255;\red255\green0\blue128;}{\info{\subject }{\author }{\keywords }{\doccomm }} \deflang1033\pard\plain\f2\fs16\cf3 END \par \par C0\tab \tab \tab \tab \plain\f2\fs16\cf2 'routine label, call for routine with GOTO0\plain\f2\fs16\cf3 \par MP\tab \tab \tab \tab \plain\f2\fs16\cf2 'call for this routine after the motor is stopped\plain\f2\fs16\cf3 \par \plain\f2\fs16\cf1 p=\plain\f2\fs16\cf3 @P\tab \tab \tab \tab \plain\f2\fs16\cf2 'capture stopped position\plain\f2\fs16\cf3 \par \plain\f2\fs16\cf1 pp=p/8000\tab \tab \tab \plain\f2\fs16\cf2 'find how many rev went by for 1 rev is 8000 counts\plain\f2\fs16\cf1 \par q=pp*8000\tab \tab \tab \plain\f2\fs16\cf2 'find the two home position within 1 rev \plain\f2\fs16\cf1 \par pp=pp+1\tab \tab \tab \plain\f2\fs16\cf2 'either cw or ccw\plain\f2\fs16\cf1 \par qq=pp*8000 \par qqq=q+qq \par qqq=qqq/2 \par \plain\f2\fs16\cf3 IF \plain\f2\fs16\cf1 p<=qqq \par \tab \plain\f2\fs16\cf3 P\plain\f2\fs16\cf1 =q \par \plain\f2\fs16\cf3 ELSEIF \plain\f2\fs16\cf1 p>qqq \par \tab \plain\f2\fs16\cf3 P\plain\f2\fs16\cf1 =qq \par \plain\f2\fs16\cf3 ENDIF \par G \par TWAIT \par END\plain\f2\fs16\cf1 \par }