Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

counting pulses on a 18f

Status
Not open for further replies.

jay543_uk

New Member
iv got a square wave pulse from a anomemeter that i want to display on a lcd, it pulses 6 times to one rotation of the anomemter.

i believe that the maximum frequancy i need to measure is about 150hz

what is the best way to count this with a micro pic, trying to use a 18f with mlab c18 compiler.

i was thinking of setting up a tmr0 timer and count the pulses till it overflows and then see how many pulse there are in that set time, does this sound right or should i do it another way.

with no rotation of the anomemter the output sits high (5v) and pulses down to 0v when rotated

thanks for any help
jason
 
hi,
I would set up another timer for a 1 second interrupt, use timer0 to count the pulses.
Read the value of timer0 on interrupt, this will give a direct reading of frequency.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top