1. Stepper Motor Interfacing with 89C51
Dr.M.Sugadev,M.Tech,Ph.D
Associate Professor
Department of ECE
Sathyabama Institute of Science and Technology
Chennai-600119
1
2. Stepper Motor
2
• Stepper motors are DC motors that move in discrete steps. They have
multiple coils that are organized in groups called "phases". By energizing
each phase in sequence, the motor will rotate, one step at a time.
9. C-Program for configuring individual Port pins
1
#include<reg51.h>
void delay(int x); //function declaration
sbit LED = P2^0; // assign name port pin
void main()
{
LED =0; // Configure Port 2.0 as output port
while(1)
{
LED=1;
delay(5000); // Call delay function
LED=0;
delay(5000); // Call delay function
}
}
void delay(x)
{
unsigned int i,j;
for(i=0;i<x;i++);
for(j=0;j<x;j++);
}
11. C-Program for reading a switch and controlling
Leds
1
#include<reg51.h>
sbit LED = P2^0;
sbit SW = P2^5;
void main()
{
SW = 1; // Configure Port 2.5 as input port
LED =0; // Configure Port 2.0 as output port
while(1)
{
if (SW==0)
LED=1;
else
LED=0;
}
}