Hello, I have the following ISR code running on the CC2541:
_PRAGMA(vector=PORT1_VECTOR) __near_func __interrupt void Port1_ISR(void) { IEN0 &= ~EA_GLOBAL; //Disable all interrupts if( P1IFG & ADCDRDY ) //ADCDRDY Triggered the P1 Interrupt { get_conv_dat(); process_conv_dat(); gpio_state ^= 0xF0; //Toggle ADS130E08 GPIOs reg_map_arr[12].contents = gpio_state; spi_ads130e08(W_OPCODE, ®_map_arr[12]); P1IFG = ~ADCDRDY; //Clear the flag for src of intterupt } //IRCON2 &= ~P1IF; //Clear Port 1 flag in Interrupt Flags 5 SFR IEN0 |= EA_GLOBAL; //Re-enable interrupts }
The ISR triggers correctly on each falling edge of the ADC data ready line, however my problem lies with the if statement that checks the Port 1 Interrupt Status Flag register to see which of the port 1 pins is the source of the interrupt. The program falls into the if statement upon the first occurrence of the ISR, however, upon successive events, the code goes over the if statement (not executing my data acquisition code). Any ideas as to why this is happening?