mihail19871987
Newbie level 3
- Joined
- Feb 22, 2015
- Messages
- 3
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Location
- Bulgaria
- Activity points
- 19
Code:
// Include Header Files
#include <p32xxxx.h> // Include PIC32 specifics header file
#include <plib.h> // Include the PIC32 Peripheral Library
// Config Bits
#pragma config FNOSC = FRCPLL // Internal Fast RC oscillator (8 MHz) w/ PLL
#pragma config FPLLIDIV = DIV_2 // Divide FRC before PLL (now 4 MHz)
#pragma config FPLLMUL = MUL_20 // PLL Multiply (now 80 MHz)
#pragma config FPLLODIV = DIV_2 // Divide After PLL (now 40 MHz)
// see figure 8.1 in datasheet for more info
#pragma config FWDTEN = OFF // Watchdog Timer Disabled
#pragma config ICESEL = ICS_PGx1 // ICE/ICD Comm Channel Select (pins 4,5)
#pragma config JTAGEN = OFF // Disable JTAG
#pragma config FSOSCEN = OFF // Disable Secondary Oscillator
#define SYSCLK 40000000L
int main(){
SYSTEMConfigPerformance(SYSCLK);
TRISBbits.TRISB5 = 0; // Set RB5 as digital output
INTEnableSystemMultiVectoredInt();
//T4CON = 0x0; // Stop 16-bit Timer4 and clear control register
//T5CON = 0x0; // Stop 16-bit Timer5 and clear control register
T4CONSET = 0x0038; // Enable 32-bit mode, prescaler at 1:8,
TMR4 = 0x0; // Clear contents of the TMR4 and TMR5
PR4 = 0x00FFFFFF; // Load PR4 and PR5 registers with 32-bit value
IPC5SET = 0x00000004; // Set priority level = 1
IFS0CLR = 0x00100000; // Clear the Timer5 interrupt status flag
IEC0SET = 0x00100000; // Enable Timer5 interrupts
T4CONSET = 0x8000; // Start timer
while(1);
return 1;
}
void __ISR(20, ipl1) Timer1IntHandler(void){
LATBINV = 0x0020;
IFS0CLR = 0x00100000;
}
What is wrong?