Pages: [1]   Go Down
Author Topic: unnofficial guide to PCF8574 i/o expansion i2c bus  (Read 1272 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
Karma: 2
Posts: 148
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

greetings, i posted this to bring together all the tidbits on this device, of which i've become interested in. theres alot of scattered info all over. please, smart people correct/add to this. this device will add 8 inputs or outputs. datasheet here

older library here, i couldnt get this to work but someone maybe able to update it
playground stuff
tutorial to get you up and running
to understand i2c please see Mr. Gammon's tutorial here
they call it knightrider, i call it cylon
reading as inputs, have a care though, its not Wire.receive anymore its
this code works for reading inputs, but i believe the schematic is wrong

be nice to have a library for this, something im going to tinker with, but alas, i am not, dare i say, up to the task "yet". but please if someone skilled is bored and has time on their hands. just remember to control the outputs, 0= all on, 0x255= all off, 0x254= port0 on (11111110), although, i get erratic behavior if i send BIN instead of HEX. as far as addressing goes, the datasheet answers this, image attached, eg pins A0-A2 grounded = address 0x20.

thank you for your time. more will be added as i learn/find it.  edit-added my i2c test shield.

reading an input as a test..

byte x=0;

void setup()

void loop()
    if(Wire.available())     //If the request is available
    {;       //Receive the data

//inputs shorted to ground
if port0 is on and all off x will equal 254.

** maybe a better option is the MCP23017. Nick Gammon has extensive documentation here and adafruit has libraries already in place. i ordered a few of these the other day. happy port expanding!

* pcf8574end.jpeg (65.08 KB, 540x313 - viewed 78 times.)

* DSC05541.png (621.98 KB, 648x486 - viewed 94 times.)
« Last Edit: March 20, 2013, 09:26:18 am by grendle » Logged

Pages: [1]   Go Up
Jump to: