LPC1347 understanding low/high-level interrupt

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC1347 understanding low/high-level interrupt

929 Views
mateuszkiełbasa
Contributor III

I am bit confused about low/high level interrupt handling in lpc1347. I think i understand differences between edge and level interrupts. Edge interrupt is fired when pin status changes from 0 to 1 (rising edge) and 1 to 0 (falling edge), thus this is type of event, which occurs when running program, thus I should exprext only one interrupt when voltage changes. Level sensitive interrupt is fired when particular pin is LOW or HIGH for a period of time, thus I should expect permanent interrupts before the status of pin will change. In my lpc1347 I'd like to write a program to examine a situation described above. I configured PINTSEL and PININT registers and I have an interrupt when the pin is HIGH (the built-in LED toggles). But...

void PIN_INT0_IRQHandler(void) {
   LPC_PININT->IST = 1;
   j = 0;
   while (j < 1000000) { j++; }
      LPC_GPIO_PORT->NOT[0] = 1 << 7;
}

I  get only two interrupts, when the pin goes HIGH and the pin goes LOW (because of the change IENF register by clearing IST register...). My question is can I write program which will interrupt premanently while the pin is HIGH?

Labels (1)
0 Kudos
1 Reply

595 Views
soledad
NXP Employee
NXP Employee

Hello,

Well, as you may understand,  the interrupt process takes some time between, enter to the interrupt vector and execute the code, and  you are trying to add some  DELAY in the interrupt function, which it is not going to be correct, since during the delay another interrupt it is in the queue, to get process, so once the interrupt in the queue it is process you are not finish the last one, when you get the new one.  That it is totally wrong you need to avoid this kind of behavior

the IRQ handlers, need to be short as possible just, move some flags, and in the main the toggle function based on the flags.


Have a great day,

Soledad

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos