CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Timer0

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Doc1
Guest







Timer0
PostPosted: Tue Mar 29, 2005 12:40 pm     Reply with quote

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

View user's profile Send private message

Re: Timer0
PostPosted: Wed Mar 30, 2005 6:32 am     Reply with quote

This forum has a 'Search' facility, please use it. Many solutions to similar problems can be found.
valemike
Guest







PostPosted: Wed Mar 30, 2005 9:19 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group