Joined: 09 Mar 2004 Posts: 52 Location: Greater Manchester - UK
Capture module
Posted: Mon May 24, 2004 1:49 am
Dear folks,
I wnat to use the capture module of the PIC16F874 to measure a frequency.
IF I set it to trigger every rising edge, can I assume that the the value in timer 1 will be the time between rising edges (1 cycle).
If so when it encounters the first rising edge will it start or generate an interrupt??
How do I set it to measure between rising edges???
Any ideas?? _________________ Best Regards
mvaraujo
Joined: 20 Feb 2004 Posts: 59 Location: Brazil
Posted: Mon May 24, 2004 8:14 am
Asjad,
This is not like your thinking! Every rising edge you'll have the CCP module copying the current value of the Timer1 to a CCP register. So if you want to measure period of time what you have to do is always subtract current capture by last capture (it can be inside the interrupt). And yes, you can enable interrupt to warn you that a rising edge happened and it's time to collect data and make calculation.
I suggest you, before trying to implement stuff directly, to know your PIC device by reading the part datasheet and other documents that can be found at Microchip.com. If you don't know your hardware, no programming will get you to good results.
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