How to count a pulse ?

Guys,

Does anyone know how to count a pulse in one minute from the output of op amp ? Thanks

Does anyone know how to count a pulse in one minute from the output of op amp ?

First, you detect the pulse. Then, pulseCount++;

Interrupt routine to count the pulses.

Main loop identifies when a minute has passed (or whatever length of time you desire), displays, remembers, prints, whatever, the number of pulses, and resets the count to 0.

Points to remember:

  1. Variables that are used in both interrupt routine and main loop must be "volatile".
  2. Operations in the main loop on variables that are shared with the interrupt routine that are not atomic should be surrounded by critical sections and be kept as short as possible.

http://www.gammon.com.au/forum/?id=11916

Also: http://www.gammon.com.au/forum/?id=11504

Use the hardware counter. That's why they put it there.