PDA

View Full Version : How can I "see" if a PCF8574 is "alive" in the I2C bus



nomada
- 22nd July 2005, 01:03
Hi to you all

My question has to do with a project in which I got involved as is something like this:

There are 4 pcf8574, each takes care of 8 micro-switches (with pull-up resistors) each micro-switch senses the presence (or not) of a product over it.

So, with the product over the micro-switch the pcf reads a "zero" (and assumes there is a product), without the product it reads a "one".

If for any reason I disconnect (or it became dammaged) one of the boards that has a pcf8574, when I tell the PIC to read the bus it sees the absent pcf8574 as having all the inputs with "zeros".

Can anyone sugest a way to check if there is really a pcf on the I2C bus or I'm seeig a ghost pcf.

Thanks in advance.

Thanks Lester for this comunication thread, hope everybody follow these new rules

Dave
- 22nd July 2005, 02:55
nomada, personally I would write 01010101 to each of the pcf8574's then read back the contents of the input register. With all inputs open circuited you should read the exact same patern as you wrote to it. Then I would change the pattern to 10101010 and read the contents once again making sure the readback is the same as the programed value. After this I would write all 1's to the pcf8574's and start reading them in a normal situation. The verify siquence could ba a subroutine you would run at a timed interval to ensure the integrity of the reading ability of the pcf8574's.

Dave Purola,
N8NTA

nomada
- 27th July 2005, 01:30
Hi, Dave

Sorry for the late reply, I've been away.

I've tried your sugestion and it looks like that IT WORKS.

I've supposed that writing to a PCF that is configurated to act like an input might cause some damage... well, credit should be given to those who knows.

Once again, thank you!

F1CHF
- 15th October 2012, 09:06
hello I will not answer about the PCF8574 (who is sometimes very strange !)
but to the question "how to see if a I2C unit is alive"
I use for a long time, a very simple programm TEST I2C
see here : http://mbouget.perso.neuf.fr/telecharge.html
you can search, read,write on a I2C line (from a window/dos command line)
I use it all the time to check my "I2C sentence"
hope this will help other PIC user from this super Forum list !
francois F1CHF