Hardware Reference
In-Depth Information
Table 2-1. MCP23017 Register Addresses
Register
A
B
Description
IODIRx
0x00
0x01
I/O direction
IPOLx
0x02
0x03
Input polarity
GPINTENx
0x04
0x05
Interrupt on change control
DEFVALx
0x06
0x07
Default comparison value
INTCONx
0x08
0x09
Interrupt control
IOCONx
0x0A
0x0B
Configuration
GPPUx
0x0C
0x0D
Pull-up configuration
INTFx
0x0E
0x0F
Interrupt flags
INTCAPx
0x10
0x11
Interrupt captured value
GPIOx
0x12
0x13
General-purpose I/O
OLATx
0x14
0x15
Output latch
IOCON Register
This is the first register that must be configured, since it affects how registers are
addressed. Additionally, other settings are established that affect the entire peripheral.
Table 2-2 illustrates the layout of the IOCON register. Setting the BANK bit determines
whether we use banked or interleaved register addressing. The MCP23017 is in
interleaved mode after a power-on reset. Once you set BANK=1 , the register addresses
change. However, once this change is made, it is impossible to tell, after a program restart,
which register mode the peripheral is in. The only option is a hardware reset of the
MCP23017 chip, to put it in a known state. For this reason, we'll keep the peripheral in its
power-on reset state of BANK=0 .
 
 
Search WWH ::




Custom Search