Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

When should use Internal, crystal and PLL in PIC 1846k22 MCU CCS C Compilers

Status
Not open for further replies.

dattlara76

Junior Member level 2
Junior Member level 2
Joined
Mar 1, 2019
Messages
21
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
291
Hi,

As by default PLL is enable in the 18F46k22. If so with the code below ,
Code:
#
include <18F46K22.h>
#fuses  NOMCLR,NOLVP,NOBROWNOUT,PUT,NOXINST
#use delay(internal = 64MHz) //ORI 8//BY DEFAULT PLL IS ENABLE SO 20 crystal is used the 20X4 =80MHZ

will be the FOSC = 64Mhz and then Instruction Clock =64/4=16MIPS ? Is this correct or it will be mutiplied by PLL, I am confused??

If //#use delay (clock=20MHZ, crystal) and if the fuse is above then what should be mulplier PLL, will it be 4x20=80MHZ FOSC.??

If we are in requirement of less than or equal to 64mhz of FOSC then why should we use crystal to get 64MHZ with 16MHZ crystal with PLL. ???

Please any one let me know the actual cause of all my 3 questions.
Thank you...
 

The idea that #use delay sets the oscillator configuration completely doesn't work in all cases (or at least not in all CCS C versions and for all processors. It's however required to inform the compiler about the actual clock speed for various timings, e.g. timer and baud rate settings or software delays.

In case of 18F46K22 you can e.g. write
Code:
#use delay (xtal=16Mhz, clock=64Mhz)
to setup a 16 MHz crystal with x4 PLL

In contrast
Code:
#use delay (int=16Mhz, clock=64Mhz)
misses to enable the PLL

I suggest
Code:
#use delay(clock=64Mhz)
#fuses INTRC_IO, PLLEN, NOIESO, NOFCMEN
to setup all oscillator related configuration bits explicitly.

In any case you need to check if the intended clock configuration is feasible for the actual supply voltage and temperature range.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top