~~NOCACHE~~ ====== lamaPLC: MCP23017 / MCP23S17 16-Bit I/O Expander with Serial Interface ====== The MCP23017/MCP23S17 (**MCP23X17**) (**CJMCU-2317**) device family provides 16-bit, general-purpose parallel I/O expansion for [[com:basic_i2c|I²C]] bus or [[com:basic_spi|SPI]] applications. The two devices differ only in the serial interface: * MCP23017 – I²C interface * MCP23S17 – SPI interface The MCP23X17 contains multiple 8-bit configuration registers for input, output, and polarity selection. The system master can set I/Os as inputs or outputs by writing to the I/O configuration bits (IODIRA/B). The data for each input or output is stored in the corresponding register. The polarity of the Input Port register can be reversed using the Polarity Inversion register. The system master can read all registers. The 16-bit I/O port functionally consists of two 8-bit ports (PORTA and PORTB). The MCP23X17 can be configured to operate in the 8-bit or 16-bit modes via IOCON.BANK. ===== MCP23017 / MCP23S17 Features ===== Operating voltage: 1.8V to 5.5V \\ Voltage on Vdd with respect to Vss: **-0.3V to +5.5V** \\ Communication interface: I²C (up to 1.7 MHz), SPI (up to 10 MHz) \\ Number I/O Pins: 16 \\ Interrupt pins: 2 \\ Operating temperature: -40 °C to 125 °C \\ Total power dissipation: 700 mW \\ Maximum current out of Vss pin: 150 mA \\ Maximum current into Vdd pin: 125 mA \\ **MCP23017 / MCP23S17 IC Features:** \\ * 16-Bit Remote Bidirectional I/O Port * I/O pins default to input * High-Speed I2C Interface (**MCP23017**) * 100 kHz * 400 kHz * 1.7 MHz * High-Speed SPI Interface (**MCP23S17**) * 10 MHz (maximum) * Three Hardware Address Pins to Allow Up to Eight Devices On the Bus * Configurable Interrupt Output Pins * Configurable as active-high, active-low, or open-drain * INTA and INTB Can Be Configured to Operate Independently or Together * Configurable Interrupt Source: * Interrupt-on-change from configured register defaults or pin changes * Polarity Inversion Register to Configure the Polarity of the Input Port Data * External Reset Input * Low Standby Current: 1 µA (max.) * Operating Voltage: * 1.8V to 5.5V @ -40°C to +85°C * 2.7V to 5.5V @ -40°C to +85°C * 4.5V to 5.5V @ -40°C to +125°C |{{:sensor:mcp23017_1.png?250|MCP23017}}|{{:sensor:mcp23017_2.png?250|MCP23017}}|{{:sensor:mcp23017_3.png?160|MCP23017}}| ===== MCP23017 / MCP23S17 Modul Pinout ===== ^Pin name^Description^Pin name^Description^Pin name^Description| |**A2**|Hardware address pin; look below|**Vcc**|Power supply (1.8V to 5.5V)|**GND**|Ground| |**A1**|Hardware address pin; look below|**ITB**|Interrupt output for PORTB. Can be configured as active-high, active-low, or open-drain|**ITA**|Interrupt output for PORTA. Can be configured as active-high, active-low, or open-drain| |**A0**|Hardware address pin; look below|**B0**|digital output pin|**A0**|digital input pin| |**RESET**|Hardware reset. Must be externally biased|**B1**|digital output pin|**A1**|digital input pin| |**NC/SO**|I²C nop / SPI slave out|**B2**|digital output pin|**A2**|digital input pin| |**NC/CS**|I²C nop / SPI chip select|**B3**|digital output pin|**A3**|digital input pin| |**SDA/SI**|I²C data / SPI slave in|**B4**|digital output pin|**A4**|digital input pin| |**SCL/SCK**|I²C clock / SPI clock|**B5**|digital output pin|**A5**|digital input pin| |**GND**|Ground|**B6**|digital output pin|**A6**|digital input pin| |**Vcc**|Power supply (1.8V to 5.5V)|**B7**|digital output pin|**A7**|digital input pin| ===== MCP23017 / MCP23S17 IC pins ===== {{:sensor:mcp23017_4.png|MCP23017 / MCP23S17 IC pins}} ===== MCP23017 / MCP23S17 Functional Block Diagram ===== {{:sensor:mcp23017_5.png|MCP23017 / MCP23S17 Functional Block Diagram}} ===== MCP23017 / MCP23S17 I²C / SPI address coding ===== The hardware address pins are used to determine the device address. To address a device, the corresponding address bits in the control byte must match the pin state. The pins must be biased externally. |{{:sensor:mcp23017_6.png|MCP23017 / MCP23S17 I2C addressing}}|{{:sensor:mcp23017_7.png|MCP23017 / MCP23S17 SPI addressing}}| |The MCP23017 is a slave I²C interface device that supports 7-bit addressing, with the read/write bit filling out the control byte. The slave address includes four fixed bits and three user-defined hardware address bits (pins A2, A1, and A0).|The MCP23S17 is a slave SPI device. The slave address contains four fixed bits and three user-defined hardware address bits (if enabled via IOCON.HAEN) (pins A2, A1, and A0), with the read/write bit filling out the control byte| ====== MCP23017 / MCP23S17 Source ====== https://ww1.microchip.com/downloads/en/devicedoc/20001952c.pdf ===== I²C topics on lamaPLC ===== {{topic>i2c}} \\ \\ {{tag>communication i2c MCP23017 MCP23S17 SPI I/O_Expander Serial CJMCU-2317}} \\ This page has been accessed for: Today: {{counter|today}}, Until now: {{counter|total}}