Getting a 16F1937 to run at 32mhz
Posted: Fri Mar 27, 2020 4:43 pm
Hi All,
Up until now i have always used a crystal with Pics but i am trying to get the internal osc running at 32mhz for my next project but cannot get it to run a program at the correct speed (turn out on, wait 1 sec, turn out off, wait 1 sec)
I have read the pic datasheet and i think i have done what it asks but it is still running really slowly, i have attached pictures.
I am also not sure what to set the project clock speed to in FC as the chip should be running at 32mhz so shouldn't it also be set for 32 and not the 8 that will be multiplied by 4?
Thanks
Ben
Here is the bit from the datasheet
5.2.2.6 32 MHz Internal Oscillator
Frequency Selection
The Internal Oscillator Block can be used with the 4X PLL associated with the External Oscillator Block to produce a 32 MHz internal system clock source. The following settings are required to use the 32 MHz internal clock source:
• The FOSC bits in Configuration Word 1 must be set to use the INTOSC source as the device system clock (FOSC<2:0> = 100).
• The SCS bits in the OSCCON register must be cleared to use the clock determined by FOSC<2:0> in Configuration Word 1 (SCS<1:0> = 00).
• The IRCF bits in the OSCCON register must be set to the 8 MHz HFINTOSC set to use (IRCF<3:0> = 1110).
• The SPLLEN bit in the OSCCON register must be set to enable the 4xPLL, or the PLLEN bit of the Configuration Word 2 must be programmed to a ‘1’.
The 4xPLL is not available for use with the internal oscillator when the SCS bits of the OSCCON register are set to ‘1x’. The SCS bits must be set to ‘00’ to use the 4xPLL with the internal oscillator.
Up until now i have always used a crystal with Pics but i am trying to get the internal osc running at 32mhz for my next project but cannot get it to run a program at the correct speed (turn out on, wait 1 sec, turn out off, wait 1 sec)
I have read the pic datasheet and i think i have done what it asks but it is still running really slowly, i have attached pictures.
I am also not sure what to set the project clock speed to in FC as the chip should be running at 32mhz so shouldn't it also be set for 32 and not the 8 that will be multiplied by 4?
Thanks
Ben
Here is the bit from the datasheet
5.2.2.6 32 MHz Internal Oscillator
Frequency Selection
The Internal Oscillator Block can be used with the 4X PLL associated with the External Oscillator Block to produce a 32 MHz internal system clock source. The following settings are required to use the 32 MHz internal clock source:
• The FOSC bits in Configuration Word 1 must be set to use the INTOSC source as the device system clock (FOSC<2:0> = 100).
• The SCS bits in the OSCCON register must be cleared to use the clock determined by FOSC<2:0> in Configuration Word 1 (SCS<1:0> = 00).
• The IRCF bits in the OSCCON register must be set to the 8 MHz HFINTOSC set to use (IRCF<3:0> = 1110).
• The SPLLEN bit in the OSCCON register must be set to enable the 4xPLL, or the PLLEN bit of the Configuration Word 2 must be programmed to a ‘1’.
The 4xPLL is not available for use with the internal oscillator when the SCS bits of the OSCCON register are set to ‘1x’. The SCS bits must be set to ‘00’ to use the 4xPLL with the internal oscillator.