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 / Topics / please help to interface servo with 8051 to increment the angle by 5 degree

please help to interface servo with 8051 to increment the angle by 5 degree

|

Microcontroller › 8051 › please help to interface servo with 8051 to increment the angle by 5 degree

  • This topic has 2 replies, 1 voice, and was last updated 12 years, 10 months ago by anik das.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • January 6, 2013 at 11:44 am #3849
    anik das
    Participant

     

    hallo guys
    I want to control a servo motor with 8051 microcontroller and to increment its angle by 5 degree and when its reach then after its get to 180 degree it will agian decrement its angle by 5 degree and reach to zero .
    in proteus simulation its not happenig and stucked to 90..
     
    i am attaching the proteus simulation where u can get the circuit[/COLOR] that i am using and i am aslo attaching the keil zip file where u can get the c code
     
    please guys help me
     
    u can also double click on the servo motor in proteus and make its maximum degree to 180 ..then it will get stuck to 180 degree 
    please anyone help me
     
    the actual project was here threaded in this site i just tried but stucked in it
     
    PLEASE HELP
    January 6, 2013 at 11:44 am #8910
    anik das
    Participant

    // Program to rotate servo by 5 degree from previous position starting from 0 degree

    // 0 degree = 700us 
    // 180 degree = 5500us
    // Timer1 pulse after 50us -23

    #include<reg51.h>
    sbit output=P1^0; //Output to motor
    int count;

    void delay(unsigned int msec) // Function for delay
    {
    int i,j;
    for(i=0;i<msec;i++)
    for(j=0;j<1275;j++);
    } 

    void timer(int msec) // Function for timer
    {
    int i;
    TR1=1;
    for(i=0;i<msec;i++)
    {
    while(TF1==0);
    TF1=0;
    }
    TR1=0;
    }
    void main()
    {
    int i;
    TMOD=0x20; // Mode2
    TH1= -23; // 50usec timer
    output=0;
    count=14;
    while(1)
    {
    if(count>=100)
    count=14;
    else
    count=count+5;
    for(i=0;i<200;i++)
    {
    output=1;
    timer(count);
    output=0;
    timer(360);
    }
    delay(100);
    }
    }


    the code is like this

     

    January 6, 2013 at 11:49 am #8911
    anik das
    Participant

    wysiwyg_imageupload:7195:

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • Calculation of A Class amplifier November 9, 2025
  • restarting this Christmas project November 9, 2025
  • strange laptop problem November 9, 2025
  • Have a ultrasonic washer but not knowing what detergent for cleaning soot November 9, 2025
  • JLCPBC are using a different shipping company = less $$$$$$$$ November 9, 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