1
\$\begingroup\$

I need to produce external interrupt whenever there is a change in state of a pin. When the pin goes from high impedance state to ground or from ground to high impedance state, an interrupt must be generated. What is the possible way of doing it in AVR?

\$\endgroup\$
  • 1
    \$\begingroup\$ What pin? Are you trying to implement this circuit using an AVR or are you trying to generate an interrupt signal that goes to the AVR. It's not clear what you want. Maybe it's an avr pin that you wan to detect the state of? \$\endgroup\$ – Andy aka Jun 5 '14 at 11:41
  • 2
    \$\begingroup\$ It's probably also worth mentioning a particular AVR device, many include a pin change interrupt. Also by high impedance do you mean pulled high by an internal pull-up? \$\endgroup\$ – PeterJ Jun 5 '14 at 11:44
  • \$\begingroup\$ Ya thats what i need, "pin change interrupt". I am using ATmega32A \$\endgroup\$ – gzix Jun 5 '14 at 11:47
  • \$\begingroup\$ Are you asking for advice regarding software / source code or hardware only? \$\endgroup\$ – Rev1.0 Jun 5 '14 at 15:59
3
\$\begingroup\$

If you are talking about interrupting on the action of a normally open SPST switch, you can achieve something approximating this behavior by pulling the pin high through a resistor, and grounding through the switch. Then generate an interrupt on the change.

You should not interrupt on a floating pin. It's bad practice and you will get unpredictable behavior.

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.