Quite a obscure question here, concerning a very specific I2C expander IC, however I believe that this example can be replicated with most expander bus ICs.
I am using a PCA9536 to switch the 4 pins on and off and read the states of inputs.
When using the PCA9536, a command register can be used to determine, pin direction, state and even inverse the incoming logic.
My application requires the ability to read the electrical state of any given pin at any given moment, regardless of whether its an input or output.
This IC supposedly does this (page 16):
184.108.40.206 Register Descriptions
The Input Port register (register 0) reflects the incoming logic levels of the pins, regardless of whether the pin is defined as an input or an output by the Configuration register.
So, to test this, I conducted the following two tests:
- Test A
I have set a pin to be an output and made it LOW, then pulled it HIGH
Reading the value of the pin, using I2C Register 0, returns a value of HIGH.
- Test B
I have set a pin to be an output and made it HIGH, then pulled it LOW
Reading the value of the pin using I2C Register 0, returns a value of HIGH.
This is my problem, as I need to detect a short HIGH or LOW.
What are the possible reasons for this and is there a workaround please? Thank you in advance for any help you can offer me.