MCP2221 Breakout Module User’s Guide
DS50002282A-page 22 2014 Microchip Technology Inc.
3.4 EXAMPLE FOR INTERFACING WITH THE MCP23008 (8-BIT I/O EXPANDER)
1. If multiple MCP2221 devices are connected, choose the one to be used from the
Select Device drop-down menu. Also, select the desired communication speed
from the Speed list, as shown in Figure 3-7.
FIGURE 3-7: DEVICE SETTINGS
2. With A0, A1, A2 pins on the board tied to a 0 logic level, select the protocol,
address length, slave address and whether the operation is a read or a write
(Figure 3-8). Set the slave address to 40. These settings need to be made for
every new command.
FIGURE 3-8: COMMAND SETTINGS
3. For the Write sequence, first configure the pins as outputs. The IODIR register
has a 0h address, so writing 0h to this register will set all the port pins as outputs.
To set all the pins high, write FF(hex) to the OLAT register (address 0A(hex)), as
shown in Figure 3-9. The first data byte represents the register address, while the
second data byte represents the value that will be written.
The commands can be sent individually, by pressing the Send button, or
consecutively, by pressing the Send All button.
Verify whether the settings have been applied by reading back the port value
from the GPIO register (address 09(hex)). Send a write command to specify the
register address. Then, send a read command specifying the number of bytes
that will be read.
FIGURE 3-9: WRITE SEQUENCE
Software Description
2014 Microchip Technology Inc. DS50002282A-page 23
4. The command sequence in Figure 3-10 sets the address for the GPIO register
and reads one byte of data from the slave, obtaining the value from the register.
FIGURE 3-10: READ SEQUENCE
5. The results of the four commands sent in steps 3 and 4 are shown in Figure 3-11.
FIGURE 3-11: WRITE AND READ COMMAND OUTPUT
MCP2221 Breakout Module User’s Guide
DS50002282A-page 24 2014 Microchip Technology Inc.
NOTES:

ADM00559

Mfr. #:
Manufacturer:
Description:
BOARD EVAL FOR MCP2221
Lifecycle:
New from this manufacturer.
Delivery:
DHL FedEx Ups TNT EMS
Payment:
T/T Paypal Visa MoneyGram Western Union

Products related to this Datasheet