Hi, I just use Kinetis E series MCU. And use GPIO_demo code to test my board, I wanna use Interrupt service program to light LED for 1Hz. But never access the Interrupt service program, I check the demo program, and set NVIC_ISER and RTC_RTIE, this 's OK. However, dont using interrput program to lingt LED, and polling RTIF flag code is OK.
I dont kown how to access interrupt service program, THX for your Help.
Hi Scofield,
When using an Interrupt Service Routine (ISR) you have to consider next conditions:
As you can see on Interrupt Vector Assignments table on MCU’s reference manual, PIT_CH0 vector is expressed as 38, however, when enable this vector on NVIC module, we must select IRQ value (38 – 16 = 22; It subtracts 16 because the first 16 vectors are core-vectors.)
/* Enable interrupts (clear PRIMASK) */
#define ENABLE_INTERRUPTS asm(" CPSIE i");
void PIT_CH0_IRQHandler(void) {
/* Clear Timer Interrupt Flag */
PIT_TFLG0 |= PIT_TFLG_TIF_MASK;
/* Do your ISR proccess here */
}
I attached the project (It was done using a KE04 board) but hope this could serve as example.
Regards,
Isaac Avila