Thursday, 4 October 2012

DC motor interfacing with 8051

 DC motor:


CODE:

#include <REGX52.H>
sbit s1=P1^0;
sbit s2=P1^1;

sbit m1=P2^0;
sbit m2=P2^1;
sbit m3=P2^2;
sbit m4=P2^3;

void main()
{
   P1=0x00;
   P2=0x00;
   while(1)
   {
    if(s1==0 && s2==0)
{
  m1=0;
  m2=0;
  m3=0;
  m4=0;
}
    if(s1==0 && s2==1)
{
  m1=0;
  m2=1;
  m3=0;
  m4=1;
}
if(s1==1 && s2==0)
{
  m1=1;
  m2=0;
  m3=1;
  m4=0;
}
if(s1==1 && s2==1)
{
  m1=0;
  m2=0;
  m3=0;
  m4=0;
}
 
   }
}

PROTEUS:




2 comments:

  1. Why my DC motor producing Jerks! not rotating! could you please help me from this.

    http://www.npeducations.com

    ReplyDelete
  2. Great tutorial on DC motor interfacing with the 8051 microcontroller! The step-by-step explanation makes it easy for beginners to understand motor control concepts and embedded system applications. Industrial automation is evolving rapidly, and robotic stacking and palletising systems are becoming essential for modern manufacturing. Readers interested in advanced automation and robotic solutions should also explore Automation Solutions & Robotics for innovative industrial robotics and smart factory systems.

    ReplyDelete