Question on possible class for stepper motor
I've developed a unipolar stepper controller/driver circuit board, and it works great. Since I will be controlling two (2) stepper motors, the circuit I have set up is two (2) EDE1200's and a single ULN2803A. I slapped a couple resonators and a zener diode and the little bugger runs by itself. However, there is an option to not run by itself but rather by a clock (or similar) input.· Easy, right?· Well, in my case I want to determine how many 'pulses' are sent to my controller. This way I can calculate, via the Javelin, how far I've gone.
I thought first off to just make a move method and call it when ever i want to move one unit. (In my case, one cell length)
Do this by putting a CPU.pulseOut(2, stepperClkPin); in a for loop with well let me just code a bit....
Problem with this is that CPU.delay(<int>) halts everything.
This is bad because I hope to have stuff running in the background. (like sensors)
I hope some light can be shed on my dire position.
Many thanx to all noble posters.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Huey
Double Bachelor of Science
CPET - Computer Engineering Technologies
CIS - Computer Information Systems
MSU-Northern
Chair of MSU-Northern IEEE Student Branch
I thought first off to just make a move method and call it when ever i want to move one unit. (In my case, one cell length)
Do this by putting a CPU.pulseOut(2, stepperClkPin); in a for loop with well let me just code a bit....
public final int stepperClkPin = CPU.pin0;
public final int stepsPerCell = 234; //this is just a guess
public int speed = 5;//bigger number means slower movement
private void moveOneCell(){ for(int i=0; i<stepsPerCell; i++){ CPU.pulseOut(2, stepperClkPin); CPU.delay(speed); } }
Problem with this is that CPU.delay(<int>) halts everything.
This is bad because I hope to have stuff running in the background. (like sensors)
I hope some light can be shed on my dire position.
Many thanx to all noble posters.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Huey
Double Bachelor of Science
CPET - Computer Engineering Technologies
CIS - Computer Information Systems
MSU-Northern
Chair of MSU-Northern IEEE Student Branch
Comments
the foreground program until the delay is completed. This is also
true for pulseOut(), which only returns when the pulse has completed.
You can take a look at Freqout.java file (extended PWM class) that allows
you to generate a number of pulses for a·specified time. These pulses are generated
in the background via the PWM VP rather than pulseOut. Freqout also halts the
foreground program until all pulses are completed.
You can find the Freqout.java file in the ...\lib\stamp\core folder.
regards peter