MCP23017 I2C port expander - Reading OUTPUT Status

Hi everyone,

i was just programming some MCP23017 IC, toying with them etc... and i wondered if it is possible to "read" the pins of the MCP23017 status, i mean the next case:

In an hipotethic case where the MCP23017 all the pins are configured as outputs, is there any way i can get info about which pins are actually at high or low without storing it in any byte variable before or after sending to it.

Thanks everyone for reading, and i hope there is a way to do that.




The MCP23X17 consists of multiple 8-bit configuration registers for input, output and polarity selection. The system master can enable the I/Os as either inputs or outputs by writing the I/O configuration bits (IODIRA/B). The data for each input or output is kept in the corresponding input or output register. The polarity of the Input Port register can be inverted with the Polarity Inversion register. All registers can be read by the system master.

So there is a way to read the data kept in the output register?

Also i was trying to figure how to do that, but i didn't found a way to understand how to read that register, for output pins.

RTFM, it's all in the data sheet.

Information about how to use I2C:

Thanks for the info, already readed it but i will give another try.

In the context of your question, reading seems to have a new meaning, strange.

Really, the answer I used in the first quote was directly copied from the data sheet.
The nitty-gritty details of the IO registers are covered in section 3.4.

If you already use a library for the chip, it should be very easy to extend its functionality.
If you want to create your own library/stand-alone code you will have to handle the basic I2C accesses yourself.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.