@@ -16,8 +16,6 @@ Arduino library for PCF8574 - 8 channel I2C IO expander.
1616
1717## Description
1818
19- Related to the PCF8575 16 channel IO expander library https://github.com/RobTillaart/PCF8575
20-
2119This library gives easy control over the 8 pins of a PCF8574 and PCF8574A chip.
2220These chips are identical in behaviour although there are two distinct address ranges.
2321
@@ -36,7 +34,7 @@ The library allows to read and write both single pins or 8 pins at once.
3634Furthermore some additional functions are implemented that are playful and useful.
3735
3836
39- #### Interrupts intro
37+ ### Interrupts intro
4038
4139The PCF8574 has an interrupt output line (INT) to notify an MCU that one of the input lines has changed.
4240This can be used to prevent active polling of the PCF8574, which can be more efficient.
@@ -61,7 +59,7 @@ In practice if you have faster polling than your signals changes this would not
6159be a problem. E.g. tactile switches and a polling frequency > 100 Hz will work.
6260
6361
64- #### Interrupts library
62+ ### Interrupts library
6563
6664The library cannot handle the PCF8574 interrupts as it has no code for it.
6765The user should catch the interrupt in his own code to set a flag and can use
@@ -84,7 +82,7 @@ A minimal example that shows catching missed interrupts:
8482- ** PCF8574_interrupt_advanced.ino**
8583
8684
87- #### 0.4.0 Breaking change
85+ ### 0.4.0 Breaking change
8886
8987Version 0.4.0 introduced a breaking change.
9088You cannot set the pins in ** begin()** any more.
@@ -93,23 +91,27 @@ The user has to call **Wire.begin()** and can optionally set the Wire pins
9391before calling ** begin()** .
9492
9593
96- #### Related
94+ ### Related
9795
989616 bit port expanders
9997
100- - https://github.com/RobTillaart/MCP23017_RT
101- - https://github.com/RobTillaart/MCP23S17
102- - https://github.com/RobTillaart/PCF8575
98+ - https://github.com/RobTillaart/MCP23017_RT I2C 16 IO lines.
99+ - https://github.com/RobTillaart/MCP23S17 SPI 16 IO lines.
100+ - https://github.com/RobTillaart/PCF8575 I2C 16 IO lines.
101+ - https://github.com/RobTillaart/PCA9671 I2C 16 IO lines. - successor PCF8575
103102
104103
1051048 bit port expanders
106105
107- - https://github.com/RobTillaart/MCP23008
108- - https://github.com/RobTillaart/MCP23S08
109- - https://github.com/RobTillaart/PCF8574
106+ - https://github.com/RobTillaart/MCP23008 I2C 8 IO lines.
107+ - https://github.com/RobTillaart/MCP23S08 SPI 8 IO lines.
108+ - https://github.com/RobTillaart/PCF8574 I2C 8 IO lines.
109+
110110
111+ ## I2C
111112
112- ## I2C Clock
113+
114+ ### Performance
113115
114116Tested on UNO with ** PCF8574_performance** showed that the PCF8574 still works at 500 KHz and failed at 600 KHz.
115117These values are outside the specs of the datasheet so they are not recommended.
@@ -125,6 +127,24 @@ However when performance is needed you can try to overclock the chip.
125127| 600000 | crash | crash |
126128
127129
130+ ### I2C multiplexing
131+
132+ Sometimes you need to control more devices than possible with the default
133+ address range the device provides.
134+ This is possible with an I2C multiplexer e.g. TCA9548 which creates up
135+ to eight channels (think of it as I2C subnets) which can use the complete
136+ address range of the device.
137+
138+ Drawback of using a multiplexer is that it takes more administration in
139+ your code e.g. which device is on which channel.
140+ This will slow down the access, which must be taken into account when
141+ deciding which devices are on which channel.
142+ Also note that switching between channels will slow down other devices
143+ too if they are behind the multiplexer.
144+
145+ - https://github.com/RobTillaart/TCA9548
146+
147+
128148## Interface
129149
130150``` cpp
@@ -135,7 +155,7 @@ However when performance is needed you can try to overclock the chip.
135155the include of "pcf8574.h" to overrule the default value used with the ** begin()** call.
136156
137157
138- #### Constructor
158+ ### Constructor
139159
140160- ** PCF8574(uint8_t deviceAddress = 0x20, TwoWire \* wire = &Wire)** Constructor with optional address, default 0x20,
141161and the optional Wire interface as parameter.
@@ -147,7 +167,7 @@ so one might need to call **read8()** and/or **write8()**. Returns true if addre
147167- ** uint8_t getAddress()** Returns the device address.
148168
149169
150- #### Read and Write
170+ ### Read and Write
151171
152172- ** uint8_t read8()** reads all 8 pins at once. This one does the actual reading.
153173- ** uint8_t read(uint8_t pin)** reads a single pin; pin = 0..7
@@ -159,7 +179,7 @@ value is HIGH(1) or LOW (0)
159179- ** uint8_t valueOut()** returns the last written data.
160180
161181
162- #### Button
182+ ### Button
163183
164184The ** "button"** functions are to be used when you mix input and output on one IC.
165185It does not change / affect the pins used for output by masking these.
@@ -176,7 +196,7 @@ Note this can be a subset of the pins set with **setButtonMask()** if one wants
176196Background - https://github.com/RobTillaart/Arduino/issues/38
177197
178198
179- #### Special
199+ ### Special
180200
181201- ** void toggle(const uint8_t pin)** toggles a single pin
182202- ** void toggleMask(const uint8_t mask = 0xFF)** toggles a selection of pins,
@@ -190,7 +210,7 @@ Fills the lower lines with zero's.
190210- ** void reverse()** reverse the "bit pattern" of the lines, swapping pin 7 with 0, 6 with 1, 5 with 2 etc.
191211
192212
193- #### Select
213+ ### Select
194214
195215Some convenience wrappers.
196216
@@ -204,7 +224,7 @@ This can typical be used to implement a VU meter.
204224- ** void selectAll()** sets all pins to HIGH.
205225
206226
207- #### Miscellaneous
227+ ### Miscellaneous
208228
209229- ** int lastError()** returns the last error from the lib. (see .h file).
210230
0 commit comments