This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Edge based vs.level based interrupt

Hi all,

The C167 has edge based external interrupts (programmable to rising/falling/both). Does anybody have a reference to info on how to interface it with a level based interrupt device (e.g. an external multi-port UART)? When you OR several interrupt sources together, you miss interrupts. What's the "industry standard" way of handling this?

I just checked the datasheet of an XC167 and it also has edge based external interrupts only. Could somebody explain, to a simple software engineer :-), what the advantage of edge based interrupts is? Level based seems to make alot more sense to me; it's plain and simple.

Regards,
Joost Leeuwesteijn

Parents Reply Children
  • in general (I know not other case) level interrupts can only be used where the ISR issue an I/O signal that makes the interrupting device remove the interrupt level.

    That's how our UART works, but the C167 can only handle edge based external interrupts. I was wondering how to interface the two. Level based makes more sense to me, handle the interrupt and give an ACK by clearing the interrupt.

    The second issue is that the UART has 4 ports, each generating a level based interrupt but we only have one external interrupt port available on the C167. A simple OR of the interrupts lines (sharing) doesn't work because the C167 is only edge based. When 2 ports generate an interrupt, the C167 will not be able to detect both interrupts/edges. Level based interrupts seem to be more flexible. If you share an interrupt line, a second interrupt source will keep the line high, even after clearing a first interrupt source. With edge based interrupts that's not possible, the edge is already gone. There's a chance that you miss interrupts when using edge based.

    Is there anyone who ran into this before and figured out a solution? Interfacing multiple level based interrupt sources to a C167 seems like something that has been done before. (Maybe I shouldn't have set the toolset to C16X to reach a bigger crowd).

    Regards,
    Joost Leeuwesteijn

  • If the C166 is able to read the logic level of the pin that is used for the external interrupt, you will have to write your interrupt handler so that it polls the different UARTs and service them until the ORed interrupt signal gets deactivated.

    Just to make sure, you should also consider adding a poll of the interrupt input pin in the main loop, in case you manage to get your interrupt handler out of sync.