Everything for Electronics
Posted in: Featured Article (May 2010)

Adding More Digital I/O to your 16-Bit Experimenter Kit - Part 1 The Hardware

By Thomas Kibalo

The Microchip 8 bit I/O Expander, the MCP23S08
The MCP23S08 is available in an 18 pin DIP (perfect for solderless breadboard environments) and works with either 3.3V or 5V supplies. We’ll focus here on using this part with the Experimenter, but it can also be used with any microcontroller that has a Synchronous Peripheral Interface (SPI).

The MCP23S08 is a general purpose, parallel I/O expansion device that uses the SPI for 8 bit port read, 8 bit port write and port initialization. Its SPI can work at any clock rate up to 10 MHZ. The MCP23S08 SPI is a slave device that needs to get its synchronous clock from the microcontroller. Each MCP23S08 device supports an eight bit port configuration where individual port bits are accessible on the device pins GP7, GP6, GP5, GP4, GP3, GP2, GP1, and GP0. These pins can be configured as either input or output. In our application, the device is configured for eight output pins. All of the outputs are configured to drive their own individual LED through an external current limiting 100 ohm resistor. The microcontroller turns each LED on and off, one at a time, in sequence. The MCP23S08 is connected to the Experimenter’s +3.3V supply and its I/O Expansion bus as follows:
• Expansion Bus PIN 4 Serial Data out Experimenter to MCP23S08 Serial Data In • Expansion Bus PIN 5 Serial Clocks out Experimenter to MCP23S08 Clocks In • Expansion Bus PIN 6 Serial Data in Experimenter to MCP23S08 Data Out • Expansion Bus PIN 2 Digital out Experimenter to MCP23S08 Chip select in •

image

The schematic shows the Experimenter to MCP23S08 hookup. The MCP23S08 can share SPI with other devices as well (like the 128x64 Graphics Module). This is not a problem as long as the speed of the SPI does not exceed the capabilities of any of the connected devices that share the SPI bus, and that a separate Chip Select is used by the microcontroller to independently select and communicate with devices on the shared SPI. In fact, up to four MCP23S08 devices (a digital I/O capability of 32 bits total) can share the same SPI (and the same Chip Select) as long as each one uses a unique A0, A1 pin setting. All MCP23S08 outputs are capable of sourcing up to 25ma maximum if needed.

image

This photo shows our prototype port expander and its associated eight LED output.
In part 2 of this feature, we’ll discuss the software.

IO Expander demo 8 LED.zip Adding More Digital I/O to your 16-Bit Microcontroller Experiments - Part 2 The Software

 

 


 

 

The 16-Bit MicroExperimenter kit is available now and can be purchased from the Nuts & Volts webstore.
Purchase Kit Now!
The MCP23S08 will be available from the NV webstore on 5/21/10.


Comments