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
You are here: Home / Topics / Microcontroller

Microcontroller

|

Microcontroller › 8051 › Microcontroller

  • This topic has 2 replies, 3 voices, and was last updated 6 years, 2 months ago by Anonymous.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • April 19, 2016 at 10:55 am #4421
    Vignesh Aithal
    Participant

    hey, im building a microcontroller circuit to calculate the frequency of pulses since it is a part of my project. while coding i used counter 0 to count the number of pulses and timer 1 to provide the necessary delay.

    when i teste in proteus, i got the expected output but when i did the circuit and loaded the code to microcontroller, it was not working.

    what maybe the possible reason for that?

    #include<reg51.h>
     
    sbit ip=P3^4;
    int ch=0;
     
    void main()
    {
     
    P2=0;
    while(1)
    {
    int i=0,j;
    TMOD = 0x15;
    ip=1;
    for(j=0;j<5;j++)
    {
    TL0=0x00;
    . TH0=0x00;
    TR0=1;
    for(i=0;i<20;i++)
    {
    TL1=0x0FF;
    TH1=0x4B;
    TR1=1;
    while( TF1==0);
    TF1=0;
    TR1=0;
    }
    TR0=0;
    }
    ch=TL0;
    TMOD = 0x20;
    TH1 = 0x0FD;
    SCON = 0x50;
    TR1=1;
    SBUF = ch;
    while(TI == 0);
    TI=0;
    P2=TL0;
    }
    }
    this is the code im using
    please reply asap
    April 24, 2016 at 9:15 am #13896
    Ashutosh Bhatt
    Participant

    i can not understand what u r doing? for counting pulses use any one timer as pulse counter and annother timer to generate exact 1 sec delay. after 1 sec delay count pulses in counter. convert it into decimal value. thats all

    May 21, 2016 at 6:07 am #13934
    Anonymous
    Guest

    vignesh aithal,

                  you made so many mistake on the prgm side. i.e (condition statement, using timer aas wrng).  

    errors:

    P2=0;

    ip=1;

    . TH0=0x00;

     
  • 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

  • How to power up two stereo audio amplifiers from a single source of power supply August 11, 2022
  • uc3843 Buck-boost August 11, 2022
  • Drill speed controller fault August 11, 2022
  • Code suggestion from Android Studio. Good? August 11, 2022
  • Nokia 5110 HW in Oshonsoft August 11, 2022

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2022 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