News:

;) This forum is the property of Proton software developers

Main Menu

PIC12F1572 at 32Mhz

Started by rick.curl, Today at 12:03 AM

Previous topic - Next topic

rick.curl

Hi folks- It's been a while since I've done much coding, so I seem to be starting out as a noob all over again. I'm trying to run a PIC12F1572 at 32Mhz using the internal oscillator, but I can't seem to get it to go beyond 8Mhz. The OSCSTAT bits tell me that the PLL is enabled, but none of the internal oscillators indicate that they are ready.

What am I doing wrong?

Snippet of the code:
Device  12F1572

    Xtal 32
    Reminders off
'-------------------------------------------------------------------------------
'**** Added by Fuse Configurator ****
' Use the Fuses Tab to change these settings

Config1 FOSC_INTOSC, WDTE_OFF, PWRTE_ON, MCLRE_OFF, CP_OFF, BOREN_ON, CLKOUTEN_OFF
Config2 WRT_OFF, PLLEN_ON, STVREN_OFF, BORV_LO, LPBOREN_OFF, LVP_OFF

'**** End of Fuse Configurator Settings ****
'-------------------------------------------------------------------------------
    Reminders On

    osccon = %11110010
    CM1CON0 = 01  'comparator off
    TRISa = %11000000
    ANSELa = 0           'all pins digital


   porta = 0   'set all pins to zero
   DelayMS 100  'wait a bit before starting

Mainloop:
    toggle porta.0
    delayms 1000
    goto mainloop

I have an LED attached to portA.0 and it is blinking 4 seconds on and 4 seconds off.

Any guidance would be greatly appreciated!!

-Rick

Pepe

#1
;-------------------------------------------------------------------------------
;**** Added by Fuse Configurator ****
; Use the Fuse Configurator plug-in to change these settings

Device = 12F1572

Config1 FOSC_INTOSC, WDTE_OFF, PWRTE_OFF, MCLRE_OFF, CP_OFF, BOREN_OFF, CLKOUTEN_OFF
Config2 WRT_OFF, PLLEN_ON, STVREN_OFF, BORV_LO, LPBOREN_OFF, LVP_OFF

;**** End of Fuse Configurator Settings ****
;-------------------------------------------------------------------------------

Declare Xtal = 32
Declare Optimiser_Level = 3
Declare Create_Coff On
Declare Watchdog off
Declare Dead_Code_Remove = 1        ' Remove dead code
Declare Reminders Off
Declare Hints Off

OSCCON = 0b11110000

While OSCSTAT.6 <> 0
Wend


TRISA = 0
PORTA = 0    'set all pins to zero

DelayMS 100  'wait a bit before starting

Do
    Toggle PORTA.0
    DelayMS 1000
Loop

rick.curl

Thanks, Pepe- But on the real hardware it's still running at 8 Mhz. The LED is blinking 4 seconds on and 4 seconds off. This is getting interesting.......

Pepe

#3
Put OSCCON = 0b11110000

The 4x PLL is not available for use with the internal
oscillator when the SCSx bits of the OSCCON register
are set to '1x'. The SCSx bits must be set to '00' to use
the 4x PLL with the internal oscillator.

rick.curl

Quote from: Pepe on Today at 01:54 AMPut OSCCON = 0b11110000

The 4x PLL is not available for use with the internal
oscillator when the SCSx bits of the OSCCON register
are set to '1x'. The SCSx bits must be set to '00' to use
the 4x PLL with the internal oscillator.
That did it!  I misread the spec sheet.
Thank you Pepe!

-Rick