View previous topic :: View next topic |
Author |
Message |
oxo
Joined: 13 Nov 2012 Posts: 219 Location: France
|
Clock speed reality check |
Posted: Fri Jun 23, 2017 4:21 am |
|
|
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: 9246 Location: Greensville,Ontario
|
|
Posted: Fri Jun 23, 2017 4:52 am |
|
|
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
|
|
Posted: Fri Jun 23, 2017 6:33 am |
|
|
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
|
|
Posted: Fri Jun 23, 2017 6:36 am |
|
|
Thanks, thats what I suspected |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19552
|
|
Posted: Fri Jun 23, 2017 7:58 am |
|
|
and (of course), the manual page is 'out of date', with the '100MHz' maximum.... |
|
|
|