Controlling of Stepper Motor rotation in both direction using 8051 Microcontroller

DISCRIPTION:- 

Stepper motors consist of a permanent magnet rotating shaft, called the rotor, and electromagnets on the stationary portion that surrounds the motor, called the stator.  illustrates one complete rotation of a stepper motor. At position 1, we can see that the rotor is beginning at the upper electromagnet, which is currently active (has voltage applied to it). To move the rotor clockwise (CW), the upper electromagnet is deactivated and the right electromagnet is activated, causing the rotor to move 90 degrees CW, aligning itself with the active magnet. This process is repeated in the same manner at the south and west electromagnets until we once again reach the starting position

 

CIRCUIT DIAGRAM:-

CODE:-

#include<reg51.h>
sbit sw=P2^5;
void delay(unsigned int a)
{
unsigned int i,j;
for(i=0;i<a;i++)
for(j=0;j<1275;j++);
}
void main()
{
P2=0XFF;
while(1)
{
if(sw==1)
{
P1=0X66;
delay(100);
P1=0XCC;
delay(100);
P1=0X99;
delay(100);
P1=0X33;
delay(100);
}
else
{
P1=0X66;
delay(100);
P1=0X33;
delay(100);
P1=0X99;
delay(100);
P1=0XCC;
delay(100);
}
}
}

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s