PIC32MX695F512H Interrupt
Posted: 10 Feb 2011 01:37
I have try the Timer1 interrupt example and the USB interrupt example for the PIC32MX460F512L and the two are working very well.
I've try to port them to PIC32MX695F512H device and with this devie it don't work. First I've seen that ICS_SRC (inside the interrupt handler) don't exist on this part so I changed it to ICS_SOFT.
But the strangest thing is everytime I compile, the SRS Priority Level always decrease by 1. There is also 2 places where this priority can be set is it normal ? Are they supposed to be the same ?
Here the code I used for my simple test :
I've try to port them to PIC32MX695F512H device and with this devie it don't work. First I've seen that ICS_SRC (inside the interrupt handler) don't exist on this part so I changed it to ICS_SOFT.
But the strangest thing is everytime I compile, the SRS Priority Level always decrease by 1. There is also 2 places where this priority can be set is it normal ? Are they supposed to be the same ?
Here the code I used for my simple test :
Code: Select all
sbit LED0 at LATD0_bit;
sbit LED0_dir at TRISD0_bit;
void Timer1_interrupt() iv IVT_TIMER_1 ilevel 7 ics ICS_SOFT {
T1IF_bit = 0; // Clear T1IF
LED0 = ~LED0; // Toggle LED0
}
void main()
{
JTAGEN_bit = 0;
AD1PCFG = 0xFFFF; // Initialize AN pins as digital
LED0_dir = 0;
TMR1 = 0; // reset timer value to zero
PR1 = 65535; // Load period register
//PR1 = 156; // 1 KHz
T1IP0_bit = 1; // set interrupt
T1IP1_bit = 1; // priority
T1IP2_bit = 1; // to 7
TCKPS0_bit = 1; // Set Timer Input Clock
TCKPS1_bit = 1; // Prescale value to 1:256
EnableInterrupts(); // Enable all interrupts
T1IE_bit = 1; // Enable Timer1 Interrupt
ON__T1CON_bit = 1; // Enable Timer1
while(1);
}