Bonjour,
Afin de me familiariser avec ce micro, je fait quelque essai de configu et ne comprend pas une chose, pourquoi l'horloge de mon système cadence à 80MHZ alors qu'il devrait etre a 160Mhz d'après la programmation ci-dessous:
Mon timer met 816uS pour compter de 0000 à FFFF, donc correspond à 80Mhz et non pas 160Mhz comme configuré.Code:/********************************************************************* * * PIC32MX * ********************************************************************* * * FileName: main.c * * Dependencies: plib.h * * Processor: PIC32MX * * Complier: MPLAB C32 * MPLAB IDE * * Company: * * auteur: * *********************************************************************/ #include <plib.h> #include "fonction.h" #define extern #include "definition.h" #undef extern #if defined (__32MX360F512L__) || (__32MX460F512L__) || (__32MX795F512L__) || (__32MX430F064L__) #pragma config FPLLMUL = MUL_20, FPLLIDIV = DIV_1, FPLLODIV = DIV_1, FWDTEN = ON #pragma config POSCMOD = OFF, FNOSC = FRCPLL, FPBDIV = DIV_1 #endif void init_port(void) { // Clear PORTA bits so there are no unexpected flashes when setting // them to output in the next step mPORTDClearBits(BIT_2 |BIT_1 | BIT_0); mPORTBClearBits(BIT_8|BIT_9 |BIT_10 | BIT_11); // Make lower four bits of PORTD as output mPORTDSetPinsDigitalOut(BIT_3 |BIT_2 |BIT_1 | BIT_0); mPORTBSetPinsDigitalOut(BIT_8|BIT_9 |BIT_10 | BIT_11); } void init_timer1(void) { // Configure Timer 1 using PBCLK as input, 1:256 prescaler // Period matches the Timer 1 frequency, so the interrupt handler // will trigger every one second... //OpenTimer1(T1_ON | T1_SOURCE_INT | T1_PS_1_1, PERIOD); T1CONbits.ON=1; //enable clock timer1 T1CONbits.TCS=0; //internal clock T1CONbits.TCKPS=0; //Prescalaire 1:1 INTClearFlag(INT_T1); // Set up the timer interrupt //INTEnable(INT_T1, INT_ENABLED); ConfigIntTimer1(T1_INT_ON | T1_INT_PRIOR_2); } // Configure the Timer 1 interrupt handler void __ISR(_TIMER_1_VECTOR, ipl2) Timer1Handler(void) { // Clear the interrupt flag INTClearFlag(INT_T1); mPORTDToggleBits(BIT_2 | BIT_1 | BIT_0); mPORTBToggleBits(BIT_8|BIT_9 |BIT_10 | BIT_11); } int main(void) { // Enable multi-vector interrupts INTConfigureSystem(INT_SYSTEM_CONFIG_MULT_VECTOR); INTEnableInterrupts(); INTEnableSystemMultiVectoredInt();//ClrWdt(); init_timer1(); init_port(); init_variable();//ClrWdt(); //PORTSetPinsDigitalOut(IOPORT_D,BIT_3); while (1) { } return 0; }
Avez vous une idée
Merci
-----