Ask Experts Questions for FREE Help !
Ask
    elex11's Avatar
    elex11 Posts: 1, Reputation: 1
    New Member
     
    #1

    May 18, 2010, 05:55 AM
    what should b the sequence for steppermotor frm PIC16F876A?
    I am using Fraen 6405-1512 stepper motor controlled by PIC16F876A (ULN2003A as driver along with transistors to form a H-bridge) to drive a pointer of a speedometer. I need to know about the sequence (if possible in C language) which should be given to the motor windings in order to have a smooth rotation. Till now, I have achieved the motion but it's not smooth nor have I got control over it's direction of rotation. The code I wrote is given below.

    the link for circuit diagram of PIC-motor interface is:
    http://farm5.static.flickr.com/4064/...2feddf86_b.jpg

    the link for datasheet and other details of motor is:
    http://www.fraenamd.com/steppermotor.htm

    If further details are required please let me know.

    code:
    #include<pic.h>

    int msec;

    #define wait 10

    interrupt void isr()
    {
    if (TMR2IF)
    {
    TMR2IF=0;
    msec++;
    }
    }

    void init_timer()
    {
    PIE1=0x02;
    PIR1=0x00;
    T2CON=0x06;
    PR2=0xFA; //count to generate 1ms delay, freq of crystal is 16Mhz
    INTCON=0xC0;
    }

    void delay( unsigned int n)
    {
    msec =0;
    init_timer();
    while (msec!=n);
    msec++;
    T2CON= 0x00;
    }


    void main()

    { TRISB = 0x00;

    while(1)

    {
    PORTB = 0x22; // A2 B2
    delay(wait); /* generates a delay of
    as many millisecs as the
    count in 'wait' variable */

    PORTB = 0x20; // A2
    delay(wait);

    PORTB = 0x24; // A2 A1
    delay(wait);

    PORTB = 0x04; // A1
    delay(wait);

    PORTB = 0x14; // A1 B2
    delay(wait);

    PORTB = 0x10; // B2
    delay(wait);

    PORTB = 0x12; // B2 B1
    delay(wait);

    PORTB = 0x02; // B1
    delay(wait);


    }

    }

    please help me out asap.
    KISS's Avatar
    KISS Posts: 12,510, Reputation: 839
    Uber Member
     
    #2

    May 18, 2010, 09:18 AM

    Mmmm. I lost most of my stepper info, but I don't see that interface resembling an H bridge at all.

    There seems to be no way to reverse the flow of current..

    4 H-bridge to work, you need 4 drivers for phase. You only have 4 total.

    That interface would be more suitable for a 6 wire stepper. Oddly a 24 V stepper would typically be used on a 12 V supply where the center tap is at 12V.

    You need to be able to put +5 and -5 V to both windings. I don't believe you can.

    Microstepping, where you use discrete values of current allows smoother transitions ad that's even more complicated.

    PS: I added URL tags to your post
    PPS: I believe after you're a member for a day, you can post pics directly using "Go advanced/Manage attachments"
    KISS's Avatar
    KISS Posts: 12,510, Reputation: 839
    Uber Member
     
    #3

    May 18, 2010, 09:24 AM

    Here is a document that might help:

    Stepper Motor Switching Sequence - Developer Zone - National Instruments

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Received my w2-c after I filed w2. What should I do next? [ 1 Answers ]

Hi, I have received a W2-C form. I have already filed w2. As per the w2-c form I have to get 800 more dollars. Should I submit 1040x along with W2-C or just the 1040x? Thanks, Anonymous

Husband cheating 7years. Should I leave and let them be together? [ 4 Answers ]

He has a sexual addiction and is apparently in love with this other person but will not leave home. She continues in an uncommitted relationship with him but has other male friends also. The moment we separate she and he continue to engage in more open relationships. His sister and mother are now...

I have a bump on ma Virginia and it hurts what should I do? [ 1 Answers ]

I have a bump on my outer vaginal area. It hurts but I know its not a std because I am a virgin.What can I do to help my situation?

When should I Propose? [ 18 Answers ]

Im 16 and wondering when is the right age to Propose!! Me and my girlfriend talk about getting married all the time but I want to know when will b the right time to actually pop the question?:confused:

What should I do now I have no one and nothing? [ 5 Answers ]

I'm 19 years old and my boyfriend broke up with me a week ago. It's a long story so please read on because I need your advice. We got together in February 2006 when we were both at school together, we had a fab relationship, very caring and fun. However when we went off to university in September...


View more questions Search