Searching \ for '[PIC]:Pulse counting methods' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/time.htm?key=count
Search entire site for: 'Pulse counting methods'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]:Pulse counting methods'
2001\03\15@005122 by Michael W. Bogucki

flavicon
face
Hi All,
       I have a question in regards to pulse counting. I was wondering
what would be the most efficient way of doing this...

       Essentially I need to count  incoming pulses (60 - 120 Hz.) and
compare the pulse count to that of two registers (Low-state and
High-state.) A seperate output pin would start out being low. When the
pulse count hits the Hi-state, that output pin would go high. When the
pulse count now hits the Low-state, that output pin would then be driven
low. This process would loop infinitly, meaning if Low-state=3 and
High-state=2, the output pin would be high for 2 pulses, then low for 3
pulses, then high for 2 pulses, then low high 3 pulses......(on and on and
on)
       Would it be better to just use an internal counter and an
interrupt service routine to update and compare the counter then drive the
pin appropriately. Or would it be more efficient to use the CCP module and
reference TMR1??
       Or should I just poll the input pin for a state change, increment
the internal counter, compare etc....

Thank you for any ideas or hints, etc....

--|\/| | |< E

The most exciting phrase to hear in science, the one that heralds new
discoveries, is not "Eureka!" (I found it!) but "That's funny ..."
               -- Isaac Asimov

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\03\16@140220 by Dan Michaels

flavicon
face
Michael W. Bogucki wrote:
>Hi All,
>        I have a question in regards to pulse counting. I was wondering
>what would be the most efficient way of doing this...
>
>        Essentially I need to count  incoming pulses (60 - 120 Hz.) and
>compare the pulse count to that of two registers (Low-state and
>High-state.)
.........
>        Would it be better to just use an internal counter and an
>interrupt service routine to update and compare the counter then drive the
>pin appropriately. Or would it be more efficient to use the CCP module and
>reference TMR1??


Michael,

There is at least one recent thread on this sort of thing in the pic
archives, eg, starting with:

[PIC]: Frequency counting Edson Brusque (Tue Feb 20 2001 - 15:14:50 PST)

With your slow signals, you can do this any number of ways.

Myself, I use Timer1 as a general purpose 16-bit counter with a RAM
variable used to keep track of Timer1 overflows - it just polls
the TMR1IF flag - no interrupts. I use Timer0 to count seconds.
This scheme will count into the >10 Mhz range.

- dan michaels
http://www.oricomtech.com
===================

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email spam_OUTlistservTakeThisOuTspammitvma.mit.edu with SET PICList DIGEST in the body


More... (looser matching)
- Last day of these posts
- In 2001 , 2002 only
- Today
- New search...