DC Motor Interfacing with 8051 Microcontroller - CodesExplorer
DC Motor Interfacing with 8051 Microcontroller
Fig 1 DC MotorThis Code is specially developed for ALS 8051 Evaluation Board. |
In this article we will be just rotating DC MotorDC Motor will be connected to any one of the Ports. In our case we will be connecting it to PORT0 .To be more specific P0^6 or P0^7.
In ALS 8051 Evaluation Board we can connect two DC Motors.
Lets See the code Now.....
CODE:
// DC MOTOR INTERFACING USING 8051
//----------------------------------------------------------------
// CONTROLLER : 8051 AT89C51ED2
// Developed By : CodesExplorer
//----------------------------------------------------------------
#include <at89c51xd2.h >
sbit dc1=P0^6;
sbit dc2=P0^7;
void delay();
void main()
{
while(1)
{
dc1=1;
delay();
dc1=0;
delay();
}
}
void delay()
{
unsigned int i,j;
for(i=0;i<500;i++)
{
for(j=0;j<10;j++);
}
}
No comments: