- In this case i can connect the external DAC to the ADC input, so configure the DAC to output 0V and connect to ADC input.
- Switch ADC input to dipswitch inputs (in my case all of these pins are also ADC pins)
- Read ADC
- If near zero, switch is open, if near VDD switch is closed
ADC consumes power and takes relatively long time. Maybe I did not think it all the way through, but why not just do digital port read on these pins?
I may get poo pooed for this, but I have done this and have no qualms about it: Temporarily set pin to digital lo for a very brief time (just about as fast as you can switch the pin on and off, again) immediately before a digital read. This will technically cause a short circuit between power and ground through the pin when the DIP is actually switched to 5V, but it is very brief.
I have done this to read tristate. To reiterate: (If internal pulldowns are not available) briefly set port to digital lo, float, read. Then (if internal pullups are not available) briefly set port to digital hi, float, read. A couple bitmasking operations to return the state of each pin... hi, lo, or hiZ. So each pin can now return 3 states instead of just 2, and they are scanned @ 100 Hz or so. Between reads, internal pullup/down should be applied, if available, to prevent power drain in a noisy environment.
Essentially, I have physical 3 way on-off-on switches on these pins that are DIRECTLY tied to Vdd and ground. (This was not even an afterthought; it worked, so I omitted a resistor per pin to save $, lol). The resistance of the pins and brief on time is fine, to me.
If you want to get technical about it, you are relying on the capacitance of the pin to hold the state between time you pulse it and you read it, while it is floating. And you are relying on internal resistance of the pin (which is sigificant, but even better when the output FET on the pin is perhaps largely in intermediate state rather than significant time of being fully saturated) to prevent significant glitch/noise on the power rail. It's a good idea to turn off global interrupts while you do the pulse/reads.