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

PIC18F25K22

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



Joined: 10 Dec 2003
Posts: 67
Location: West Sussex, UK

View user's profile Send private message

PIC18F25K22
PostPosted: Wed Oct 06, 2010 5:16 pm     Reply with quote

Has anyone experience of using the CCS compiler (I have 4.112) with the PIC 18F25K22 ?

I have a simple led flash program running user timer0 to generate a 10mS RTC, but cannot get my head around the correct fuses to select the internal clock at 16MHZ and use of PLL to get actual clock frequency of 64Mhz. I have called setup_oscillator(OSC_64 | OSC_INTRC), but the result looks as if I am only running at 16MHZ not 64Mhz.

My next step is to toggle a port pin within the Timer0 isr and see what frequency my irqs actually occur at.
_________________
Peter Willis
Development Director
Howard Eaton Lighting Ltd UK
joergn



Joined: 15 Jul 2010
Posts: 15
Location: Hamburg Germany

View user's profile Send private message Visit poster's website

PostPosted: Thu Oct 07, 2010 2:31 am     Reply with quote

Hi,

I had the same problem in the beginning.
Inside the main.h file I am just using the delay command and get
the 64Mhz PLL. Inside my main code I do not
changing the clock. Best way to check the 64Mhz speed is to use a scope and measure the fastest port pin change you can achieve directly and not
by a timer setting to exclude wrong timer settings......
Code:

"main.h":
#include <18F45K22.h>
#device adc=10
#FUSES NOWDT                    //No Watch Dog Timer
#FUSES INTRC_IO                   
#FUSES NOPROTECT
#FUSES NOEBTRB
#FUSES NOEBTR
                
#FUSES NODELAYINTOSC
#FUSES NOWRTC
#FUSES NOLPT1OSC   
#FUSES NODEBUG

#use delay(clock=64Mhz )
#use rs232(baud=19200,xmit=PIN_C6 ,rcv=PIN_C7 , parity=N,bits=8, ERRORS)

Regards

Joerg
prwatCCS



Joined: 10 Dec 2003
Posts: 67
Location: West Sussex, UK

View user's profile Send private message

18F25K22
PostPosted: Thu Oct 07, 2010 5:25 am     Reply with quote

Hi Joerg

I have found the problem.

If you use setup_oscillator(OSC_64MHZ | OSC_INTRC) the compiler initialises OSCCON to 0x72

This does not allow the PLL to be seen as the clock source, even though you are indeed using the internal 16Mhz clock source!

If you use setup_oscillator(OSC_64MHZ ) the compiler initialises OSCCON to 0x70, and you get the use of the PLL. In this mode it is imperative to have correctly set the fuses to define the Primary Clock source as the internal oscillator. (FOSC<3:0> = 100x) in CONFIG1H

It helps to look at Fig 2.1 in the 18F25K22 data sheet which shows the "simplified" Oscillator system block diagram.

It would also have helped if the CCS compiler had warned that the use of OSC_INTRC at the same time as OSC_64MHZ (or indeed OSC_32MHZ) would not give the desired result.

regards
_________________
Peter Willis
Development Director
Howard Eaton Lighting Ltd UK
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