Stepper Motor Interfacing with uC
Most of the people confused between stepper motors and DC Motors. the main difference of DC and Stepper motor are following .
NOW WE INTERFACE THE STEPPER MOTOR WITH MICRO-CONTROLLER AT89C52
A stepper motor (or step motor) is a brushless DC electric motor that divides a full rotation into a number of equal steps. The motor's position can then be commanded to move and hold at one of these steps without any feedback sensor (an open-loop controller), as long as the motor is carefully sized to the application.
Switched reluctance motors are very large stepping motors with a reduced pole count, and generally are closed-loop commutated.
FOR MORE THEORY USE THIS LINK
http://en.wikipedia.org/wiki/Stepper_motor
programming:
#include<reg51.h>
sbit forw=P1^0;
sbit revr=P1^1;
void delay(unsigned int value);
void main()
{
P1=0Xff;
P2=0x00;
while(1)
{
if(forw==0)
{
P2=0x01; // 0000 0001
delay(10);
P2=0x02; // 0000 0010 // wave sequence
delay(10);
P2=0x04; // 0000 0100
delay(10);
P2=0x08; // 0000 1000
delay(10);
}
if(revr==0)
{ P2=0x08; // 0000 0001
delay(10);
P2=0x04; // 0000 0010 // wave sequence
delay(10);
P2=0x02; // 0000 0100
delay(10);
P2=0x01; // 0000 1000
delay(10);
}
}
}
void delay(unsigned int value)
{
unsigned int i,j;
for(i=0;i<1275;i++)
for(j=0;j<value;j++);
}