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 / counter help

counter help

|

Microcontroller › 8051 › counter help

  • This topic has 10 replies, 5 voices, and was last updated 12 years, 6 months ago by AJISH ALFRED.
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • May 22, 2012 at 6:29 pm #1813
    Fred
    Participant

    Hi everyone, 

     

    I am fairly new to the 8051. I am building a heart beat monitor and I built a sensor having an digital output. (pulses) now i need to use the 8051 to count these pulses. any help on how i have to do this? 

     

    thanks

    May 23, 2012 at 12:43 am #7876
    Mehtab Ali
    Participant

    The timers, timer0 and timer1 in 8051 can be used for counting the pulses fed into microcontroller. you  initialize the microcontroller’s timer in the counter mode and fed pulses into it to be counted.

      regards

    May 23, 2012 at 6:32 am #7878
    Fred
    Participant

    but do i have to use both timer0 and timer1? 

    May 23, 2012 at 5:04 pm #7881
    Mehtab Ali
    Participant

    you can use either timer0 or timer1 for counting purpose.

    May 23, 2012 at 5:59 pm #7884
    AJISH ALFRED
    Participant

     

    I’ve done a similar project. I’ll explain the method which I’ve used.

     

    Normall we need hart beats/minute. So take the heart beat count for ten seconds and multiply it with 6.

    Connect the input of HB sensor to any one of the input pin. Increment a count each time the pin become high from low. Generate a delay of 10 seconds by setting any one of the timer. (I hope you know the technique, using static variables for large delays). When it becomes 10 seconds, stop incrementing the count, read the count and multiply it with 6 and display.

    May 23, 2012 at 7:15 pm #7886
    Fred
    Participant

    Great! that helps a lot! I will do some research about how to use the timer to make the 10 second dely as you said because i dont know how! 

     

     

    THANKS

    May 24, 2012 at 8:51 pm #7899
    Fred
    Participant

    Do you happen to have any sample code i can find very helpful? 

     

    Thanks

    May 25, 2012 at 5:15 pm #7904
    Anonymous
    Guest

     

    Hi Fred,

                  I’ve done it on a totaly different microcontroller called RENESAS. You won’t get anything useful from the code.

    May 28, 2012 at 6:32 pm #7925
    AJISH ALFRED
    Participant

    I can give you a rough idea only,

     

    Inside your ISR,

     

    {

               static int count = 0;

     

               if ( count < max_count )

               {

                           count ++;

                           wait_variable = 1;

               }

               else

               {

                            stop_timer ();

                            wait_variable = 0;

    }

     

    Inside your main code,

     

    while ( wait_variable );   // will wait till wait_variable become 0;

    November 24, 2012 at 4:09 am #8785
    Akash
    Participant

    Hello everyone.

     

    I want to make conveyor belt object counter and i m using p89v51rd2 for that purpose..

     

    can anyone help me to know that how to increment a counter.

     

    I will be pleased if anyone can help me in c coding for that.

    November 24, 2012 at 6:02 pm #8789
    AJISH ALFRED
    Participant

    Hi Akash,

    Share more details about your project so that others can help you.

    Also suggest you to post your query as a seperate topic in this forum.

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

RSS Recent Posts

  • Why can't I breadboard this oscillator? June 15, 2025
  • Failure of polypropylene motor-run capacitors June 14, 2025
  • a point I can't understand about the sinc expression June 14, 2025
  • Quick advice on remote car starter? June 14, 2025
  • Wideband matching an electrically short bowtie antenna; 50 ohm, 434 MHz June 14, 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