News:

Let's find out together what makes a PIC Tick!

Main Menu

12F1840 PLL problem

Started by See_Mos, May 03, 2026, 04:13 PM

Previous topic - Next topic

See_Mos

Les has provided a template 12F1840 32MHz.inc

A problem that I came across a long time ago is that the timing was all wrong so I added an LED toggled at 10mS to give 50Hz output which is an easy timing comparison using the oscilloscope.

According to the data sheet Les' template is correct.  With PLLEN_ON :-

Proc Osc_32MHz()
    OSCCON = %11110010                                              ' Enable the 4xPLL so the device operates at 32MHz with its internal oscillator
    OSCTUNE = $00
    BORCON = $00
EndProc

But the only way that I can get the PLL to work is if I change OSCON to %11110000 and I cannot find out why.

Any ideas please?

Pepe

5.2.1.4 4X PLL
The oscillator module contains a 4X PLL that can be used with both external and internal clock sources to provide a system clock source. The input frequency for the 4X PLL must fall within specifications. See the PLL Clock Timing Specifications in Section30.0 "Electrical Specifications". The 4X PLL may be enabled for use by one of two methods:
1. Program the PLLEN bit in Configuration Word 2 to a '1'.
2. Write the SPLLEN bit in the OSCCON register to a '1'. If the PLLEN bit in Configuration Word 2 is programmed to a '1', then the value of SPLLEN is ignored.

JackB

#2
Device = 12F1840
Declare Xtal = 32     

OSCCON = $70  ' = %01110000

Config1 FOSC_INTOSC , WDTE_OFF , PWRTE_OFF , MCLRE_OFF , CP_OFF , CPD_OFF , BOREN_OFF
Config2 WRT_OFF , PLLEN_ON , LVP_OFF

Let us know if it's working