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

PIC32 fast pin toggle

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



Joined: 18 Nov 2008
Posts: 278
Location: Athens, Greece.

View user's profile Send private message

PIC32 fast pin toggle
PostPosted: Wed Nov 16, 2011 2:01 am     Reply with quote

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: 19433

View user's profile Send private message

PostPosted: Wed Nov 16, 2011 3:39 am     Reply with quote

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: 278
Location: Athens, Greece.

View user's profile Send private message

PostPosted: Wed Nov 16, 2011 9:04 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Nov 16, 2011 9:14 am     Reply with quote

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
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