View previous topic :: View next topic |
Author |
Message |
Doc1 Guest
|
Timer0 |
Posted: Tue Mar 29, 2005 12:40 pm |
|
|
Hi there,
I need your help fellows,
I want to messure (with the PIC 16F870) a freqenz (from 0Hz-100Hz) for 10 seconds long on Timer Port 0
After the 10 seconds I need to know the average value.
Can someone help me out
Thx
PS:
I need a CCP Example Code |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
Re: Timer0 |
Posted: Wed Mar 30, 2005 6:32 am |
|
|
This forum has a 'Search' facility, please use it. Many solutions to similar problems can be found. |
|
|
valemike Guest
|
|
Posted: Wed Mar 30, 2005 9:19 am |
|
|
No code example on this post, but this is how I would do it:
Look at stwt1.c in the examples program. It shows you how to use Timer1 as a stopwatch. Plug your frequency into RB0 to interrupt on an edge. In your RB0 isr, simply increment a counter.
Set your stopwatch to zero, and also your counter of frequency falling edges to zero. Wait til 10 seconds elapses, and note the number of edges you received in your RB0 isr.
At the end, you'll know how many counts you received in 10 seconds.
This should be enough info for you to code it; otherwise, i'd do what Ckielstra says and go look in the archives to cut and paste.
-Mike |
|
|
|