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 (136876 times)
  2. FAT32 Library (70000 times)
  3. Network Ethernet Library (55999 times)
  4. USB Device Library (46305 times)
  5. Network WiFi Library (41924 times)
  6. FT800 Library (41206 times)
  7. GSM click (29012 times)
  8. PID Library (26423 times)
  9. mikroSDK (26396 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

Analog MUX 2 click

Rating:

0

Author: MIKROE

Last Updated: 2024-04-03

Package Version: 2.1.0.19

mikroSDK Library: 2.0.0.0

Category: Measurements

Downloaded: 108 times

Not followed.

License: MIT license  

Analog MUX 2 Click is a compact add-on board that switches one of the eight inputs to one output. This board features the ADG728, a low voltage, CMOS 8-channel analog matrix switch with a serially controlled 2-wire interface from Analog Devices. The ADG728 can operate equally well as either multiplexer, demultiplexer, or switch array easily connected to a 9 pole spring action block terminal. It provides flexibility and features a low on-resistance closely matched between switches and very flat over the full signal range. This Click board™ is suitable for a wide range of applications, from industrial and instrumentation to medical, consumer, communications, and automotive systems.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "Analog MUX 2 click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "Analog MUX 2 click" changes.

Do you want to report abuse regarding "Analog MUX 2 click".

  • Information
  • Comments (0)

mikroSDK Library Blog


Analog MUX 2 click

Analog MUX 2 Click is a compact add-on board that switches one of the eight inputs to one output. This board features the ADG728, a low voltage, CMOS 8-channel analog matrix switch with a serially controlled 2-wire interface from Analog Devices. The ADG728 can operate equally well as either multiplexer, demultiplexer, or switch array easily connected to a 9 pole spring action block terminal. It provides flexibility and features a low on-resistance closely matched between switches and very flat over the full signal range. This Click board™ is suitable for a wide range of applications, from industrial and instrumentation to medical, consumer, communications, and automotive systems.

analogmux2_click.png

click Product page


Click library

  • Author : Nenad Filipovic
  • Date : Dec 2020.
  • Type : I2C type

Software Support

We provide a library for the AnalogMux2 Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.

Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on mikroE github account.

Library Description

This library contains API for AnalogMux2 Click driver.

Standard key functions :

  • Config Object Initialization function.

    void analogmux2_cfg_setup ( analogmux2_cfg_t *cfg );
  • Initialization function.

    ANALOGMUX2_RETVAL analogmux2_init ( analogmux2_t *ctx, analogmux2_cfg_t *cfg );
  • Click Default Configuration function.

    void analogmux2_default_cfg ( analogmux2_t *ctx );

Example key functions :

  • Analog MUX 2 set channel function.

    err_t analogmux2_set_channel ( analogmux2_t *ctx, uint8_t mux_ch );
  • Analog MUX 2 read AN pin value function.

    err_t analogmux2_read_an_pin_value ( analogmux2_t *ctx, uint16_t *data_out );
  • Analog MUX 2 read AN pin voltage level function.

    err_t analogmux2_read_an_pin_voltage ( analogmux2_t *ctx, float *data_out );

Examples Description

This application controls the multiplexing of a single input channel with an eight-channel matrix switch.

The demo application is composed of two sections :

Application Init

Initializes I2C and ADC driver, set Vref, STM32F407ZG - 2.048 V, PIC18F97J94 3.3 V, set the default configuration and start to write log.

void application_init ( void ) {
    log_cfg_t log_cfg;                /**< Logger config object. */
    analogmux2_cfg_t analogmux2_cfg;  /**< Click config object. */

    /** 
     * Logger initialization.
     * Default baud rate: 115200
     * Default log level: LOG_LEVEL_DEBUG
     * @note If USB_UART_RX and USB_UART_TX 
     * are defined as HAL_PIN_NC, you will 
     * need to define them manually for log to work. 
     * See @b LOG_MAP_USB_UART macro definition for detailed explanation.
     */
    LOG_MAP_USB_UART( log_cfg );
    log_init( &logger, &log_cfg );
    log_printf( &logger, "\r\n" );
    log_info( &logger, " Application Init " );

    // Click initialization.

    analogmux2_cfg_setup( &analogmux2_cfg );
    ANALOGMUX2_MAP_MIKROBUS( analogmux2_cfg, MIKROBUS_1 );

    // Vref STM32F407ZG
    analogmux2_cfg.vref = 2.048;

    err_t init_flag = analogmux2_init( &analogmux2, &analogmux2_cfg );
    if ( init_flag == I2C_MASTER_ERROR ) {
        log_error( &logger, " Application Init Error. " );
        log_info( &logger, " Please, run program again... " );

        for ( ; ; );
    }

    analogmux2_default_cfg ( &analogmux2 );
    log_info( &logger, " Application Task " );
    log_printf( &logger, "-------------------------\r\n" );
    Delay_ms ( 100 );
}

Application Task

This is an example that shows the use of a Analog MUX 2 click board. In this example, we switch from channel AN0 to channel AN7, read and display the analog value and voltage on the active channel. Results are being sent to the Usart Terminal where you can track their changes.

void application_task ( void ) {   
    for ( uint8_t ch_pos = ANALOGMUX2_SET_CHANNEL_0; ch_pos <= ANALOGMUX2_SET_CHANNEL_7; ch_pos++ ) {
        analogmux2_set_channel( &analogmux2, ch_pos );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );

        uint16_t analogmux2_an_value = 0;

        log_printf( &logger, "   CHANNEL    : AN%u     \r\n", ( uint16_t ) analogmux2_get_channel( &analogmux2 ) );
        log_printf( &logger, "- - - - - - - - - - - - - \r\n" );

        if ( analogmux2_read_an_pin_value ( &analogmux2, &analogmux2_an_value ) != ADC_ERROR ) {
            log_printf( &logger, "   ADC Value  : %u\r\n", analogmux2_an_value );
        }

        float analogmux2_an_voltage = 0;

        if ( analogmux2_read_an_pin_voltage ( &analogmux2, &analogmux2_an_voltage ) != ADC_ERROR ) {
            log_printf( &logger, "   AN Voltage : %.3f V \r\n", analogmux2_an_voltage );
        }

        log_printf( &logger, "-------------------------\r\n" );
    }   
}

The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on mikroE github account.

Other mikroE Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.AnalogMux2

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 Mikroelektronika compilers.


ALSO FROM THIS AUTHOR

ISM 5 click

0

ISM 5 Click is a compact add-on board designed for seamless integration into a wide range of applications requiring efficient communication in the Sub-GHz 868MHz frequency band. This board features the Si4461, a high-performance, low-current transceiver from Silicon Labs known for its robust operation in time division duplexing (TDD) mode, enabling alternating transmission and reception of data packets.

[Learn More]

MCP1664 click

0

MCP1664 click contains 4 high-power white LEDs. It carries the MCP1664, a high-voltage step-up LED driver from Microchip.

[Learn More]

TempHum 18 click

0

Temp&Hum 18 Click is a compact add-on board that represents temperature and humidity sensing solutions. This board features the HS3003, a highly accurate, fully calibrated relative humidity and temperature sensor from Renesas. It features proprietary sensor-level protection, ensuring high reliability and long-term stability. Integrated calibration and temperature-compensation logic provides fully corrected RH and temperature values via standard I2C output. No user calibration of the output data is required. The high accuracy, fast measurement response time, and long-term stability make this Click board™ ideal for various temperature and humidity-related applications and a vast number of applications ranging from portable devices to products designed for harsh environments.

[Learn More]