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.

Some basic, very dumb questions about PIC18

Status
Not open for further replies.

raycao88124

Newbie level 2
Joined
Jun 11, 2012
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,302
Hello everyone

Just have some very basic stupid questions about PIC18F4550 (MPLAB v8.85, C18 compiler)

1. If I want to use internal oscillator as system clock source, is the internal oscillator frequency the same as clock frequency.
2. If I want to use internal oscillator as system clock source at 8 Mhz, is setting OSCCON = 0x72 at the top of the program enough(without setting any other configuration bits)? Or are there other configuration bits that need to be set?
3. If I want to use internal oscillator as system clock source at 8 Mhz, and I want to use 100 khz baud rate for I2C, is setting SSPADD = 0x13 correct?

Thank you very much!
 

1. Read the Datasheet
2. Read the Datasheet
3. Read the Datasheet

Well, ok, it wasn't funny the third time, so here my toughts:

1. The PIC18f4550 has a very complex clock system, there are multiple Clock inputs and configurations, but when you select the internal oscilator as system clock source (either INTHS, INTXT, INTIO or INTCKO) it becomes you system clock... (but you can still set the USB clock in INTHS and INTXT to a external crystal)

2. It depends if you have another primary oscillator (like a crystal well configured by fuses) there you need to set OSCCON =0x72 to set it to internal 8MHz, if you are working only from the internal oscillator (either INTHS, INTXT, INTIO or INTCKO modes) you can change to 8MHz with OSCCON=0x70; //you primary clock is still the internal clock...)

3. If SSPCON is set as master, yeah SSPADD = 19 (x013) will give you 100kHz of clock for the I2C when clocked with 8MHz
 

Hi,

To simplify K~ Ryu 's answer, to use the 8mhz oscillator you must first specify, Config FOSC = INTOSCIO_EC , and then use the value you mention in OSCCON to select 8mhz.

The oscillator is divided by 4 to give the Clock frequency Fosc/4. thats the speed at which the chip actually runs.
One clock pulse is also refered to as a Cycle, the time it takes to execute one single word instruction.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top