PIC16F1938 - Oscilator Module (1) |
OSCCON register must be altered to setup the internal oscillator.
If SCS<1:0> bits are 10 or 11 the system clock uses the internal oscillator block. Bits IRCF<3:0> are used to select the oscillator frequency.
OSCCON Register (1) |
For example the function used to initialize the internal oscillator module at a frequency of 16 MHz will look like this:
void InitIntOsc(void) {
// system clock uses the internal oscillator (SCS<1:0> = 11)
OSCCON |= 0x03;
// set the frequency to 16 MHz
OSCCON |= 0x78;
}
(1) PIC16(L)F1938/9 Datasheet - PDF!
No comments:
Post a Comment