Using ADC for button arrays?

Status
Not open for further replies.

thecritic

Member
I am working on a Project with PIC16F676. I need several input buttons but I am falling short of input pins. I have one plan.
**broken link removed**

I think I should be able to use the PIC's ADC channel to read several buttons by utilizing only 1 pin. Do you think this is plausible? What are the troubles I may run into doing this?
Is this a general practice or I am trying to do something out of the box?
Also, can you think of better options?
 
Last time I used the same value resistor for every resistor. (1k). I would change "64R through R" to all 1k. Then make the switches short to ground. The right switch shorts out 1k. The next switch shorts out 2k (1+1). Then next switch takes out 3k.............
If you want to stay with the idea of no switches = 1/2 supply then 128R should be 7k.
 

Oh yeah. That is of course a better technique, no need of R,2R,4R... . Single value would do.
Provided that I have 10-bit ADC, how many buttons do you think I can use in this way?
2^10 = 1024? Don't think so!
 
The resistors are +/-5% or maybe 1%. The DAC is not good all the way to 10 bits. There are some errors in the DAC. I have used 10, 5% resistors in high volume products.
 
Ok, the hardware part seems fine using ronsimpson's technique. (Couln't undersant upand_at-thems's). Any tips for the software part? Will denouncing/averaging be necessary or since only 10 discrete levels are involved quick reading will be sufficient.? I need Poll the buttons really fast, the PIC has lot other things to do.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…