# how to know rising or falling edge in ISR?

**URL:** <https://forums.digi.com/t/how-to-know-rising-or-falling-edge-in-isr/10054>\
**Category:** Rabbit\
**Created:** [March 18, 2008, 1:09pm UTC](https://forums.digi.com/t/how-to-know-rising-or-falling-edge-in-isr/10054 "2008-03-18T13:09:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ionymous](https://avatars.discourse-cdn.com/v4/letter/i/ce73a5/32.png) [@ionymous](https://forums.digi.com/u/ionymous)\
**Post date:** [March 18, 2008, 1:09pm UTC](https://forums.digi.com/t/how-to-know-rising-or-falling-edge-in-isr/10054/1 "2008-03-18T13:09:29Z")

</div>

I’m using the RCM4010. I’m new to Rabbit hardware.  
I set up an external interrupt for both rising and falling edges.

In my ISR, how do I know whether I am handling the rising or falling edge?  
Do I just look at the value of the input using BitRdPortI?

Thanks for any help.  
Ion

---

<div class="post-metadata">

**Author:** ![ionymous](https://avatars.discourse-cdn.com/v4/letter/i/ce73a5/32.png) [@ionymous](https://forums.digi.com/u/ionymous)\
**Post date:** [March 19, 2008, 5:50pm UTC](https://forums.digi.com/t/how-to-know-rising-or-falling-edge-in-isr/10054/2 "2008-03-19T17:50:41Z")

</div>

Tech support has informed me:

“You can read the state of the I/O port from within the ISR.”

As far as I can tell, there is no register to check to know how the interrupt you are handling occurred.  
If anyone knows of this, please let me know.  
Ion

---

<div class="post-metadata">

**Author:** ![giacatluong](https://avatars.discourse-cdn.com/v4/letter/g/f19dbf/32.png) [@giacatluong](https://forums.digi.com/u/giacatluong)\
**Post date:** [March 31, 2008, 10:40pm UTC](https://forums.digi.com/t/how-to-know-rising-or-falling-edge-in-isr/10054/3 "2008-03-31T22:40:08Z")

</div>

[QUOTE=ionymous;1451]Tech support has informed me:

“You can read the state of the I/O port from within the ISR.”

As far as I can tell, there is no register to check to know how the interrupt you are handling occurred.  
If anyone knows of this, please let me know.  
Ion[/quote]

It always rise before it falling.  
So it is interrupted (first one) , flag it as it rise.  
Any interruption after that it the inverse of the previous one.

---

<div class="post-metadata">

**Author:** ![ionymous](https://avatars.discourse-cdn.com/v4/letter/i/ce73a5/32.png) [@ionymous](https://forums.digi.com/u/ionymous)\
**Post date:** [April 1, 2008, 2:15am UTC](https://forums.digi.com/t/how-to-know-rising-or-falling-edge-in-isr/10054/4 "2008-04-01T02:15:37Z")

</div>

[QUOTE=giacatluong;1507]It always rise before it falling.  
So it is interrupted (first one) , flag it as it rise.  
Any interruption after that it the inverse of the previous one.[/quote]

An input cannot be generalized this way. What you connect to an input is not the same as what I connect.

Some signals may already be moving high and low before I start up my rabbit, others may be more defined as you describe… starting low.

But even if I was absolutely sure that you signal starts low, I would never build a system that assumes what every other interrupt means. One missed interrupt and the whole system is running under the wrong assumption.  
If I was absolutely 100% positive that there was no possible way to miss an interrupt, I would still check the input value inside the interrupt handler.  
You can only be 100% sure of what you know should happen… but you can’t be 100% sure of possibilities that you’ll never think of.

Ion

---

<div class="post-metadata">

**Author:** ![giacatluong](https://avatars.discourse-cdn.com/v4/letter/g/f19dbf/32.png) [@giacatluong](https://forums.digi.com/u/giacatluong)\
**Post date:** [April 1, 2008, 2:27am UTC](https://forums.digi.com/t/how-to-know-rising-or-falling-edge-in-isr/10054/5 "2008-04-01T02:27:33Z")

</div>

true,

but between the rise and the fall, the signal is alway high  
or between the fall and the next rise, the signal is alway low.

Of course, the starting signal defines the pattern.

[QUOTE=ionymous;1508]An input cannot be generalized this way. What you connect to an input is not the same as what I connect.

Some signals may already be moving high and low before I start up my rabbit, others may be more defined as you describe… starting low.

But even if I was absolutely sure that you signal starts low, I would never build a system that assumes what every other interrupt means. One missed interrupt and the whole system is running under the wrong assumption.  
If I was absolutely 100% positive that there was no possible way to miss an interrupt, I would still check the input value inside the interrupt handler.  
You can only be 100% sure of what you know should happen… but you can’t be 100% sure of possibilities that you’ll never think of.

Ion[/quote]
