[vc_row][vc_column][vc_column_text]I/O Expander shield is a shield used to expand the number of I/Os of a pcDuino/Arduino Uno. It is based on the chipset MCP23017. The chipset MCP23017 communicates with Arduino Uno through I2C interface. It adds GPIOA and GPIOB, a total of 16 I/Os. There are two LEDs and two buttons on the shield. User can decide if they want to use the built-in LED/buttons or not by using the 4-bit DIP switch.
[/vc_column_text][/vc_column][/vc_row][vc_row][vc_column width=”1/1″][vc_tour][vc_tab title=”Feastures” tab_id=”1399443125-1-88″][vc_column_text]
- 16 bidirectional I/O ports. Default is input state.
- High-speed IIC interface (MCP23017): 100kHz, 400kHz, 1.7MHz
- Three hardware address pins allow up to eight devices on the bus
- Configurable interrupt output pin: can be configured for active-high (output), active-low (output) or open-drain (output)
- INTA and INTB can be configured to work independently or jointly
- Configurable interrupt sources: the interrupt changes according to the configured register defaults or pin level changes
- 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)
[/vc_column_text][/vc_tab][vc_tab title=”Part List” tab_id=”1399443125-2-78″][vc_column_text]
1 x pcDuino V2
[/vc_column_text][/vc_tab][vc_tab title=”Test Code” tab_id=”1399443195436-2-1″][vc_column_text]
#include <core.h> #include "Wire.h" byte mcp_address=0x20; // I2C Address of MCP23017 Chip byte GPIOA=0x12; // Register Address of Port A byte GPIOB=0x13; // Register Address of Port B byte IODIRA=0x00; // IODIRA register byte IODIRB=0x01; // IODIRB register void setup() { //Send settings to MCP device Wire.begin(); // join i2c bus (address optional for master) Wire.beginTransmission(mcp_address); Wire.write(IODIRA); // IODIRA register Wire.write(0x03); // set GPIOA-0/GPIOA-1 to inputs Wire.endTransmission(); } void loop() { Wire.beginTransmission(mcp_address); Wire.write(GPIOA); // set MCP23017 memory pointer to GPIOB address Wire.endTransmission(); Wire.requestFrom(0x20, 1); // request one byte of data from MCP20317 int inputs=Wire.read(); // store the incoming byte into "inputs" if((inputs&0x01)==0) { Wire.beginTransmission(mcp_address); Wire.write(GPIOA); // address bank A Wire.write(0x04); // value to send GPIOA-2 HIGH Wire.endTransmission(); printf("the s1 pressn-------------n"); } else if((inputs&0x02)==0) { Wire.beginTransmission(mcp_address); Wire.write(GPIOA); // address bank A Wire.write(0x08); // value to send GPIOA-3 HIGH Wire.endTransmission(); printf("the s2 pressn-------------n"); } else { Wire.beginTransmission(mcp_address); Wire.write(GPIOA); // address bank A Wire.write((byte)0x00); // value to send GPIOA LOW Wire.endTransmission(); } delay(100); }
[/vc_column_text][/vc_tab][vc_tab title=”Run Test” tab_id=”1399443196091-3-8″][vc_column_text]
1. Install the I/O Expander Shield to the pcDuino board.
2. Open the Arduino IDE
3. Slide the Jumper on the shield to the ON-side. Respectively slide the buttons S1 and S2 of the Jumper on the Shield to the ON–side
[/vc_column_text][/vc_tab][vc_tab title=”Schematic diagram” tab_id=”1399444039371-4-7″][vc_column_text]io expander shield SCH[/vc_column_text][/vc_tab][/vc_tour][/vc_column][/vc_row]
Leave a Reply
You must be logged in to post a comment.