Now I can show you "How to Interface Stepper motor with 8051 micro-controller using some logic's Click here to see the logic's. I miss two logic's on that link I will give below.
These two logic's are also used when the driver is used.Lets go the programming shown in given below
#include<reg51.h>
sbit w = P2^0;
sbit x = P2^1; // Motor pins assigned to port 2
sbit y = P2^2;
sbit z = P2^3;
sbit H = P1^0; // Home switch is connected to port 1, pin-0
sbit R_45 = P1^2; // Rotate_45 switch is connected to port 1, pin-2
sbit R_90 = P1^4; // Rotate_90 switch is connected to port 1, pin-4
sbit R_135 = P1^6; // Rotate_135 switch is connected to port 1, pin-6
sbit R_180 = P1^7; // Rotate_180 switch is connected to port 1, pin-7
void Home() // Motor "Home" function (Starting stage)
{
w = 0;
x = 1;
y = 0;
z = 1;
}
void Rotate_45() // Motor "Rotate 45 degree" function
{
w = 0;
x = 1;
y = 0;
z = 0;
}
void Rotate_90() // Motor "Rotate 90 deg" function
{
w = 1;
x = 1;
y = 0;
z = 0;
}
void Rotate_135() // Motor "Rotate 135 deg" function
{
w = 1;
x = 1;
y = 1;
z = 0;
}
void Rotate_180() // Motor "Rotate 180 degree" function
{
w = 1;
x = 0;
y = 1;
z = 0;
}
void main() // Main function
{
H = 0; // Initialize all switches to zero
R_45 = 0;
R_90= 0;
R_135 = 0;
R_180 = 0;
while(1)
{
if(H==1)
Home();
else if(R_45==1)
Rotate_45();
else if(R_90==1)
Rotate_90();
else if(R_135==1)
Rotate_135();
else if(R_180==1)
Rotate_180();
else
Home();
}
}
Copy this program into Keil software and create hex file. Next do the same hardware connections as shown in below using Proteus software.
If you want detailed description see the below video. See you soon with future updates.