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.

PIC 18F4550 Internal Oscillator frequency changing issue in MPLAB XC8

Status
Not open for further replies.

WTech

Newbie level 5
Joined
Nov 3, 2009
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Paksitan
Activity points
1,356
I am using MPLAB X v1.30. I set the internal oscillator as MCU source clock by setting FOSC = INTOSC_HS. According to datasheet of PIC 18F4550 the default internal oscillator frequency is 1MHz, and that can be changed by setting OSCCON <6:4>. I changed the frequency (8MHz) at start of my main program, but found by soft simulation in MPLAB X that the source frequency was not changed. The source frequency remain the 1 MHz.
Any Body know about it.

Thanks
 

I have written the simple LED blink code.


#pragma config FOSC = 11 // Internal HS Oscillator
//#pragma config FCMEN = OFF
#pragma config IESO = ON
#pragma config PWRT = OFF
#pragma config BOR = OFF
#pragma config BORV = 3
#pragma config VREGEN = OFF // USB Regulator OFF
#pragma config WDT = OFF
#pragma config WDTPS = 32768
#pragma config MCLRE = OFF
#pragma config LPT1OSC = OFF
#pragma config PBADEN = OFF
// #pragma config CCP2MX = ON
#pragma config DEBUG = OFF
#pragma config STVREN = OFF
#pragma config LVP = OFF
// #pragma config ICPRT = OFF
#pragma config XINST = OFF
#pragma config CP0 = OFF
#pragma config CP1 = OFF
// #pragma config CP2 = OFF
// #pragma config CP3 = OFF
#pragma config CPB = OFF
// #pragma config CPD = OFF
#pragma config WRT0 = OFF
#pragma config WRT1 = OFF
// #pragma config WRT2 = OFF
// #pragma config WRT3 = OFF
#pragma config WRTB = OFF
#pragma config WRTC = OFF
// #pragma config WRTD = OFF
#pragma config EBTR0 = OFF
#pragma config EBTR1 = OFF
// #pragma config EBTR2 = OFF
// #pragma config EBTR3 = OFF
#pragma config EBTRB = OFF
void main(){
OSCCON = 0x7F ; //Internal Oscillator with 8MHz frequency
__delay_ms(10); //1ms delay for frequency stablization
OSCTUNE = 128 ; //Internal Oscillator with maximum frequency
__delay_ms(10); //1ms delay for frequency stablization


The frequency should be configured to 8MHz after this code. But this was not happened.
 

Hi,

I don't do C but the Config Fosc= 11 does not seem right ? - I use CONFIG FOSC = INTOSCIO_EC and 0x72 for Oscon.
Never bothered with osctune.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top