Go Down

Topic: i2c port expander PCF8574 as input (Read 5 times) previous topic - next topic

Federico

Hi, I have a PCF8574p and I am using it with an lcd. This works fine.
The library that I use let a pin of the PCF, the 13, free.
I wish to use this pin of the port expander as an input pin, to read the pressure of a button, but I can't understand how, through the wire library (i think that i need this).
Is it possible to do this? Does anyone knows where I can look for understanding how to do this? Thanks, Fede
Federico - Sideralis
Arduino &C: http://www.sideralis.org
Foto: http://blackman.amicofigo.com

Nachtwind

Basically reading the pcf8574 is not so hard. I would need to dig up the code when i get home later, but basically it's described in the datasheet.
You might have problems IF you had to read a analog button - in that case its far mor difficult..
Believe me, Mike, I calculated the odds of this succeeding against the odds I was doing something incredibly stupid[ch8230] and I went ahead

Federico

I will be absolutly fine with a normal digital button :)
I need this button to change the state of the visualization on the lcd, but looks like every example on the forum is about using the expander as output, and not as input (on a single pin)
Federico - Sideralis
Arduino &C: http://www.sideralis.org
Foto: http://blackman.amicofigo.com

Mario_H

Federico,

Pin 13 is the interrupt output pin of the PCF.
(See page 11 of the PCF datasheet in the library download for details)
You can not reconfigure it for your use.

I suggest you don't use pin 12 for controlling the LCD backlight but instead use it for you button.
You may have to tweak the LCD library so it doesn't use pin 12 for output.

Federico

Hi Mario,
I have already planned not to use the backlight with your library because I will always need the backlight on. I could use the pin 12, but still I have to understand how. I am working on it...
Thanks, Fede
Federico - Sideralis
Arduino &C: http://www.sideralis.org
Foto: http://blackman.amicofigo.com

Go Up