Hi. I'd appreciate any help with this problem... I have an I2C device (MCP23018) with a single pin to set one of 8 possible bus addresses. It does so by putting a 3-bit ADC behind the pin.
Well, what I actually want to do is control the address in this case using a DIP switch. So I figure I need to do a DAC conversion first to put voltage in at the right level.
Of course, everything I know about electronics, I know from searching the web or asking on this forum... So I found this: http://www.ikalogic.com/dac08.php that seemed to do what I needed. It mentioned a R/2R resistor ladder, so I bought this: RGSD8L102G Datasheet.
But that doesn't seem to do what I expect. Even before connecting the chip, I am just measuring the voltages at different dip settings. With a 4.98v voltage, I get these readings, which is nothing like what I would expect from a digital progression...
The big difference between your circuit with DIP switches and the R-2R ladder circuit you referenced is that, for each pin, your circuit either makes a connection to 5V (right?) or not, while the R-2R ladder circuit either makes a connection to 5V OR 0V!!! That's a big difference.
--
The Gadget Shield: accelerometer, RGB LED, IR transmit/receive, speaker, microphone, light sensor, potentiometer, pushbuttons
Something is wrong here. Can you post your diagram and your project pic? Unless you have some SPDT switches you can't do this, not with simple dip swtiches, they're SPST.
RuggedCircuits:
The big difference between your circuit with DIP switches and the R-2R ladder circuit you referenced is that, for each pin, your circuit either makes a connection to 5V (right?) or not, while the R-2R ladder circuit either makes a connection to 5V OR 0V!!! That's a big difference.
Oooooh, I never would have figured that out! Yes, you're right, I am connecting 5v or nothing. I think that's the same point as the SPDT switch point. Could I do this with pull-down resistors?
Anyway, I will try it with pull-downs and if that fails, I'll post schematics tonite.
Ok, thanks guys. This is clear now. I re-wrote this using Arduino pins, just to understand what's going on, and it now behaves as expected. Sadly it means that I had a fubar solution to my problem, though, so I will still have to figure out how to solve that.