ir sensor and pulse count, using mikroC software.

Discussion in 'Embedded Systems and Microcontrollers' started by Vanessa Mae Reyes, Jul 11, 2016.

  1. Vanessa Mae Reyes

    Thread Starter New Member

    Sep 27, 2015
    can u pls help me write a program for frequency counter/pulse counter using hall effect sensor? using mikroC software.
  2. AlbertHall

    Well-Known Member

    Jun 4, 2014
    There are basically two ways to do this depending on the frequency of the input.
    1. Set up a timer for a suitable timebase (say 1 second). Increment a counter for each input pulse during the period of this timer. At the end of the timer period, the counter will hold a value related to the frequency - in my example, the frequency in Hz.
    2. For lower input frequencies, count clock cycles (or some division thereof) during the period of the input signal. This gives a number related to the period of the input and then a little maths will give you the frequency.

    Mr Google will help. e.g.