How does it work?
Expand 11 Click is based on the TCA9536, a general-purpose I/O expander from Texas Instruments. It contains four 4-bit configuration ports alongside an I2C-compatible serial interface. Any four I/Os can be configured by the host MCU as an input or output by writing to the configuration register. During the Power-On sequence, the I/Os are configured as inputs with a weak pull-up to the selected mikroBUS™ power rail. The data for each input or output is kept in the corresponding register. The polarity of the Input Port register can be inverted with the Polarity Inversion register. The TCA9536 outputs (latched) have high-current drive capability for directly driving LEDs.
This Click board™ communicates with MCU using the standard I2C 2-Wire interface to read data and configure settings with a maximum frequency of 1MHz. The Expand 11 Click can also select the function of one of the ports, the P3 port, between its standard I/O and interrupt function. The selection is made by positioning SMD jumpers labeled P3 SEL in an appropriate position marked as I/O or INT. In addition to the jumper setting to the proper place, this function must also be set in the special function register to disable the internal pull-up resistors and P3 override to an INT output.
This Click board™ can operate with either 3.3V or 5V logic voltage levels selected via the VCC SEL jumper. This way, it is allowed for both 3.3V and 5V capable MCUs to 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 system monitoring applications, industrial controllers, portable equipment, and more
On-board modules
TCA9536 – general-purpose I/O expander from Texas Instruments
Key Features
I2C to GPIO expander, wide supply range, 5V tolerant I/O ports, reset feature via serial interface, P3 port configurable as interrupt, polarity inversion, low power consumption, and more
Interface
I2C
Feature
ClickID
Compatibility
mikroBUS™
Click board size
M (42.9 x 25.4 mm)
Input Voltage
3.3V or 5V
Pinout diagram
This table shows how the pinout on Expand 11 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 |
JP1 | VCC SEL | Left | Logic Level Voltage Selection 3V3/5V: Left position 3V3, Right position 5V |
JP2 | P3 SEL | Left | P3 Port Function Selection I/O/INT: Left position I/O, Right position INT |
Expand 11 Click electrical specifications
Description | Min | Typ | Max | Unit |
---|---|---|---|---|
Supply Voltage | 3.3 | – | 5 | V |
Software Support
We provide a library for the Expand 11 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 11 Click driver.
Key functions
-
expand11_set_pin_direction
This function sets the direction of the selected pins. -
expand11_set_all_pins_value
This function sets the value of all output pins. -
expand11_read_port_value
This function reads the value of the port input pins.
Example Description
This example demonstrates the use of Expand 11 Click board™ by setting and reading the port state.
void application_task ( void )
{
static uint16_t pin_num = EXPAND11_PIN_0_MASK;
uint8_t port_value = 0;
if ( EXPAND11_OK == expand11_set_all_pins_value( &expand11, pin_num ) )
{
if ( EXPAND11_OK == expand11_read_port_value( &expand11, &port_value ) )
{
log_printf( &logger, " PORT STATUS rn" );
log_printf( &logger, " P0: %urn", ( uint16_t ) ( port_value & EXPAND11_PIN_0_MASK ) );
log_printf( &logger, " P1: %urn", ( uint16_t ) ( ( port_value & EXPAND11_PIN_1_MASK ) >> 1 ) );
log_printf( &logger, " P2: %urn", ( uint16_t ) ( ( port_value & EXPAND11_PIN_2_MASK ) >> 2 ) );
log_printf( &logger, " P3: %urnn", ( uint16_t ) ( ( port_value & EXPAND11_PIN_3_MASK ) >> 3 ) );
pin_num = ( ~pin_num ) & EXPAND11_ALL_PINS_MASK;
}
}
Delay_ms( 1000 );
}
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.Expand11
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.