It is always better to post the complete project when you want some help.
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.
Just a guess: You may have forgotten to reset the interrupt cause in your capture isr.
Ultrasonic_Interrupt_ISR_ClearPending(); // You don't need that
Capture_Count=0; // (double)((uint16)65535-Ultrasonic_Timer_ReadCounter());
UART_1_PutString(UART_line); // No lengthy code in a handler
Ultrasonic_Timer_ReadStatusRegister(); // Will clear the interrupt flag, See datasheet
Hi Bob, thanks for the reply, fixed the problem with ReadStatusRegister. However for the ClearPending(), under what kind of condition do I need to execute ClearPending() when interrupt happens? I read the datasheet and it said some interrupts are clear-on-read like GPIO,UART.
1 of 2 people found this helpful
I only used ClearPending() outside an interrupt handler to make sure that there was not an "old" interrupt waiting before I enabled / started the isr component.