ꢉꢃ ꢠꢡꢡꢡ ꢢ
www.ti.com
SBAS282D − JUNE 2003 − REVISED MARCH 2004
Note that only one set of pull-up resistors is needed per
bus. The pull-up resistor values may need to be lowered
slightly to compensate for the additional bus capacitance
presented by multiple devices and increased line length.
Figure 7. Using GPIO with a Single ADS1112
Bit-banging I2C with GPIO pins can be done by setting the
GPIO line to zero and toggling it between input and output
modes to apply the proper bus states. To drive the line
LOW, the pin is set to output a zero; to let the line go HIGH,
the pin is set to input. When the pin is set to input, the state
of the pin can be read; if another device is pulling the line
low, this will read as a zero in the port’s input register.
Note that no pull-up resistor is shown on the SCL line. In
this simple case, the resistor is not needed; the
microcontroller can simply leave the line on output, and set
it to one or zero as appropriate. It can do this because the
ADS1112 never drives its clock line LOW. This technique
can also be used with multiple devices, and has the
advantage of lower current consumption due to the
absence of a resistive pull-up.
If there are any devices on the bus that may drive their
clock lines LOW, the above method should not be used;
the SCL line should be high-Z or zero and a pull-up resistor
provided as usual. Note also that this cannot be done on
the SDA line in any case, because the ADS1112 does drive
the SDA line LOW from time to time, as do all I2C devices.
Figure 6. Connecting Multiple Device Types
Some microcontrollers have selectable strong pull-up
circuits built in to their GPIO ports. In some cases, these
can be switched on and used in place of an external pull-up
resistor. Weak pull-ups are also provided on some
microcontrollers, but usually these are too weak for I2C
communication. If there is any doubt about the matter, test
the circuit before committing it to production.
The TMP100 and DAC8574 devices detect their I2C bus
addresses based on the states of pins. In the example, the
TMP100 has the address 1001111, and the DAC8574 has
the address 1001100. Consult the DAC8574 and TMP100
data sheets, located at www.ti.com, for further details.
2
USING GPIO PORTS FOR I C
Most microcontrollers have programmable input/output
pins that can be set in software to act as inputs or outputs.
If an I2C controller is not available, the ADS1112 can be
connected to GPIO pins and the I2C bus protocol
simulated, or “bit-banged,” in software. An example of this
for a single ADS1112 is shown in Figure 7.
14