Expand 6 Click Board
Expand 6 Click Board
Key Features:
- 20-bit, 100kHz I2C port expander, flexible I2C address configuration, internal 3Kbyte EEPROM, user default storage, and more.
- The Expand 6 Click is based on the CY8C9520A, 20-bit I/O expander with EEPROM, and 4 independently configurable 8-bit PWM outputs from Cypress Semiconductor.
- Can be used to monitor and control LEDs and system intrusion detection devices, but also as a storage for information such as error codes or board manufacturing data for diagnostic purposes.
- mikroBUS: I2C Interface
The Expand 6 Click Board™ is a compact add-on board that contains an I2C configurable multi-port I/O expander with independently configurable pins as bi-directional input/outputs or PWM outputs. This board features the CY8C9520A, 20-bit I/O expander with EEPROM, and 4 independently configurable 8-bit PWM outputs from Cypress Semiconductor. The CY8C9520A operates as two I2C slave devices, first as a multi-port I/O expander, and second as a serial EEPROM with 3 Kbyte address space. It has a user default storage, flexible I2C address configuration, and a programmable interrupt function that indicates input pin level changes and PWM state changes. This Click Board™ can be used to monitor and control LEDs and system intrusion detection devices, but also as a storage for information such as error codes or board manufacturing data for diagnostic purposes.
The Expand 6 Click is supported by a mikroSDK compliant library, which includes functions that simplify software development. This Click Board™ comes as a fully tested product, ready to be used on a system equipped with the mikroBUS™ socket.
Software Support
We provide a library for the Expand 6 Click Board™ on our LibStock page, as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
Library Description
The library covers necessary functions that enable the usage of the EXPAND 6 click board. You can check or set the state of every pin, set PWM output or use onboard user available EEPROM.
Key Functions
uint8_t expand6_read_pin ( uint16_t pin, uint8_t inv );
- Function is used to read the state of a defined pin.void expand6_write_pin ( uint16_t pin, uint8_t pin_val );
- Function is used to set a single output pin's logic level.void expand6_sel_pwm_pin ( uint16_t pin, uint8_t pwm_en );
- Function is used to enable or disable PWM output on a specific pin.
Example Description
The application is composed of three sections :
- System Initialization - Initializes I2C module, LOG structure and sets RST pin as output and INT pin as input.
- Application Initialization - Initalizes I2C driver and makes an initial log.
- Application Task - (code snippet) This example shows the capabilities of the EXPAND 6 click by toggling each of 20 available pins.
void application_task ( ) { mikrobus_logWrite( " PORT 0 ", _LOG_LINE ); for ( pin_num = 0; pin_num < 8; pin_num++ ) { expand6_write_port( EXPAND6_PORT_0, 0xFF ); expand6_write_pin( pin_num, EXPAND6_LOW ); mikrobus_logWrite( "Pin ", _LOG_TEXT ); ByteToStr( pin_num, log_txt ); Ltrim( log_txt ); mikrobus_logWrite( log_txt, _LOG_TEXT ); mikrobus_logWrite( " is low!", _LOG_LINE ); Delay_ms( 500 ); expand6_write_port( EXPAND6_PORT_0, 0xFF ); } Delay_ms( 1000 ); mikrobus_logWrite( " PORT 1 ", _LOG_LINE ); for ( pin_num = 8; pin_num < 16; pin_num++ ) { expand6_write_port( EXPAND6_PORT_1, 0xFF ); expand6_write_pin( pin_num, EXPAND6_LOW ); mikrobus_logWrite( "Pin ", _LOG_TEXT ); ByteToStr( pin_num, log_txt ); Ltrim( log_txt ); mikrobus_logWrite( log_txt, _LOG_TEXT ); mikrobus_logWrite( " is low!", _LOG_LINE ); Delay_ms( 500 ); expand6_write_port( EXPAND6_PORT_1, 0xFF ); } Delay_ms( 1000 ); mikrobus_logWrite( " PORT 2 ", _LOG_LINE ); for ( pin_num = 16; pin_num < 20; pin_num++ ) { expand6_write_port( EXPAND6_PORT_2, 0xFF ); expand6_write_pin( pin_num, EXPAND6_LOW ); mikrobus_logWrite( "Pin ", _LOG_TEXT ); ByteToStr( pin_num, log_txt ); Ltrim( log_txt ); mikrobus_logWrite( log_txt, _LOG_TEXT ); mikrobus_logWrite( " is low!", _LOG_LINE ); Delay_ms( 500 ); expand6_write_port( EXPAND6_PORT_2, 0xFF ); } mikrobus_logWrite( "-------------------", _LOG_LINE ); Delay_ms( 1000 ); }
The full application code, and ready to use projects can be found on our LibStock page.
Other mikroE Libraries used in the example:
- I2C
- UART
- Conversions
Additional Notes and Information
Depending on the development board you are using, you may need a 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. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.
mikroSDK
This Click board™ is supported with mikroSDK - MikroElektronika 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.
Expand 6 Click Board
Frequently Asked Questions
Have a Question?
Be the first to ask a question about this.