Problem with interrupt in dspic3010

General discussion on mikroBasic PRO for dsPIC30/33 and PIC24.
Post Reply
Author
Message
metro_ravi
Posts: 2
Joined: 15 Dec 2015 09:50

Problem with interrupt in dspic3010

#1 Post by metro_ravi » 15 Dec 2015 10:50

dspic3010 is not generating interrupt, i have tried timer 1 interrupt , external interrupt INT0, ADC Int.

I have tried the code in other compiler(XC16) it works fine, so the problem is not in the hardware.

The problem seems to be in the compiler.
The interrupt flags are generating which checked by polling them, but the ISR is not executed.

Here is the test code which i am running

Code: Select all

#define HZ_LED LATB3_bit

void Timer1Int() iv IVT_ADDR_T1INTERRUPT {
  T1IF_bit = 0;             // Clear T1IF
  HZ_LED=~HZ_LED;
}

any suggestions????

void main() {

  ADPCFG = 0xFFFF;          // Initialize AN pins as digital
  TRISB  = 0;               // initialize PORTB as output
  IPC0   = IPC0 | 0x1000;   // Interrupt priority level = 1
  T1IF_bit = 0;             // Clear T1IF
  T1IE_bit = 1;             // Enable Timer1 interrupts

  T1CON = 0x8030;           // Timer1 ON, internal clock FCY, prescaler 1:256
  HZ_LED=1;
  while (1)                 // Endless loop, interrupted by Timer1Int
    ;
} 

Post Reply

Return to “mikroBasic PRO for dsPIC30/33 and PIC24 General”