![]() | ![]() | ![]() |
| | |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
| | LinkBack | Thread Tools | Display Modes |
| | (permalink) |
| 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. | |
| |
| | (permalink) |
| 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. | |
| |
| | (permalink) | ||
| Quote:
Sure, just like you said, I think that'll work. Thanks, Mike. Quote:
| |||
| |
| | (permalink) |
| 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! | |
| |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
| |
| | ||||
| 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 |