help with stepper motor

Discussion in 'Embedded Systems and Microcontrollers' started by eessoo, Feb 14, 2012.

  1. eessoo

    Thread Starter New Member

    Jan 29, 2012
    23
    0
    is there a way to control stepper motor and make it do 189 step?! :D
    step = 1.9°
    i want it to make full rotation
    i can make it do a full rotation with 45° step
    Code ( (Unknown Language)):
    1.  
    2. int hstep[]={1,3,2,6,4,12,9,8,1};
    3. int x,i;
    4. void main()
    5. {trisb=0;
    6. portb=0;
    7. trisd=1;
    8. while(1)
    9. {if(portd.b0==1)
    10.                 {x++;
    11.                 switch(x)
    12.                 {case 1:
    13.                 for(i=0;i<=190;i++)
    14.                 {portb=hstep[i];
    15.                 delay_ms(200);
    16.                 }
    17.                  break;
    18.                  case 2:
    19.                 for(i=190;i>=0;i--)
    20.                 {portb=hstep[i];
    21.                 delay_ms(200);
    22.                 }
    23.                  break;
    24.                 }
    25.  
    26. }
    27. }
    28. }
    29. [/i][/i]
     
Loading...