Pic Micro, Arduino, Atmel, Microchip, Freescale, Texas Instrument, ecc. Strumenti di sviluppo, firmware e progetti.
#3055
Buona sera, ho realizzato su una millefori un piccolo circuito con un pic32mx230f064b. Ho connesso oltre alle almentazioni (per ora) solo un quarzo da 12MHz ai pin 9-10, tramite condensatori verso massa da 33pF.

Al momento ho scritto solo la routine di setup iniziale. Ho inserito un ciclo in cui valuto lo stato dell'oscillatore tramite la variabile OSCCON. In particolare aspetto che sia stabilizzato il PLL. Riporto il semplice codice con la configurazione iniziale:

Codice: Seleziona tutto    #pragma config UPLLEN   = ON           // USB PLL Enabled
    #pragma config FPLLMUL  = MUL_15        // PLL Multiplier
    #pragma config UPLLIDIV = DIV_2         // USB PLL Input Divider
    #pragma config FPLLIDIV = DIV_2         // PLL Input Divider
    #pragma config FPLLODIV = DIV_1         // PLL Output Divider
    #pragma config FPBDIV   = DIV_1         // Peripheral Clock divisor
    #pragma config FWDTEN   = OFF           // Watchdog Timer
    #pragma config WDTPS    = PS1           // Watchdog Timer Postscale
    #pragma config FCKSM    = CSDCMD        // Clock Switching & Fail Safe Clock Monitor
    #pragma config OSCIOFNC = OFF           // CLKO Enable
    #pragma config POSCMOD  = HS            // Primary Oscillator
    #pragma config IESO     = OFF           // Internal/External Switch-over
    #pragma config FSOSCEN  = OFF           // Secondary Oscillator Enable (KLO was off)
    //#pragma config FNOSC    = PRIPLL        // Oscillator Selection
    #pragma config CP       = OFF           // Code Protect
    #pragma config BWP      = OFF           // Boot Flash Write Protect
    #pragma config PWP      = OFF           // Program Flash Write Protect
    #pragma config ICESEL   = ICS_PGx1      // ICE/ICD Comm Channel Select

    #pragma config JTAGEN   = OFF
    #pragma config DEBUG    = ON            // Debug mode ON*/

void main(void){       
        int  value;
        value = SYSTEMConfigWaitStatesAndPB( GetSystemClock() );

        // Enable the cache for the best performance
        CheKseg0CacheOn();

        INTEnableSystemMultiVectoredInt();

        value = OSCCON;
        while (!(value & 0x00000020)){
            value = OSCCON;    // Wait for PLL lock to stabilize
        }

        TRISBbits.TRISB0 = 0;
        TRISBbits.TRISB1 = 0;

        LATBbits.LATB0 = 0;
        LATBbits.LATB1 = 0;
       
    }


Il problema è che non esco dal ciclo while: il bit OSCCON (il V bit di OSCCON "PLL module is in lock or PLL module start-up timer is satisfied") non va mai ad 1.

Che fare?
Grazie.
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]

Visita il nostro canale telegram