Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

PLL in PIC16f1455 does not work

Status
Not open for further replies.

kappa_am

Full Member level 6
Joined
Jul 16, 2012
Messages
331
Helped
19
Reputation
38
Reaction score
19
Trophy points
1,298
Location
Vancouver
Activity points
3,859
Hi all,
although I programmed many PIC24 and 32, I am stuck in PLL configuration of a PIC16F1455.
everything seems correct but the results show that PLL does not work.
here is my configuration:

CONFIG1=0x089C;
CONFIG2=0x1DC3;
OSCCON=0xFC;
ACTEN_BIT =1;
ACTLOCK_BIT=1;

I enabled PLL, set all scales and adjustment bits, but still...
I would be grateful if you help me on this issue.
 

Hi
If there is problem with configuration I prefer to use MPLAB Code Configurator.
It generates warning:
By setting System Clock Select to INTOSC the PLL is not applicable
 

Thank you for your reply
But in the datasheet, page 59, it says: "The oscillator module contains a PLL that can be used with both external and internal clock sources to provide a system clock source. By setting the SPLLMULT bit of the OSCCON register, 3x PLL is selected. By clearing the SPLLMULT bit of the OSCCON register, 4x PLL is selected."

What's the problem?
 

I have no experience with PIC16f1455 PLL, I only test Code Configurator, and it looks like problem is with SCS bits in OSCON register. Setting 1x "Internal oscillator block" is not allowed if you would like to use PLL, it needs 00 - "Clock determined by FOSC<2:0> in Configuration Words" to disable warning. And then you could set INTOSC in CONFIG1.
It is very strange, but it could be source of problem...
 

I found another thing. Although I use internal oscillator, and have defined RA5 and RA4 as I/O. They do not act as I/O. I think they are still oscillator pins.
strange!
 

I don't understand your configuration settings at all?, CONFIG1 and CONFIG2 are 14 bit registers and in your configuration you show them as being 32 bit. Also the configuration settings are totally wrong.
 

It looks like there was config problem how do you configure your PIC - which compiler? what is your #pragma code?

- - - Updated - - -

I think you should try to use MPLAB code configurator and experiment yourself on live circuit with different settings.
It is for XC8 compiler, bur there is no problem to rewrite settings to your own compiler.
 

They are 16-bit not 32-bit. I have checked them bit by bit looking to datasheet nothing is wrong. could you explain your opinion more?

- - - Updated - - -

I use MikroC. actually in mikroc we could not change the config registers in program, instead we adjust them using project setting. At first I doubt it may have bug, but it is ok!
confused.
It looks like there was config problem how do you configure your PIC - which compiler? what is your #pragma code?

- - - Updated - - -

I think you should try to use MPLAB code configurator and experiment yourself on live circuit with different settings.
It is for XC8 compiler, bur there is no problem to rewrite settings to your own compiler.
 

I use MikroC. actually in mikroc we could not change the config registers in program, instead we adjust them using project setting.

Exactly as in another compilers.
In MPLAB code config it looks this way:

Code:
// CONFIG1
#pragma config FOSC = INTOSC    // Oscillator Selection Bits->INTOSC oscillator: I/O function on CLKIN pin
#pragma config WDTE = OFF    // Watchdog Timer Enable->WDT disabled
#pragma config PWRTE = OFF    // Power-up Timer Enable->PWRT disabled
#pragma config MCLRE = ON    // MCLR Pin Function Select->MCLR/VPP pin function is MCLR
#pragma config CP = OFF    // Flash Program Memory Code Protection->Program memory code protection is disabled
#pragma config BOREN = ON    // Brown-out Reset Enable->Brown-out Reset enabled
#pragma config CLKOUTEN = OFF    // Clock Out Enable->CLKOUT function is disabled. I/O or oscillator function on the CLKOUT pin
#pragma config IESO = ON    // Internal/External Switchover Mode->Internal/External Switchover Mode is enabled
#pragma config FCMEN = ON    // Fail-Safe Clock Monitor Enable->Fail-Safe Clock Monitor is enabled

// CONFIG2
#pragma config WRT = OFF    // Flash Memory Self-Write Protection->Write protection off
#pragma config CPUDIV = NOCLKDIV    // CPU System Clock Selection Bit->NO CPU system divide
#pragma config USBLSCLK = 48MHz    // USB Low SPeed Clock Selection bit->System clock expects 48 MHz, FS/LS USB CLKENs divide-by is set to 8.
#pragma config PLLMULT = 4x    // PLL Multipler Selection Bit->4x Output Frequency Selected
#pragma config PLLEN = ENABLED    // PLL Enable Bit->3x or 4x PLL Enabled
#pragma config STVREN = ON    // Stack Overflow/Underflow Reset Enable->Stack Overflow or Underflow will cause a Reset
#pragma config BORV = LO    // Brown-out Reset Voltage Selection->Brown-out Reset Voltage (Vbor), low trip point selected.
#pragma config LPBOR = OFF    // Low-Power Brown Out Reset->Low-Power BOR is disabled
#pragma config LVP = ON    // Low-Voltage Programming Enable->Low-voltage programming enabled
and in init code
Code:
// SCS FOSC; SPLLMULT 4xPLL; SPLLEN disabled; IRCF 16MHz_HF; 
    OSCCON = 0x3C;
    // SOSCR disabled; PLLRDY disabled; 
    OSCSTAT = 0x00;
    // TUN 0; 
    OSCTUNE = 0x00;
    // Set the secondary oscillator

and then I rewrite it to another language I use, and till now everytime it was OK.

- - - Updated - - -

I wonder if it could be MikroC problem. Maybe try to install free XC8 compiler, with MPLAB, write simple program and test if it work with your hardware?
 

BTW you are wasting your time writing to OSCSTAT - the whole register is read-only.
Susan
 

It was example of MPLAB Code Configurator v3 generated code ...
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top