EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Replies / /*motor.c*//*try this out ,

/*motor.c*//*try this out ,

|

Microcontroller › 8051 › L293D interfacing with 8051 › /*motor.c*//*try this out ,

March 25, 2013 at 6:25 am #9369
Arjun Vaghani
Participant

/*motor.c*/

/*try this out , it’s very simple*/

/*LCD is not necessary for L293D’s interfacing with AT89S52, So i have not given, but u can add that code separately*/

 

/*program-start*/

 

#include<reg51.h>
main()
{
while(1)
{
unsigned char t;
t=P1&0x0f;                             //read the data from port P1
switch(t)
{                                              /*block for taking action according to input*/
case 0x02:P2=0x85;            /*forward*/
 break;
case 0x04:P2=0x86;          /*left*/
 break;
case 0x06:P2=0x89;           /*right*/
 break;
case 0x08:P2=0x8A;        /*backward*/
 break;
case 0x05:P2=0x00;          /*stop*/
 break;
case 0x00:P2=0x00;       /*no input*/
 break;
}
}
}
 

/*In Diagram Shown Below, by Configuring Port P1 for Different Input Combinations , U can get the Action Performed by the DC Motor, i.e Desired Motion.*/

 

wysiwyg_imageupload:7864:

 

RSS Recent Posts

  • Sump pit water alarm - Kicad 9 July 18, 2025
  • Pic18f25q10 osccon1 settings swordfish basic July 17, 2025
  • Anyone jumped from Easyeda std to Easyeda pro? July 17, 2025
  • turbo jet fan - feedback appreciated. July 17, 2025
  • More fun with ws2812 this time XC8 and CLC July 17, 2025

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise