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

Set Operating Frequency for PIC18F4455

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



Joined: 18 Mar 2005
Posts: 3

View user's profile Send private message

Set Operating Frequency for PIC18F4455
PostPosted: Fri Mar 18, 2005 10:13 am     Reply with quote

Target Frequencies:
(1) 48 MHz for CPU and Peripherals Clock
+ deriving from the 96 MHz PLL module
+ using Oscillator Postscaler: configure as divide-by-2

(2) 48MHz USB Clock
+ deriving from the 96 MHz PLL module
+ using PLL Postscaler: congigure as Fixed Divide-by-2

Oscillator: 20MHz crystal oscillator as an external clock

My Questions:
(1) How can I set these target frequencies using CCS PIC C compiler (PCH)?

(2) How can I declare the Device Specification # FUSES options? (what is the specific options? )

(3) In file 18F4455.h, where can I find the definitions of each "options" of the #FUSES as below

Code:
//////// Fuses: XT,X4,EC_IO,EC,E4_IO,E4,INTRC_IO,INTRC,PROTECT,NOPROTECT
//////// Fuses: BROWNOUT_NOSL,BROWNOUT_SW,NOBROWNOUT,BROWNOUT,WDT1,WDT2,WDT4
//////// Fuses: WDT8,WDT16,WDT32,WDT64,WDT128,WDT,NOWDT,BORV21,BORV28,BORV43
//////// Fuses: BORV46,PUT,NOPUT,CPD,NOCPD,NOSTVREN,STVREN,NODEBUG,DEBUG
//////// Fuses: NOLVP,LVP,WRT,NOWRT,WRTD,NOWRTD,IESO,NOIESO,FCMEN,NOFCMEN
//////// Fuses: PBADEN,NOPBADEN,CCP2B3,CCP2C1,WRTC,NOWRTC,WRTB,NOWRTB,EBTR
//////// Fuses: NOEBTR,EBTRB,NOEBTRB,CPB,NOCPB,LPT1OSC,NOLPT1OSC,MCLR,NOMCLR
//////// Fuses: XINST,NOXINST,INTXT,INTHS,WDT256,WDT512,WDT1024,WDT2048
//////// Fuses: WDT4096,WDT8192,WDT16384,WDT32768,HS,H4


Thanks.
Ttelmah
Guest







PostPosted: Fri Mar 18, 2005 10:58 am     Reply with quote

Just select X4, and feed in an external 4Mhz clock.
This gives the PLL generating 96Mhz, and the default divider (/2 = 0:0 on the divider bits accessed by the PLL1, and PLL2 fuse bits - which your list does not show...). This 'defaults' to USBDIV being off, and high speed operation (at 48Mhz).
Obviously set the other fuses (watchdog, Brown out reset etc.), as you need.

Best Wishes
anthony



Joined: 18 Mar 2005
Posts: 3

View user's profile Send private message

PostPosted: Fri Mar 18, 2005 12:14 pm     Reply with quote

Thanks. I will try.

However, currently I do not have 4MHz clock. I have 20MHz crystal instead.

In that case, please help me for 20MHz crystal. Can I use H4 or HS? I have already tried both but failed.

Code:
#elif defined(__PCH__)
  #include <18F4455.h>
  #fuses HS,NOWDT,NOPROTECT,NOLVP
 #endif
 #use delay(clock=20000000)


and

Quote:
#elif defined(__PCH__)
#include <18F4455.h>
#fuses H4,NOWDT,NOPROTECT,NOLVP
#endif
#use delay(clock=20000000)


Thanks for your help.
Ttelmah
Guest







PostPosted: Sat Mar 19, 2005 3:35 am     Reply with quote

Read the chip's data sheet. For 20MHz, you need to use HSPLL (H4), with PLLDIV set to 0b100. Your version listing, does not show the PLL fuses, so I'd consider just adding the entry as a #ROM line.

Best Wishes
anthony



Joined: 18 Mar 2005
Posts: 3

View user's profile Send private message

PostPosted: Mon Mar 21, 2005 5:02 pm     Reply with quote

Thanks. I have downloaded new version of PCH ver3.222, showing PLL fuses.

//////// Standard Header file for the PIC18F4455 device ////////////////
#device PIC18F4455
#nolist
//////// Program memory: 12288x16 Data RAM: 2048 Stack: 31
//////// I/O: 36 Analog Pins: 13
//////// Data EEPROM: 256
//////// C Scratch area: 00 ID Location: 2000
//////// Fuses: XT,XTPLL,EC_IO,EC,ECPIO,ECPLL,INTRC_IO,INTRC,PROTECT
//////// Fuses: NOPROTECT,BROWNOUT_NOSL,BROWNOUT_SW,NOBROWNOUT,BROWNOUT,WDT1
//////// Fuses: WDT2,WDT4,WDT8,WDT16,WDT32,WDT64,WDT128,WDT,NOWDT,BORV21
//////// Fuses: BORV28,BORV43,BORV46,PUT,NOPUT,CPD,NOCPD,NOSTVREN,STVREN
//////// Fuses: NODEBUG,DEBUG,NOLVP,LVP,WRT,NOWRT,WRTD,NOWRTD,IESO,NOIESO
//////// Fuses: FCMEN,NOFCMEN,PBADEN,NOPBADEN,CCP2B3,CCP2C1,WRTC,NOWRTC,WRTB
//////// Fuses: NOWRTB,EBTR,NOEBTR,EBTRB,NOEBTRB,CPB,NOCPB,LPT1OSC,NOLPT1OSC
//////// Fuses: MCLR,NOMCLR,XINST,NOXINST,INTXT,INTHS,WDT256,WDT512,WDT1024
//////// Fuses: WDT2048,WDT4096,WDT8192,WDT16384,WDT32768,HS,HSPLL,PLL1,PLL2
//////// Fuses: PLL3,PLL4,PLL5,PLL6,PLL10,PLL12,CPUDIV1,CPUDIV2,CPUDIV3
//////// Fuses: CPUDIV4,USBDIV,NOUSBDIV,VREGEN,NOVREGEN,ICPRT,NOICPRT
////////
////////////////////////////////////////////////////////////////// I/O
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