# How exactly falling/rising edge works

Maybe my question will be very basic but I am newbie and I have stucked...

Supoose we have uC and one pin (voltage is in range 0-3v3) connected to external interrupt. Which of these sentences is true?

1. The falling edge interrupt would fire when voltage goes down from 3v3 to lower value (for example from 3v3 to 3v1).

2. The falling edge interrupt would fire when voltage goes down from 3v3 to 0 volts

Which of them is true? Thanks!

It will fire a falling edge interrupt when it goes from logic 1 to logic 0, this will depend on the uC (hardware), for ex some uC may consider from 0V to 0.7V a logic zero and from 2.3 V to 3.3V a logic high, while the rest is floating

Neither. The falling edge interrupt would fire on the transition from logic high to logic low. See the microcontroller datasheet for what the appropriate $V_{IH}$ and $V_{IL}$ voltages.

1. can be considered true (if it's a test), it will definitely fire when the input voltage drops to 0V.

At exactly which voltage will a falling edge be detected, can vary. There are usually two guarantees.

• It will never happen before the input voltage gets below VIH - Vhys.

• It will definitely happen when the input voltage gets below VIL.

Where VIH, VIL, Vhys are the logic high, logic low, and the hysterese voltage in the datasheet, respectively. They may be given as absolute values, or derived from the supply voltage. When there is no hysterese mentioned, assume 0V.

Between the two given voltage levels there is a grey area, the exact threshold may vary between parts, or with temperature, wear, moonphase, etc.

• In your final sentence, you forgot to mention (and I figure this matters more often than not) the presence or absence of any testing or measuring equipment. If you're trying to figure out what's going on, especially if that is because something doesn't behave quite like you expect, then you should expect things to happen subtly differently from when you're just using the component or device without testing or measuring anything. – user Sep 7 '17 at 20:43