Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
LinkBack Thread Tools Display Modes
Old 15th January 2008, 06:28 AM   (permalink)
Default Any PICs w/ two CCP modules, each with independent timers

I'm wondering if anyone knows of a PIC variant that has two CCP modules, each with it's own independent 16 bit timer. Most all of the PICs [I've looked at thus far] that have two CCP's, are all based on a common 16 bit timer (Timer1 in all the 16Fxxx family members).

I've been using microchip's product selector filter tool to see if I can narrow the field, but don't seem to be able to get anywhere. Or maybe it's just because such a thing doesn't exist.

Why, you ask....
- I want to use one CCP module's "capture" mode to capture the cycle time of an input frequency.

- Then, periodically take a snapshot of a "capture", and calculate a percentage of that cycle time. (i.e. 5%). Note: The input frequency is no fixed. It will vary over time. So this sampling will occur on a very frequent basis.

- Based on that calculation, I want to use the other CCP module's "compare" mode to output a modified version of the input frequency. Say a frequency who's cycle time is 105% of the input frequency.


For bonus points.... can you guess what application I'm targeting?

Last edited by pdfruth; 15th January 2008 at 06:30 AM.
pdfruth is offline  
Old 15th January 2008, 07:16 AM   (permalink)
Default

Why can't they both use the same timer? You then capture a certain number of timer cycles and output be setting a compare value.
For example, if you are getting pulses of 1mS and your timer is running at 1MHz then each interrupt your timer will have gained 1000. Take this time, scale it and add the current timer value to get the compare value.

Is this a speedo corrector?

Mike.
Pommie is online now  
Old 18th January 2008, 06:18 AM   (permalink)
Default

Quote:
Originally Posted by Pommie
Why can't they both use the same timer? You then capture a certain number of timer cycles and output be setting a compare value.
For example, if you are getting pulses of 1mS and your timer is running at 1MHz then each interrupt your timer will have gained 1000. Take this time, scale it and add the current timer value to get the compare value.
After posting, and noodling on it for a bit (whilst sitting on plane for a few hours).... I had an ah-ha moment.
Sure, just like you said, I think that'll work.
Thanks, Mike.

Quote:
Originally Posted by Pommie
Is this a speedo corrector?
You are correct sir! Have your self an adult beverage, on me.
pdfruth is offline  
Old 18th January 2008, 06:50 AM   (permalink)
Default

You could use the CCP module to capture, then just output a PWM in software..assuming that is all you want the PIC to be doing... After all, once setup the capture mode of the CCP will just generate an interupt...so unless you're dealing with high frequency here (>3khz) it can all be done. Sometimes it can be annoying when certain peripherals 'share' hardware, but there is almost always a way around it..

Blueteeth

ps. was my post pointless? just re-read, looks so
__________________
Inconsistency is the key to flexibility!
Blueteeth is offline  
Reply

Bookmarks

Thread Tools
Display Modes



Similar Threads
Title Starter Forum Replies Latest
PIC's and licence free radio modules. Nigel Goodwin Micro Controllers 11 31st October 2005 09:18 AM
Remote control using PICs and RF Tx/Rx modules rafael_cordeiro Electronic Projects Design/Ideas/Reviews 2 21st January 2005 10:40 PM
Remote control using PICs and RF Tx/Rx modules rafael_cordeiro Electronic Projects Design/Ideas/Reviews 4 6th December 2004 04:35 PM
Remote control using PICs and RF Tx/Rx modules rafael_cordeiro Electronic Projects Design/Ideas/Reviews 0 4th December 2004 05:47 PM



All times are GMT. The time now is 03:31 AM.


Electronic Circuits  |  Learning Electronics
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

eXTReMe Tracker