Is it possible to use ADC line for multiple pushbuton inputs and still get interrupt on change?

Started by ransom peek December 3, 2003
Is it possible to use ADC line for multiple pushbuton inputs and still get interrupt on change?

Microchip AN234 shows how to use ADC for multiple pushbuttons, saving I/O lines, as follows:


                            Vdd          Vdd           Vdd

                              |                |                |

                             R1             R2            R3                         

                              |                |                |

                             S1            S2             S3  

                              |                |                |

PIC ADC --------------

                              |

                            R4

                              |

                            gnd

So it is a voltage divider and the ADC measures the value to determine switch or combination of switches pressed.

Question:  Is there a way for these three switches to generate an interrupt when one is pressed?

Ransom Peek




simplest way use the adc interrupt and check for
voltage variation in your isr.

regards
S.

--- ransom peek <> wrote:
> Microchip AN234 shows how to use ADC for multiple
> pushbuttons, saving
> I/O lines, as follows: > Vdd Vdd
> Vdd
> | |
> |
> R1 R2
> R3
>
> | |
> |
> S1 S2
> S3
> | |
> |
> PIC ADC
> --------------
> |
> R4
> |
> gnd
>
> So it is a voltage divider and the ADC measures the
> value to determine
> switch or combination of switches pressed.
>
> Question: Is there a way for these three switches
> to generate an
> interrupt when one is pressed? >
>
> Ransom Peek
>


__________________________________



tie the input pin to a positive comparator input with the reference
near ground, or tie the input to a interrupt on change pin, but minimum
input voltage would have to be higher than vcc/2

Chad

--- ransom peek <> wrote:
> Microchip AN234 shows how to use ADC for multiple pushbuttons, saving
> I/O lines, as follows: > Vdd Vdd Vdd
> | | |
> R1 R2 R3
>
> | | |
> S1 S2 S3
> | | |
> PIC ADC --------------
> |
> R4
> |
> gnd
>
> So it is a voltage divider and the ADC measures the value to
> determine
> switch or combination of switches pressed.
>
> Question: Is there a way for these three switches to generate an
> interrupt when one is pressed? >
>
> Ransom Peek
>


__________________________________