Connect with us

Stepper Motor Control

Discussion in 'Sensors and Actuators' started by becca23, Apr 11, 2010.

Scroll to continue with content
  1. becca23


    Apr 11, 2010
    I need some help with debugging a unipolar stepper motor I am using a PIC24 and a ULN2003A chip to drive the motor. It seems to have no problem moving forward, but only twitches when I attempt to go backward.

    This is the half-step sequence I am using:
    uint8 coil1Seq[8] = {1,1,1,0,0,0,0,0};
    uint8 coil2Seq[8] = {0,0,0,0,1,1,1,0};
    uint8 coil3Seq[8] = {1,0,0,0,0,0,1,1};
    uint8 coil4Seq[8] = {0,0,1,1,1,0,0,0};

    The logic I am using is to move a certain number of steps, a for loop increments through this array and assigns these values to the pins. To go backwards, it decrements from the last position it was in the array. Is this correct?
  2. 55pilot


    Feb 23, 2010
    Could it be that there is a code bug and you are not indexing correctly when you are decrementing? Are you just ANDing the decremented value with 7 or are you doing compares? If you are just ANDing, could it be that you are using some over-protective compiler that prevents you from decrementing past 0 in violation of C language specifications?

    Is your step/coil sequence correct? It is possible that an incorrect coil sequence may work in one direction, but not in the other?

Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day