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

Internal oscillator with PIC18f4520

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



Joined: 17 Apr 2007
Posts: 22
Location: france

View user's profile Send private message

Internal oscillator with PIC18f4520
PostPosted: Mon Mar 30, 2009 10:11 am     Reply with quote

Hi gents,
I'm using a PIC18f4520 with an external oscillator of 7.32Mhz, i would like to replace it with the internal 8Mhz oscillator.
I don't know how to enable the internal oscillator and disable the external.

I don't know which Fuse use on my header file.
I'm using CCS complier 3.249

Thanks
Bruno
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Mar 30, 2009 10:37 am     Reply with quote

Look at the list of fuses near the top of the 18F4520.h file.
The internal oscillator fuses have "INT" at the beginning.
globalsys



Joined: 17 Apr 2007
Posts: 22
Location: france

View user's profile Send private message

PostPosted: Tue Mar 31, 2009 2:15 am     Reply with quote

Hi, it's working i use the following fuses :
#FUSES INTRC

and the this function : setup_oscillator( OSC_8MHZ );

it's working when programming with MPlab, but i'm using tiny bootloader to program the PIc trough the serial port, and it's not working due to the configuration bits of the bootloader software, and i can't change them.

Thanks
Bruno
Ttelmah
Guest







PostPosted: Tue Mar 31, 2009 3:38 am     Reply with quote

I'm afraid there is no answer then.
Though the oscillator can be changed once the chip is running. The chip must actually start running, and get to the line where the oscillator changes. If the bootloader has got (for example) HS selected, then the chip won't start, unless there is a crystal (or similar resonator) present on the pins. If the bootloader is set up to use an external resonator, then one has to be there....

Best Wishes
globalsys



Joined: 17 Apr 2007
Posts: 22
Location: france

View user's profile Send private message

PostPosted: Tue Mar 31, 2009 4:46 am     Reply with quote

Ok, maybe on my application use a bootloader is not a so good idea.
Thanks
Bruno
globalsys



Joined: 17 Apr 2007
Posts: 22
Location: france

View user's profile Send private message

PostPosted: Wed Apr 01, 2009 3:41 am     Reply with quote

I have another problem, on my Pin A7 i have 2Mhz clock, and i want to use this pin has an output.
Do i need to change my #FUSES INTRC ?
Or add another one?

thanks
Bruno
Ttelmah
Guest







PostPosted: Wed Apr 01, 2009 7:34 am     Reply with quote

Er. I hope you mean RA6, not RA7. The behaviour of INTRC, is normal port operation on RA7, Fosc/4 out on RA6. RA7, should not have a clock on it, unless there is a connection on the board, linking the signal from RA6 to it...
INTRC_IO, gives port operation on both RA6, and RA7, but if you are seeing a signal on RA7, you need to work out how it is getting there first...

Best Wishes
globalsys



Joined: 17 Apr 2007
Posts: 22
Location: france

View user's profile Send private message

PostPosted: Thu May 14, 2009 2:12 am     Reply with quote

Hi gents, I finally find a good bootloader for my PIC, without oscillator the software is working fine. But I don't know why, I'm using a display, and when I connect the display the PIC is not starting...
Can someone check my Pic configuration and tell me if there is something strange?
Code:
#FUSES NOWDT      // No Watch Dog Timer
#FUSES INTRC      // setup internal oscillator
#FUSES NOIESO     // Internal External Switch Over mode enabled (p.260)
#FUSES NOFCMEN    // Fail-safe clock monitor enabled (p.261)
#FUSES NOBROWNOUT // No Reset when brownout detected
#FUSES NOPUT      // No Power Up Timer (p.45)
#FUSES STVREN     // Stack full/underflow will cause reset (p.56)
#FUSES NODEBUG    // No Debug mode for ICD
#FUSES NOLVP      // No Low Voltage Programming on B3(PIC16) or B5(PIC18)
#FUSES NOPBADEN   // PORTB pins are configured as digital I/O on RESET
#FUSES MCLR       // Master Clear pin enabled (p.43)
#FUSES LPT1OSC    // Timer1 configured for lower power operation (p.129)
#FUSES NOXINST    // Extended set extension and Indexed Addressing mode disabled (Legacy mode)
#FUSES NOWRTC     // Configuration not registers write protected
#FUSES NOWRTB     // Boot block not write protected
#FUSES NOEBTR     // Memory not protected from table reads
#FUSES NOEBTRB    // Boot block not protected from table reads
#FUSES NOCPB      // No Boot Block code protection
#FUSES NOWRT      // Program memory not write protected
#FUSES NOWRTD     // Data EEPROM not write protected
#FUSES NOCPD      // No EE protection
#FUSES NOPROTECT  // Code not protected from reading

Thanks
Bruno
nicorosen



Joined: 25 Oct 2010
Posts: 2

View user's profile Send private message

PostPosted: Mon Oct 25, 2010 9:05 pm     Reply with quote

Hi globalsys, i read your posts and i'm not even close to your problems.
I'm also using a PIC18F4520, but the very first problem that i have, is that i can't get the CCS to compile the bootloader program. I would like if you could help me, by sharing your CCS code of the program of the bootloader for PIC18F4520, that worked for you.
I would really appreciate your help!
Thank you very much,

Nicolas

PD: for INTERNAL OSCILLATOR, i use the following lines:

#FUSES INTRC_IO //RA6, RA7 --> Normal I/O ports
#USE delay(internal=32mhz)
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