TOP Contributors

  1. MIKROE (2656 codes)
  2. Alcides Ramos (353 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (112 codes)
  5. Chisanga Mumba (90 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (136883 times)
  2. FAT32 Library (70004 times)
  3. Network Ethernet Library (56000 times)
  4. USB Device Library (46305 times)
  5. Network WiFi Library (41930 times)
  6. FT800 Library (41208 times)
  7. GSM click (29014 times)
  8. PID Library (26423 times)
  9. mikroSDK (26398 times)
  10. microSD click (25386 times)
Libstock prefers package manager

Package Manager

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]

< Back
mikroSDK Library

EXPAND 6

Rating:

5

Author: MIKROE

Last Updated: 2020-09-11

Package Version: 1.0.0.0

mikroSDK Library: 1.0.0.0

Category: Port expander

Downloaded: 2093 times

Not followed.

License: MIT license  

EXPAND 6 Click 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.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "EXPAND 6" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "EXPAND 6" changes.

Do you want to report abuse regarding "EXPAND 6".

  • mikroSDK Library 2.0.0.0
  • Comments (0)
DOWNLOAD LINK RELATED COMPILER CONTAINS
mikroBasic PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc

mikroSDK Library Blog

EXPAND 6 Click

EXPAND 6 Click

Native view of the EXPAND 6 Click board.

View full image
EXPAND 6 Click

EXPAND 6 Click

Front and back view of the EXPAND 6 Click board.

View full image

Library Description

The library covers necessary functions that enables the usage of the EXPAND 6 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 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.

Examples 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 );
}

Other mikroE Libraries used in the example:

  • I2C
  • UART
  • Conversions

Additional notes and informations

Depending on the development board you are using, you may need USB UART clickUSB 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.

ALSO FROM THIS AUTHOR

Driver click

5

Driver click features an IC with seven integrated high-current sink drivers drivers, which can be used to drive a wide range of loads via simple parallel interface.

[Learn More]

DC Motor 11 click

5

DC Motor 11 Click is a brushed DC motor driver with the current limiting and current sensing. It is based on the DRV8830, an integrated H-Bridge driver IC, optimized for motor driving applications.

[Learn More]

DC Motor 24 click

0

DC Motor 24 Click is a compact add-on board with a brushed DC motor driver. This board features the L9958, an SPI-controlled H-bridge from STMicroelectronics. The L9958 is rated for an operating voltage range from 4V to 28V, with direct PWM motor control and current regulation threshold set by the SPI interface from 2.5A to 8.6A. It also has complete diagnostic and protection capabilities supporting the robust and reliable operation.

[Learn More]