I don't know why my interrupt handler doesn't work... can anyone of you please help me? ): Below is my code (the highlighted part is my interrupt handler):
#include <hidef.h> /* for EnableInterrupts macro */
#include "derivative.h" /* include peripheral declarations */
#include "IIC.h"
#include "LEDs.h"
#include "ICG.h"
#include "Delays.h"
#include "initialization.h"
#include "MPR083.h"
#include "MPRIIC.h"
#include "TPMs.h"
#include "IRQ_ms_User.h"
#include "IRQ_ms_TPM1C0.h"
#include "LC60IIC_IRQ.h"
unsigned char ucIIC_SlaveData;
unsigned char ucIIC_LastSlaveData;
unsigned char ucIIC_AckStatus;
unsigned char ucMPRIIC;
unsigned char ucIIC_DataRcvd;
unsigned char ucPadNumber;
unsigned char ucLC60_Flag=0;
unsigned char uctestcnt=0; //test
struct mpr_st stAns;
interrupt VectorNumber_Vtpm1ch0 void TPM1C0IRQ(){ //Timer IRQ backbone handler
TPM1C0_setNextIRQ(CNT_10MHZ_FOR_1MS); //prepare for next ms IRQ
IRQ_ms_Handler_(); //IRQ Handler to call user functions every 1,10,100,and 1000 ms
}
interrupt VectorNumber_Virq void IRQ_IIC(){ //IIC interrupt upon touch
IRQSC_IRQACK=1;//1=Clear the IRQ Flag in LC60;
LED4_turnOn();
ucLC60_Flag=1;
uctestcnt++;
LED4_turnOff();
}
void main(void) {
SOPT1_COPE=0; // Disable watchdog timer
ICG_setBusClk(ICGC2_10MHZ); // 10.468 Mhz,wait 0.2s
PTAD_PTAD3=0; // 1=off display(~DSEL)
LED1_init();
LED4_init();
LED5_init();
IIC_init(); // EnableIIC,90kbs;noIRQ,master-mode;~ack;sendSTART+STOP;include delay for stabilisation
IRQ_init();
MPR_init();
//-----TPM INITIALIAZATION------------------------
TPM1_init(); // Use BusClk/16;O/p compare mode;no overflow IRQ
TPM1C0_init(); // TimerCh0 TPM1C0/PTC2; enable IRQ
TPM1C0_setToggleMode();// Toggle TPM1C0/PTC2 J101p13
//-----ENABLE INTERRUPT---------------------------
TPM1C0_enableIRQ(); // Enable TPM2Ch0 interrupt
//IRQ_IIC();
IRQ_enable();
MPRIIC_IRQ_enable();
EnableInterrupts;
for(;;) {
if(ucLC60_Flag==1){
LED1_turnOn();
ucPadNumber=MPR_readPadNo(); //Return pad position
MPRIIC_clear();
ucLC60_Flag=0; //RESET
LED1_turnOff();
}
}// loop forever
}
I will be very glad if any of you can help me.... thank you very much...