PIC32MX695F512H Interrupt

Beta Testing discussion on mikroC PRO for PIC32.
Post Reply
Author
Message
Toley
Posts: 922
Joined: 03 Sep 2008 16:17

PIC32MX695F512H Interrupt

#1 Post by Toley » 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.
SRS_7.gif
SRS_7.gif (5.04 KiB) Viewed 3793 times
SRS_6.gif
SRS_6.gif (5.02 KiB) Viewed 3793 times
There is also 2 places where this priority can be set is it normal ? Are they supposed to be the same ?
SRS_select.gif
SRS_select.gif (30.77 KiB) Viewed 3793 times
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);
}
Serge T.
Learning is an endeless process but it must start somewhere!

User avatar
srdjan
mikroElektronika team
Posts: 1552
Joined: 28 Dec 2005 12:47
Location: Serbia

Re: PIC32MX695F512H Interrupt

#2 Post by srdjan » 10 Feb 2011 16:35

Hi,
There is also 2 places where this priority can be set is it normal ? Are they supposed to be the same ?
These two places are connected, they should change simultaneously.

Have you by any chance used Interrupt Assistant to declare your interrupt handler?
Currently there is a problem with this mcu definition file which can cause such an error in interrupt assistant.
We'll fix this for release.

Post Reply

Return to “mikroC PRO for PIC32 Beta Testing”