Two interrupts (HIGH/LOW) on same pin

Hi

I am having a Bi-directional sensor switch with two cables, with single point ground. The way that the switch works is by changing the output voltage: 2.5V= standby, 0V=Pull, 5V=Push.

I want to handle the changes of the switch with interrupts, that's HIGH for push and LOW for pull. But since I have only one pin to use for interrupts (the other pin/cable is for ground), can I handle both interrupts on this one pin?

Thanks in advance

There is no need to use interrupts, and they won't work in this case.

With that sensor, you would use the analogRead() function to distinguish between true HIGH and LOW (a digital input on a 5V Arduino will treat 2.5V as LOW).

Hmmm. How is this 2.5 standby voltage achieved? This thread will go off the rails pretty quickly unless you clarify that by posting a lot more detailed information about the sensor. As presented, there is no way to interpret that signal without some special input circuitry to differentiate the different voltages, unless you take an analog reading as mentioned above. But it is possible that the sensor wiring offers another solution. Again, really need more info...

Also this talk of having only one pin for interrupts makes no sense. Please explain in more detail. One pin of what?

Without details of the sensor and/or a schematic, you will get no useful feedback.

Thanks everyone for their answers. I've made my solution on hardware level driving both edges on individual pin and then handle them with interrupts.

it would be nice if you would give something back by presenting your solution.

invoking interrupts for a tristage logic 0V / 2,5V / 5V would be a better suiting name for this thread.

Anyway one idea I have is to feed-in the signal into two comparators with hysteresis
comparator 1 adjusted to switch at 1V

comparator 2 adjusted to switch at 4V

This means comparator 1 stays "HIGH" for all voltages above 1V
0V switch to LOW
on 2,5V meaning "standby" switch to HIGH setup-interrupt on FALLING

comparator 2 stays "LOW" for all voltages below 4V LOW at 0V and LOW at 2,5V and only HIGH at 5V
setup-interrupt on RISING

The hysteresis could be small maybe 0,2V to 0,4V as in this case it is not so important to have y hysteresis at all

**DUAL-supply **

OP-Amp-non-inverting-comparators.gif

Single-Supply GND and Vcc

OP-Amp-single-supply-non-inverting-comparators.gif

OP-Amp-non-inverting-comparators.gif

OP-Amp-single-supply-non-inverting-comparators.gif

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.