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.

How to calculate internal clock frequency of PIC ?

Status
Not open for further replies.

milan.rajik

Banned
Joined
Apr 1, 2013
Messages
2,524
Helped
540
Reputation
1,078
Reaction score
524
Trophy points
1,393
Activity points
0
In this document it is mentioned that if PIC18F4550 has 20 MHz external crystal then internal clock will be 48 MHz. How to calculate internal clock frequency for PIC ?

I want to know because I want to write Delay_us and Delay_ms functions for C18 code.

**broken link removed**
 

hi milan,
This may be helpful, I use for USB n the 18F2550 PIC
E
Code:
	LIST p = 18F2550, r = dec, w = -311, f = inhx32
	INCLUDE "P18F2550.INC" ; MPASM Header
	errorlevel -302, -207

CONFIG PLLDIV=5,CPUDIV=OSC1_PLL2,USBDIV=2,FOSC=HSPLL_HS,IESO=OFF
CONFIG VREGEN=ON,CCP2MX=ON,WDT=OFF,WDTPS=32768,PBADEN=OFF ,PWRT=OFF,MCLRE=ON
CONFIG LPT1OSC=OFF,BOR=ON,BORV=2,STVREN=ON,LVP=OFF,ICPRT= OFF,XINST=OFF,DEBUG=OFF
CONFIG WRTB=ON
 
EEPROM_START EQU 0F00000h
BLOCK_SIZE EQU 32

PLLDIV=5 ' This sets the PLL Postscaler to divide the primary osc input by 5
providing 4MHz to the 96MHz PLL. The 96MHz PLL input must always be 4MHz
as shown in the data sheet.

CPUDIV=OSC1_PLL2 ' This sets the PLL Postscaler to divide the 96MHz PLL
output by 2 providing a 48MHz clock to the CPU.

USBDIV=2 ' This divides the 96MHz PLL output by 2 providing 48MHz to the
USB core.

FOSC=HSPLL_HS ' This enables HSPLL for high-speed crystal/resonator.
 
But isn't 48 MHz clock derived is USB Clock ? If yes, then how does it become system clock ?
 

48Mhz is requered to use USB. Also, only external high accuracy crystal needed.
Sure, it can operate from any other frequencies less that 48MHz from external or internal oscillator.
How about your super device that need 2A during SMS sending? :-D
 

How about your super device that need 2A during SMS sending?

It is slowly progressing. I used PIC32 and to make the device I am learning programming PIC32 using mikroC PRO PIC32. I have the GSM library and it can be used with any mikroC Compiler. Just have to learn handling external interrupts and timers in PIC32.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top