We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]
Rating:
Author: MIKROE
Last Updated: 2021-02-02
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: Port expander
Downloaded: 2181 times
Not followed.
License: MIT license
EXPAND 7 Click is a compact add-on board that contains a multi-port I/O expander with bi-directional input/outputs or PWM outputs. This board features the CY8C9540A, 40-bit I/O port expander with EEPROM and 8 independently configurable 8-bit PWM outputs from Cypress Semiconductor.
Do you want to subscribe in order to receive notifications regarding "EXPAND 7 click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "EXPAND 7 click" changes.
Do you want to report abuse regarding "EXPAND 7 click".
Library Description
The library covers necessary functions that enables the usage of the EXPAND 7 click board. User can check or set the state of every pin, set PWM output or use on board user available EEPROM.
Key functions:
uint8_t expand7_read_pin ( uint16_t pin, uint8_t inv );
- Function is used to read the state of a defined pin.void expand7_write_pin ( uint16_t pin, uint8_t pin_val );
- Function is used to set a single output pin's logic level.void expand7_sel_pwm_pin ( uint16_t pin, uint8_t pwm_en );
- Function is used to enable or disable PWM output on a specific pin.Examples description
The application is composed of three sections :
void application_task ( )
{
for ( pin_num = 0; pin_num < 40; pin_num++ )
{
expand7_write_all ( 0xFF );
expand7_write_pin( pin_num, EXPAND7_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( 200 );
expand7_write_all ( 0xFF );
}
Delay_ms( 1000 );
}
Other mikroE Libraries used in the example:
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. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.