Results 1 to 1 of 1

Thread: Q: DIY Motion Contoller for Gecko

  1. #1
    Registered
    Join Date
    Sep 2004
    Location
    USA
    Posts
    412
    Downloads
    0
    Uploads
    0

    Q: DIY Motion Contoller for Gecko

    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.

    //Constants
    STEPS_PER_INCH_X = 100
    STEPS_PER_INCH_Y = 100
    PULSE_WIDTH = 2us

    //Variables
    Current_X = 0
    Destination_X = 2

    StepsNeeded = DifferenceCurrentandDestination(Current_X, Destination_X);

    //If value is negative, set direction negative
    if (DirectionNegative)
    {
    Dir_Pin_X = Low;
    }
    else
    {
    Dir_Pin_X = High;
    }

    for (int i = 1; i <= StepsNeeded; i++)
    {
    Step_Pin_X = High;
    thread.sleep(PULSE_WIDTH);
    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;
    else
    {
    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;
    else
    {
    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?

    Thanks,
    Last edited by Deviant; 12-10-2011 at 08:58 PM. Reason: Typo's


Similar Threads

  1. Anilam 1400M contoller
    By wes111 in forum General CNC (Mill and Lathe) Control Software (NC)
    Replies: 1
    Last Post: 02-16-2012, 09:57 AM
  2. Contoller PC
    By oknups in forum Tormach Personal CNC Mill
    Replies: 14
    Last Post: 02-03-2012, 05:45 PM
  3. Replies: 2
    Last Post: 07-10-2010, 10:26 PM
  4. L298/L297 contoller need help
    By sixpence in forum General Electronics Discussion
    Replies: 4
    Last Post: 04-29-2007, 10:11 AM
  5. anilam contoller
    By barnesy in forum General CNC (Mill and Lathe) Control Software (NC)
    Replies: 9
    Last Post: 06-29-2006, 05:30 PM

Posting Permissions


 


About CNCzone.com

    We are the largest and most active discussion forum from DIY CNC Machines to the Cad/Cam software to run them. The site is 100% free to join and use, so join today!

Follow us on

Facebook Dribbble RSS Feed


Search Engine Friendly URLs by vBSEO ©2011, Crawlability, Inc.