PDA

View Full Version : 16F1827 - Slow Clock



Ioannis
- 22nd June 2018, 01:41
Apparently there is something I do not see. And is 3.30 am...

The following settings make the PIC run at 1/4 the speed it is supposed to.



#config
__config _CONFIG1, _FOSC_INTOSC & _WDTE_OFF & _PWRTE_ON & _MCLRE_OFF & _CP_ON & _CPD_OFF & _BOREN_ON & _CLKOUTEN_OFF & _IESO_OFF & _FCMEN_OFF
__config _CONFIG2, _WRT_OFF & _PLLEN_ON & _LVP_OFF & _STVREN_OFF ;& _BORV_25
#endconfig

DEFINE OSC 32


If I set the DEFINE OSC at 8 then the speed is as expected. But the above config is for 8 x 4 PLL = 32MHz...

Where am I wrong?

Ioannis

richard
- 22nd June 2018, 02:41
osccon=$70


or

& _PLLEN_OFF


osccon=$F0


also


it takes a little time for pll to stabilise

while !oscstat.6 : wend ;wait for pll ready

Ioannis
- 22nd June 2018, 02:54
Hmm, I did OSCCON=$F0 but at the same time & _PLLEN_ON.

Does it matter?
Ioannis

richard
- 22nd June 2018, 03:00
you would think not , but I have been using mplabx/mcc mostly lately and for some chips it does indeed matter it seems.
soft selecting pll always works so that's what i'm used to doing ,

Ioannis
- 22nd June 2018, 03:24
And it does work as expected!

Thanks Richard.

Ioannis