3

How can I use the Internal Oscillator of the PIC16F1787 with 32MHz?

The Datasheet says that you have to set the FOSC setting to 100:

#pragma config FOSC = 100

It also says that you have to change someting in the OSCCON settings, but I dont know how to change the OSCCON.

1 Answers1

3

This isn't really a software question, in the data sheet page 68 you will see the block diagram that involves the clock. Here we can see that the internal oscillator is at 16MHz, we also see we have a PLL available, so we can multiply our internal or external clock to achieve the 32MHz.

From the same data sheet -

Program the PLLEN bit in Configuration Words to a '1'

Write the SPLLEN bit in the OSCCON register to a '1'. if the PLLEN bit in Configuration Words is programmed to a '1', then the value of SPLLEN is ignored.

You can see how to access OSCCON in page 37. Then find other SO questions about how to write directly to memory in an embedded environment. HINT

Sorenp
  • 320
  • 2
  • 12