8051 interfacing with DC motor

8051 interfacing with DC motor



/*
developed by S4silver
license type - open source
created on - 11/12/2014
modified on - 11/14/2014
modification details - refactored
developer - Frank Hust Jincson
contact mail id - silverembeddedsolutions@gmail.com
web link - http://s4silver.blogspot.in/p/programmers-colony.html
*/


#include <REGX51.H>

sbit but1 = P1^0;
sbit but2 = P1^1;
sbit but3 = P1^2;
sbit but4 = P1^3;

void main()
{
 unsigned int i;
 P2=0x00;
 P1=0x0F;
 while(1)
 {
  if(!but1) P2=0x05; //fwd
  else if(!but2) P2=0x0A; //rev
  else if(!but3) P2=0x04; //left
  else if(!but4) P2=0x01; //right
  else P2=0x00; //stop
 }
}  






People who look for this also look for the below topics

blinking of led or port
8051 interfacing DC motor
8051 interfacing with keypad
8051 interfacing with LCD
8051 interfacing with LCD and display Counter
LCD sample program
serial communication (RS-232) in 8051(polling method)
serial with interrupt
how to print serial received data on LCD.
8051 interfacing STEPPER motor
how to use TIMER in 8051
8051 interfacing SEVEN SEGMENT display
Timers with interrupt concept
how to generate PWM in 8051
4 bit LCD interfacing with 8051
8051 Tuitorial
how to install python
Embedded Documents (sensors, protocol...etc)  
Special NEWS