Page 1 of 1

PCF8574 interfacing

Posted: 08 Jun 2011, 09:56
by h-g-t
I want to add some tactile switches using a PCF8574 to provide input to the NXT.

In the Extreme NXT book, the switches are shown as simply shorting the pins to ground, whereas Sivan Toledo shows a circuit in which the pins are connected to the supply line through resistors which are then shorted out - http://www.tau.ac.il/~stoledo/lego/i2c-8574/

As a complete newbie I am stumped as to the advantages/ disadvantages of each circuit. Does connecting the pins to the power supply mean that you do not have to use a write command to set each pin before reading it, which simplifies the program?

Advice appreciated.

Re: PCF8574 interfacing

Posted: 08 Jun 2011, 11:23
by philoo
For most uses, I don't see the point of using external pull-up resistors. PFC8574 is explicitely designed to provide internal pull-up, so external resistors would be needed only if for some reason you want to have more current flowing in the switch. And programminig is exactly the same anyway.

Re: PCF8574 interfacing

Posted: 08 Jun 2011, 11:42
by h-g-t
Thanks Philo, I'll keep it simple and just short the pins.

Re: PCF8574 interfacing

Posted: 08 Jun 2011, 18:39
by mattallen37
You probably already know this, but I'll say it just to be sure.

The PCF8574 is not able to source current, it is only able to sink. It does have internal pullups, so to use a touch sensor, you must write the pins high, and then read them looking for a low.