I want to use four of MCP4725 DAC module at the same time but it only has two I2C addresses which can be set via jumpers:
In page 10 of the datasheet it says:
Device Address Selection pin. This pin can be tied to VSS or VDD, or can be actively driven by the digital logic levels. The logic state of this pin determines what the A0 bit of the I2C address bits should be.
Is there anyway to set more than two addresses for this module? or any hack via hardware/software...
-
1The MCP4725 has 3 variable address bits. A0 on which you have access and A1 A2 which can be chosen by the customer that bought the chips to create these breakout boards (see picture above). Perhaps there is a chance to get boards of two address series. I know, that's a bad advice if you just bought the boards, but if not this could be a chance to four boards on the bus.Peter Paul Kiefer– Peter Paul Kiefer2019年10月29日 14:31:54 +00:00Commented Oct 29, 2019 at 14:31
1 Answer 1
There is a trick to this, and it involves considering one device "active" and all others "inactive".
You only ever work with one address, and that is the address of the "active" unit. All other units are on the secondary "inactive" address which you ignore.
The address pin of each unit is then connected to an IO pin, and can be considered a "chip select" pin.
The sequence, then, is:
- Set unit one's A0 low and all other units HIGH.
- Communicate on Address 0
- Set unit two's A0 LOW and all other units HIGH.
- Communicate on Address 0
- Etc for each unit
Since you never communicate on Address 1 the rest of the "inactive" units ignore all the communication.
-
Thanks, If DAC1 output is for example 1024 and then I switch to DAC2 the value on DAC1 will reset to 0 or stays at that value?ElectronSurf– ElectronSurf2019年10月28日 14:21:21 +00:00Commented Oct 28, 2019 at 14:21
-
1The DACs only ever change their value if you change the value or if you reset the device by removing the power.Majenko– Majenko2019年10月28日 14:38:42 +00:00Commented Oct 28, 2019 at 14:38
-
This concept will surely work, but the OP should be aware of that, he can not use this solution in a setup with variable/pluggable devices where scans of the I2C bus are necessary. (e.g. switching to a raspi may cause this).Peter Paul Kiefer– Peter Paul Kiefer2019年10月29日 14:40:32 +00:00Commented Oct 29, 2019 at 14:40