How does it work?
Expand Click is based on the MCP23S17, a 16-bit general-purpose parallel I/O expansion with the serial interface from Microchip. The MCP23S17 consists of multiple 8-bit configuration registers for input, output, and polarity selection. The host MCU can enable the I/Os as either inputs or outputs by writing the I/O configuration bits with data for each input or output kept in the corresponding input or output register. This port expander represents a simple solution when additional I/Os are needed while keeping interconnections to a minimum. It features two double-row unpopulated headers for connecting I/O devices.
This Click board™ communicates with MCU using the standard 4-Wire SPI serial interface with a maximum 10MHz frequency. The MCP23S17 has a 7-bit slave address with the first four MSBs fixed to 0100. The address pins A0, A1, and A2 are programmed by the user and determine the value of the last three LSBs of the slave address, which can be selected by positioning onboard SMD jumpers labeled as HARDWARE ADDRESS SEL to an appropriate position marked as 1 or 0. This way, the MCP23S17 provides the opportunity of using more Extend Clicks on a single host MCU.
Besides, it also has an interrupt feature, routed to the INT pin of the mikroBUS™ socket, indicating to the host controller that an input state has been changed alongside the general reset feature. Two interrupt pins on the MCP23S17 can be associated with their respective ports or logically OR’ed together so that both pins will activate if either port causes an interrupt. The desired interrupt port can be selected by positioning an onboard SMD jumper labeled J4 in an appropriate position.
This Click board™ can operate with either 3.3V or 5V logic voltage levels selected via the PWR SEL jumper. This way, both 3.3V and 5V capable MCUs can use the communication lines properly. However, the Click board™ comes equipped with a library containing easy-to-use functions and an example code that can be used, as a reference, for further development.
Specifications
Type
Port expander
Applications
Can be used for controlling a wide range of peripheral signals in portable equipment, industrial controllers, and many more
On-board modules
MCP23S17 – a 16-bit general-purpose parallel I/O expansion from Microchip
Key Features
16-bit remote bidirectional I/O port, high-speed SPI interface, configurable interrupt, polarity inversion, reset feature, low power consumption, and more
Interface
GPIO,SPI
Feature
No ClickID
Compatibility
mikroBUS™
Click board size
L (57.15 x 25.4 mm)
Input Voltage
3.3V or 5V
Pinout diagram
This table shows how the pinout on EXPAND Click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
Onboard settings and indicators
Label | Name | Default | Description |
---|---|---|---|
LD1 | PWR | – | Power LED Indicator |
J0-J2 | HARDWARE ADDRESS SEL | Lower | Hardware Address Selection 1/0: Upper position 1, Lower position 0 |
J3 | PWR SEL | Left | Power/Logic Voltage Level Selection 3V3/5V: Left position 3V3, Right position 5V |
J4 | J4 | Upper | Interrupt Port Selection INTB/INTA: Upper position INTB, Lower position INTA |
EXPAND Click electrical specifications
Description | Min | Typ | Max | Unit |
---|---|---|---|---|
Supply Voltage | 3.3 | – | 5 | V |
Output Current Source/Sink | – | – | 25 | mA |
Software Support
We provide a library for the Expand Click as well as a demo application (example), developed using MIKROE compilers. The demo can run on all the main MIKROE development boards.
Package can be downloaded/installed directly from NECTO Studio Package Manager (recommended), downloaded from our LibStock™ or found on Mikroe github account.
Library Description
This library contains API for Expand Click driver.
Key functions
-
Set expander PORTA direction function.
-
Write one byte of data to register for PORTA function.
-
Reset function.
Example Description
This applicatioin use for expansion I/O lines.
void application_task ( void )
{
pin_position = 1;
for ( position = 0; position < 8; position++ )
{
expand_write_port_a( &expand, EXPAND_SPI_MODULE_POSITION_0, pin_position );
log_printf( &logger, " PA%d setrn", (uint16_t) position );
port_status = expand_read_port_b( &expand, EXPAND_SPI_MODULE_POSITION_0 );
log_printf( &logger, " Status PB (input) : %d rn", (uint16_t) port_status );
log_printf( &logger, "----------------rn" );
pin_position <<= 1;
Delay_ms( 500 );
}
}
The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager (recommended), downloaded from our LibStock™ or found on Mikroe github account.
Other Mikroe Libraries used in the example:
- MikroSDK.Board
- MikroSDK.Log
- Click.Expand
Additional notes and informations
Depending on the development board you are using, you may need USB UART click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. UART terminal is available in all MIKROE compilers.
mikroSDK
This Click board™ is supported with mikroSDK – MIKROE Software Development Kit. To ensure proper operation of mikroSDK compliant Click board™ demo applications, mikroSDK should be downloaded from the LibStock and installed for the compiler you are using.
For more information about mikroSDK, visit the official page.