Other Parts Discussed in Thread: PCF8575
I'm having a figth with this port expander and interrupts, but want to first clear up this possible misunderstanding on my side:
Is it enough to write once, then wait for interrupt(s) and just keep reading the port?
I'm not a native speaker and to me, what the data sheet states is ambiguous:
Before reading from the PCF8575C, all ports desired as input should be set to logic 1.
When using this part however, I have to write 0xFFFF every time just before a read, or I read nonsense values.
So I interpret the data sheet as "Every time, just before reading from the PCF8575C, all ports desired as input should be set to logic 1."
Is this true, do I interpret the data sheet correctly in this way?
Or should I indeed be able to write 0xFFFF once (clearing the interrupt pin) and then repetetively read the port status upon interupt, also clearing the interrupt pin by the read?
In my hands, this pseudo code works (without worrying about the interrupt pin for now)
while True
write_PCF8575(0xFFFF)
port_status_16_bits = read_PCF8575()
***do something with the result
While this code fails after the first read:
write_PCF8575(0xFFFF)
while True
port_status_16_bits = read_PCF8575()
*** do something with the result but do not rewrite the PCF8575 with anything
Thanks for enlightening me.