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 CCS Technical Support

Clock speed reality check

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



Joined: 13 Nov 2012
Posts: 219
Location: France

View user's profile Send private message

Clock speed reality check
PostPosted: Fri Jun 23, 2017 4:21 am     Reply with quote

I have this code

Code:

// 33EP256GP504 clock
// min Tcy = 14.28nS @ 85C
// = 70 MHz Tcy
// clk = Tcy * 2 = 140 MHz
#use delay(clock= 40MHz, crystal=16MHz)


When I say clock= in the #use delay, is it Tcy * 2, or Tcy?

( yeah, I know its a dumb question, but it's hot here and my brain is a bit frazzled)
temtronic



Joined: 01 Jul 2010
Posts: 9226
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Jun 23, 2017 4:52 am     Reply with quote

I'd say Tcy.... the 'base' of the clock generation 'chain'.
I know them 33 series PICs can clock fast so 140 seems like the 'top end'.
Somehow the Compiler will confgure the various internals( PLL, dividers, etc.) to give you a 40MHz clock using a 16MHz xtal, in your example.

Mind you I still play with PICs that have quartz windows on them.....

Jay
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jun 23, 2017 6:33 am     Reply with quote

Tcy is the instruction clock. Fosc is the actual oscillator output frequency.

The CCS manual says
Quote:
#use delay
Syntax: #USE DELAY (options))
Elements: Options may be any of the following separated by commas:
clock=speed speed is a constant 1-100000000 (1 hz to 100 mhz).
This number can contains commas. This number also supports the
following denominations: M, MHZ, K, KHZ. This specifies the clock the
CPU runs at. Depending on the PIC this is 2 or 4 times the instruction
rate.


So #use delay(clock= ) should be set to Fosc, which is 2 * Tcy for your
PIC. If Tcy is 70 MHz, then it should be #use delay(clock=140M).
oxo



Joined: 13 Nov 2012
Posts: 219
Location: France

View user's profile Send private message

PostPosted: Fri Jun 23, 2017 6:36 am     Reply with quote

Thanks, thats what I suspected Smile
Ttelmah



Joined: 11 Mar 2010
Posts: 19513

View user's profile Send private message

PostPosted: Fri Jun 23, 2017 7:58 am     Reply with quote

and (of course), the manual page is 'out of date', with the '100MHz' maximum.... Very Happy
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