@@ -25,10 +25,27 @@ These chips are identical in behaviour although there are two distinct address r
2525
2626So you can connect up to 16 PCF8574 on one I2C bus, giving access
2727to 16 x 8 = 128 IO lines. To maximize IO lines combine 8 x PCF8575 + 8 x PCF8574A giving
28- 128 + 64 = 192 IO lines. Be sure to have a well dimensioned power supply.
28+ 128 + 64 = 192 IO lines.
29+ Be sure to have a well dimensioned power supply.
2930
3031The library allows to read and write both single pins or 8 pins at once.
31- Furthermore some additional functions are implemented that are playful but useful.
32+ Furthermore some additional functions are implemented that are playful and useful.
33+
34+
35+ ## I2C Clock
36+
37+ Tested on UNO with ** PCF8574_performance** showed that the PCF8574 still works at 500 KHz and failed at 600 KHz.
38+ These values are outside the specs of the datasheet so they are not recommended.
39+ However when performance is needed you can try to overclock the chip.
40+
41+ | clock speed | Read | Write | Notes |
42+ | :-----------:| :------:| :-------:| :------------------|
43+ | 100000 | 236 | 240 | spec datasheet |
44+ | 200000 | 132 | 140 |
45+ | 300000 | 104 | 108 |
46+ | 400000 | 96 | 96 | max advised speed |
47+ | 500000 | 92 | 92 | not recommended |
48+ | 600000 | crash | crash |
3249
3350
3451## Interface
@@ -59,7 +76,7 @@ in the class this is faster than reread the pins.
5976- ** void write8(const uint8_t value)** writes all 8 pins at once. This one does the actual writing.
6077- ** uint8_t write(const uint8_t pin, const uint8_t value)** writes a single pin; pin = 0..7;
6178value is HIGH(1) or LOW (0)
62- - ** valueOut()** returns the last written data.
79+ - ** uint8_t valueOut()** returns the last written data.
6380
6481
6582### Button
@@ -90,12 +107,26 @@ Fills the higher lines with zero's.
90107Fills the lower lines with zero's.
91108- ** void rotateRight(const uint8_t n = 1)** rotates output channels to right, moving lowest line to highest line.
92109- ** void rotateLeft(const uint8_t n = 1)** rotates output channels to left, moving highest line to lowest line.
93- - ** void reverse()** reverse the "bit pattern" of the lines, swapping pin 7 with 0, 6 with 1, 5 with 2 and 4 with 3.
110+ - ** void reverse()** reverse the "bit pattern" of the lines, swapping pin 7 with 0, 6 with 1, 5 with 2 etc.
111+
112+
113+ ### Select
114+
115+ Some convenience wrappers.
116+
117+ - ** void select(const uint8_t pin)** sets a single pin to HIGH, all others are set to LOW.
118+ If pin > 7 all pins are set to LOW.
119+ Can be used to select one of n devices.
120+ - ** void selectN(const uint8_t pin)** sets pins 0..pin to HIGH, all others are set to LOW.
121+ If pin > 7 all pins are set to LOW.
122+ This can typical be used to implement a VU meter.
123+ - ** void selectNone()** sets all pins to LOW.
124+ - ** void selectAll()** sets all pins to HIGH.
94125
95126
96- ### Misc
127+ ### Miscellaneous
97128
98- - ** int lastError()** returns the last error from the lib. (see .h file)
129+ - ** int lastError()** returns the last error from the lib. (see .h file).
99130
100131
101132## Error codes
@@ -109,13 +140,13 @@ Fills the lower lines with zero's.
109140
110141## Operation
111142
112- See examples
143+ See examples.
113144
114145It is advised to use pull-up or pull-down resistors so the lines have a defined state at startup.
115146
116147
117148## Future
118149
119- -
150+ -
120151
121152
0 commit comments