TOP Contributors

  1. MIKROE (2782 codes)
  2. Alcides Ramos (377 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 codes)
  5. Bugz Bensce (97 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 (139598 times)
  2. FAT32 Library (72045 times)
  3. Network Ethernet Library (57273 times)
  4. USB Device Library (47636 times)
  5. Network WiFi Library (43232 times)
  6. FT800 Library (42570 times)
  7. GSM click (29933 times)
  8. mikroSDK (28315 times)
  9. PID Library (26939 times)
  10. microSD click (26312 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

ADC 18 Click

Rating:

0

Author: MIKROE

Last Updated: 2024-10-31

Package Version: 2.1.0.13

mikroSDK Library: 2.0.0.0

Category: ADC

Downloaded: 224 times

Not followed.

License: MIT license  

ADC 18 Click is a compact add-on board that contains a high-performance data converter. This board features the MAX22005, an SPI-configurable twelve-channel 24-bit analog-to-digital converter (ADC) from Analog Devices.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "ADC 18 Click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "ADC 18 Click" changes.

Do you want to report abuse regarding "ADC 18 Click".

  • Information
  • Comments (0)

mikroSDK Library Blog


ADC 18 Click

ADC 18 Click is a compact add-on board that contains a high-performance data converter. This board features the MAX22005, an SPI-configurable twelve-channel 24-bit analog-to-digital converter (ADC) from Analog Devices.

adc18_click.png

Click Product page


Click library

  • Author : Stefan Filipovic
  • Date : Mar 2022.
  • Type : SPI type

Software Support

We provide a library for the ADC 18 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 ADC 18 Click driver.

Standard key functions :

  • adc18_cfg_setup Config Object Initialization function.

    void adc18_cfg_setup ( adc18_cfg_t *cfg );
  • adc18_init Initialization function.

    err_t adc18_init ( adc18_t *ctx, adc18_cfg_t *cfg );
  • adc18_default_cfg Click Default Configuration function.

    err_t adc18_default_cfg ( adc18_t *ctx );

Example key functions :

  • adc18_set_active_channel This function sets the active channel.

    err_t adc18_set_active_channel ( adc18_t *ctx, uint8_t channel );
  • adc18_start_conversion This function starts the conversion with the selected data rate.

    err_t adc18_start_conversion ( adc18_t *ctx, uint8_t data_rate );
  • adc18_read_voltage This function reads RAW ADC value of previous conversion and converts it to voltage.

    err_t adc18_read_voltage ( adc18_t *ctx, float *voltage );

Example Description

This example demonstrates the use of ADC 18 Click board by reading the voltage from 12 analog input single-ended channels.

The demo application is composed of two sections :

Application Init

Initializes the driver and logger, and performs the Click default configuration.


void application_init ( void )
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    adc18_cfg_t adc18_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_info( &logger, " Application Init " );

    // Click initialization.
    adc18_cfg_setup( &adc18_cfg );
    ADC18_MAP_MIKROBUS( adc18_cfg, MIKROBUS_1 );
    if ( SPI_MASTER_ERROR == adc18_init( &adc18, &adc18_cfg ) )
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }

    if ( ADC18_ERROR == adc18_default_cfg ( &adc18 ) )
    {
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    }

    log_info( &logger, " Application Task " );
}

Application Task

Reads and displays the voltage from 12 analog input single-ended channels on the USB UART approximately once per second.

void application_task ( void )
{
    static uint8_t channel = ADC18_CH_AI1_SINGLE_ENDED;
    if ( ADC18_OK == adc18_set_active_channel ( &adc18, channel ) )
    {
        adc18_start_conversion ( &adc18, ADC18_DATA_RATE_225_SPS );

        // Waits for the availability of the conversion result
        while ( adc18_get_rdy_pin ( &adc18 ) );

        adc18_stop_conversion ( &adc18 );

        float voltage;
        if ( ADC18_OK == adc18_read_voltage ( &adc18, &voltage ) )
        {
            log_printf ( &logger, "Channel AI%u: %.2f V\r\n", channel + 1, voltage );
            if ( ++channel > ADC18_CH_AI12_SINGLE_ENDED )
            {
                channel = ADC18_CH_AI1_SINGLE_ENDED;
                log_printf ( &logger, "\r\n" );
                Delay_ms ( 1000 );
            }
        }
    }
}

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.ADC18

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

Slider Click

0

Slider Click features a mechanical slide action potentiometer - a slider, which gives a nice feeling when actuating, along with 16 SMD LEDs, that can be used for any kind of visual feedback. The onboard high-resolution 22-bit ADC can detect even the smallest move, faithfully capturing the smoothness of the slider movement, while digitizing its position. The 16 onboard SMD LEDs can give a nice visual feedback of the slider position, but those LEDs can also be used for other purposes since they are not hardwired to the slider.

[Learn More]

Load Cell 8 Click

0

Load Cell 8 Click is a compact add-on board representing a weigh scale solution. This board features the ZSC31050, an advanced differential sensor signal conditioner from Renesas designed for high-precision signal conditioning in applications requiring detailed sensor-specific corrections. It excels in processing differential sensor signals for various resistive bridge sensors. The ZSC31050 is capable of highly accurate amplification, offering digital compensation of sensor offset, sensitivity, temperature drift, and non-linearity. It supports a broad signal range from 1mV/V to 275mV/V, making its use across industrial, medical, and consumer applications.

[Learn More]

Heart Rate 7 Click

0

Heart Rate 7 Click is an optical biosensor Click board™ which can be used for heart-rate monitoring (HRM). This Click board™ employs a very sensitive analog front-end IC with high dynamic range, which ensures accurate and reliable readings. This analog front-end IC is coupled with the optical front end, which consists of a sensitive photo-diode (PD) and two high brightness green LEDs.

[Learn More]