AN #139 - Using MCP23016



Writen by Roland van Leusden

Small project was made based on the MCP23016 datasheet and App Note AN-245 from MicroChip.

The MCP23016 is a 16 port I2C IO expander

This small project was made based on the MCP23016 datasheet and App Note AN-245 from MicroChip.
You can find the schematic of the circuit in the application note, the pcb layout I made is below. The application note also contains example code for interfacing with a PIC.

Bascom example First showing a "chaser" effect on the leds, then configure 1 port as input and display it on the second port.

From the Microchip website:

The Microchip MCP23016 is a 16-bit input/output expander designed to provide embedded systems with general purpose remote I/O expansion through an I2CT serial port. The fully bi-directional 16 I/Os default to inputs and can be configured as inputs or outputs. Additionally, there are four sets of registers that are programmable and provide for configuration (input or output control), output value, and polarity (active low or high). The MCP23016 open drain interrupt (INT) output is activated when any input state differs from its corresponding input port register state. By sending an interrupt signal on the interrupt logic of the master, this remote slave device informs the master that there is incoming data on the port without having to communicate via the I2C bus.

Features :

  • 16-bit I/O port expander with interrupt
  • 3 hardware address pins allow user to use up to 8 of these devices on the same I2C/SMBus
  • 25mA source/sink capability per I/O
  • I2C and SMBus compatible interface (0 to 400kHz clock frequency)
  • 16 programmable bi-directional I/Os compatible with most processors
  • Outputs can directly drive LEDs (Source and sink current 25mA)
  • Polarity inversion register to configure the polarity of the input port data
  • Internal power on reset (POR)
  • Open-drain interrupt output activated when input changes state
  • Low supply current
  • Specified over Industrial temperature range -40°C to +85°C





Download source code and files in an139.zip