This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
My understanding is that P0-P7 are all input when I2C in read mode, and all are output at write mode, we can't configure such as P0-P3 input, P4-P7 output, right?
But in datasheet 9.2 typical application,
B. P0, P2, and P3 are configured as outputs.
C. P1, P4, and P5 are configured as inputs.
How can we achieve that?
Hi Howard,
Since the device doesn't have directional control, it's always "driving" using a CMOS push/pull architecture. The receiver is tied to the same line and will read the actual state of the line, independent of what the device is set to drive. This can be seen in figure 8.2.2 on the datasheet. Here's a simplified version with an example slave device connected to the pin:
See above that only one of the PCF8574 FETs will be on at a time, either pulling directly to GND or pulling up to Vcc through a 100uA current source. When the output is set to HIGH (default), the line will be weakly pulled up by this source and an exampled slave device can safely pull the line LOW without drawing too much current through either device. When the slave pulls LOW, there's a voltage drop across the current source and the PCF8574 receiver (Rx) will see the lower voltage.
Now imagine a slave device with a different push/pull architecture.
In this case, if the PCF8574 is set to drive LOW and the slave tries to pull the line up, there's nothing limiting the current through the devices and the short could damage either or both devices. If the PCF8574 is set to drive HIGH, the slave device will be able to safely drive LOW with the current being limited by the current source. A pull-down FET will be able to drive the entire line LOW so the PCF8574 receiver (Rx) reads a LOW. It can also safely drive HIGH because the line is already being pulled to Vcc.
For this configuration, not external pull-up resisters are needed because the line will be weakly pulled up by the internal CMOS architecture.
Let me know if this makes sense. More information can also be found at this similar E2E post.
Regards,
Eric
Hey Howard,
Just chiming in, you can connect a device with push pull architecture to the I/O pins if you place a series resistor between the I/O pin and the push pull architecture of another device to limit the current draw.
-Bobby