Dear Sir,
The following code is working fine in simulator mode, when TC is matching with MR0 interrupt is getting generated and the control is moving to timer1 ISR.
If the same code if it is loaded to the hardware board the code is running fine but when TC matches to MR0, interrupt is generated and TC is getting reset but it is not entering into ISR .
I have checked with other interrupt programs like SPI0,1 that program also working fine with simulator but when it is loaded to the hardware it is not entering into ISR but interrupt is generated(seen on interrupt status register)
can anyone tell me why it is not working in hardware? thank you
#include <LPC22xx.H> /******************************************************************* * Name : DefinePins * Desc: For configuring port pins and setting the direction * Inputs: None * outputs: None * *******************************************************************/ void DefinePins(void) { PINSEL0 = 0x80058055; PINSEL1 = 0x00400000; IODIR0 = 0x00782400; IODIR1 = 0x00FF0000; IOSET0 = 0x00782000; IOSET1 = 0x00FF0000; } /******************************************************************* * Name: Timer1_isr * Desc: Interrupt service routine for timer1 * Inputs: None * outputs: None * Remarks if any: *******************************************************************/ void Timer1_isr() __irq { unsigned short i,a=0; /* some dummy code*/ for(i=0;i<100;i++); a++; VICVectAddr =0x00000000; /* Acknowledge Interrupt */ } /******************************************************************* * Name: InitTimer1 * Desc: Timer1 initialization interrupt every 1ms * Inputs: None * outputs: None * Remarks if any: *******************************************************************/ void InitTimer1(void) { PCONP=0X0544; /* to enable timer1, I2C and SPI ports */ T1IR = 0x00000000; T1MCR = 0x00000003; /* Reset and interrupt when MR0 matches TC */ T1MR0 = (1600 - 1); /* some delay */ VICVectAddr1 = (unsigned long)Timer1_isr; /* slot 1 is allocated */ VICVectCntl1 = 0x00000020 | 5; /* to configure as IRQ */ VICIntEnable = 0x00000020; /* to enable timer1 interrupt*/ } /******************************************************************* * Name: EnableTimer1 * Desc: For timer1 enabling * Inputs: None * outputs: None * Remarks if any: *******************************************************************/ void EnableTimer1(void) { T1TCR = 0x00000001; /* to run the timer*/ } /****************************************************************************** ** Main Function main() ******************************************************************************/ int main (void) { unsigned short i,a=0; InitTimer1(); EnableTimer1(); for(i=0;i<100;i++); /* some dummy code*/ a++; while(1); }