View previous topic :: View next topic |
Author |
Message |
georpo
Joined: 18 Nov 2008 Posts: 281 Location: Athens, Greece.
|
PIC32 fast pin toggle |
Posted: Wed Nov 16, 2011 2:01 am |
|
|
Hello!
Is it possible to toggle an I/O pin at the cpu speed?
Let's say the PIC32 runs at 80MHz.
If I toggle the pin, will I get 40MHz output?
I know this is possible with all other PIC series but I could not
do it with PIC32...
Thanks. _________________ George. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19506
|
|
Posted: Wed Nov 16, 2011 3:39 am |
|
|
This is not possible on _any_PIC.....
I think you may possibly be confusing Fosc (the internal clock oscillator frequency), with the OSC input frequency.
On all the older PICs, the fastest you can operate an output pin, is with the PWM, at Fosc/4.
What you _can_ do on most of the PIC18 chips is run with an external oscillator (OSC) at (say) 10MHz, and generate internally an Fosc faster than this, with the PLL. So running with a 10MHz external clock, you then run Fosc at 40MHz, and can toggle a pin at 10MHz. However this is still 1/4 of the actual Fosc.
If you think about it the timers (limiting factor on speed), don't clock faster than the oscillator frequency (unless you use an external clock....), so it takes a minimum of two cycles of the oscillator clock to give a high and a low pulse period. This is the fastest you can go with the PIC32.
You really need to be on the Microchip hardware forums. CCS doesn't support the PIC32, and this is a forum for _CCS_ code support.
Best Wishes |
|
|
georpo
Joined: 18 Nov 2008 Posts: 281 Location: Athens, Greece.
|
|
Posted: Wed Nov 16, 2011 9:04 am |
|
|
Yes, this is what I mean.
Of course I do not mean the oscillator frequency. I mean the TCY.
For example, with a PIC16 series with 20MHz crystal, the internal TCY is 5MHz. So if I toggle the pin, I get 2.5MHz.
I also do that with PIC18, DSPIC and PIC24.
Of course DSPIC and PIC24 chips divide by 2.
The question is:
1) Does the PIC32 divide the clock? By 2? by 4?
2) can I toggle the io pin at these speeds?
I already tried it with a PIC32 running at 80MHz but the output is only
2.5MHz. It must be some configuration issue. _________________ George. |
|
|
drh
Joined: 12 Jul 2004 Posts: 192 Location: Hemet, California USA
|
|
Posted: Wed Nov 16, 2011 9:14 am |
|
|
As Ttelmah said.
"You really need to be on the Microchip hardware forums. CCS doesn't support the PIC32, and this is a forum for _CCS_ code support." _________________ David |
|
|
|