I've had pretty good success with my 320s and mach3, but I'm working on something that needs to be more self-contained than a full pc setup. I'd like to use steppers and the G250X or G203V on this project.
I was debating on using on the new 32bit micro controllers that runs the .net micro frame work, which would have a SD card for file, a stop button and a go button. All I need to do is move, I don't need to do any creative tool offset calculations. My questions have to do with how the geckos and motion controllers work. For the geckos, I believe I need to set the direction by making the pin high or low, then I need to send a step pulse(s).
From what I can see, there would be at least two ways to do this. I could send high signal, wait 2 uS, send low signal, and then loop for total number of steps until the required number of steps is reached.
So in simple pseudo example.
STEPS_PER_INCH_X = 100
STEPS_PER_INCH_Y = 100
PULSE_WIDTH = 2us
Current_X = 0
Destination_X = 2
StepsNeeded = DifferenceCurrentandDestination(Current_X, Destination_X);
//If value is negative, set direction negative
Dir_Pin_X = Low;
Dir_Pin_X = High;
for (int i = 1; i <= StepsNeeded; i++)
Step_Pin_X = High;
Step_Pin_X = Low;
Or, would I use a PWM feature, that's turned off when a certain amount of time has passed?
loop = true
while (loop = true)
X_Time = FindTimeNeededToMove(Current_X, Destination_X);
Dir_Pin_X = FindDirectionNeededToMove(Current_X, Destination_X);
if (X_Time > 0)
PWM_Pin_X = On;
PWM_Pin_X = Off;
Y_Time = FindTimeNeededToMove(Current_X, Destination_X);
Dir_Pin_Y = FindDirectionNeededToMove(Current_X, Destination_X);
if (Y_Time > 0)
PWM_Pin_Y = On;
PWM_Pin_Y = Off;
Looping constantly to generate the mock PWM is processor intensive, but it appears to be more accurate than a time based system. My concern with the mock PWM is with the clock time required to calculate the pulses. If I use a single micro controller, I don't believe it will be able to move more than one axis with the current mock code.
The time based system has an advantage there, I could calculate the time needed for each axis to travel the required distances and turn the PWM off as they meet the destination requirement. I'm concerned that the time based system may not cycle fast enough to turn the PWM off before it's exceeded the travel distance.
Or do I have it completely wrong and it works some other way entirely?
Last edited by Deviant; 12-10-2011 at 08:58 PM. Reason: Typo's