[Coco] leading to that CNC Coco machine

George Ramsower georgeramsower at gmail.com
Mon Feb 4 20:35:35 EST 2008


----- Original Message ----- 
From: "George Ramsower"

> Most of the inaccuracy in the total length is because of the way I was 
> doing the math when I move it in such a way that leaves fractions of steps 
> and those steps were getting out of sync with the real position and the 
> cheap lead screws which are nothing more than "all thread rods".  So, I'm 
> working on converting actual, desired positions and then converting that 
> number to the stepping of the motors to get to that point. This will help, 
> but will not compensate for the threaded rods.


 Okay. The way I finally fixed this problem with accumilating errors was to 
use simple addition to a REAL variable that adds the positive and negative 
move requests to the axis. Then I simply convert the actual desired inch 
position to a number that relates to the stepper motor position.
 The current stepper motor position is stored in another REAL variable.
 So, If the stepper motor isn't where it is wanted to be, the routine just 
moves it until it matches the desire position.

 Any errors with fractions are eliminated and the axis always goes where it 
is supposed to.


The following is just a testing routine to work out these little problems. 
It's not pretty but I'm getting the problems worked out with it. This 
routing moves the Z axis and nothing else.

PROCEDURE zinches
DIM zstep(8):BYTE
DIM answer:STRING
DIM stepz,z,inchz,posz:REAL
BASE 1 \ POKE $FF60,0
inch=12816 \inchz=0
FOR x=1 TO 8 \ READ zstep(x) \NEXT x
DATA 1,3,2,6,4,12,8,9
x=1
10 (* ------------------------------ Start Here
inchz=0
posz=0
PRINT "Zpos - "; posz
20 (* ------------------------------ Loop begins
POKE $FF62,0
PRINT "inchz = "; inchz
PRINT "Stepper should be at "; inchz*inch
PRINT "Stepper is at "; posz
INPUT " Move (use - to go away from home) ",answer
inchz=inchz+VAL(answer)
stepz=inchz*inch
IF stepz>posz THEN GOSUB 100 \ ENDIF
IF stepz<posz THEN GOSUB 200 \ ENDIF
GOTO 20
(* ---------------------------- End Here
END
100 (* ----------------------------- stepping PLUS
WHILE stepz>posz DO
z=z+1 \ IF z>8 THEN z=1 \ ENDIF
POKE $FF62,zstep(z) \posz=posz+1
ENDWHILE
RETURN
200 (* ------------------------------ Stepping Minus
WHILE stepz<posz DO
z=z-1 \ IF z<1 THEN z=8 \ ENDIF
POKE $FF62,zstep(z) \posz=posz-1
ENDWHILE
RETURN



George 




More information about the Coco mailing list