TOP Contributors

  1. MIKROE (2769 codes)
  2. Alcides Ramos (374 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 (139362 times)
  2. FAT32 Library (71816 times)
  3. Network Ethernet Library (57150 times)
  4. USB Device Library (47467 times)
  5. Network WiFi Library (43123 times)
  6. FT800 Library (42441 times)
  7. GSM click (29860 times)
  8. mikroSDK (28203 times)
  9. PID Library (26895 times)
  10. microSD click (26225 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 21 Click

Rating:

0

Author: MIKROE

Last Updated: 2024-10-31

Package Version: 2.1.0.7

mikroSDK Library: 2.0.0.0

Category: ADC

Downloaded: 101 times

Not followed.

License: MIT license  

ADC 21 Click is a compact add-on board that converts an analog voltage into a digital representation. This board features the ADC1283, a low-power, eight-channel pure CMOS 12-bit analog-to-digital converter from STMicroelectronics. The ADC1283 is specified for conversion from 50ksps to 200ksps. Its architecture is based on a successive approximation register with an internal track-and-hold cell. It features eight single-ended multiplexed inputs, where the output serial data is straight binary and SPI-compatible.

No Abuse Reported

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

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

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

  • Information
  • Comments (0)

mikroSDK Library Blog


ADC 21 Click

ADC 21 Click is a compact add-on board that converts an analog voltage into a digital representation. This board features the ADC1283, a low-power, eight-channel pure CMOS 12-bit analog-to-digital converter from STMicroelectronics. The ADC1283 is specified for conversion from 50ksps to 200ksps. Its architecture is based on a successive approximation register with an internal track-and-hold cell. It features eight single-ended multiplexed inputs, where the output serial data is straight binary and SPI-compatible.

adc21_click.png

Click Product page


Click library

  • Author : Stefan Filipovic
  • Date : Jan 2023.
  • Type : SPI type

Software Support

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

Standard key functions :

  • adc21_cfg_setup Config Object Initialization function.

    void adc21_cfg_setup ( adc21_cfg_t *cfg );
  • adc21_init Initialization function.

    err_t adc21_init ( adc21_t *ctx, adc21_cfg_t *cfg );

Example key functions :

  • adc21_read_raw_adc This function reads raw ADC value from the selected channel by using SPI serial interface.

    err_t adc21_read_raw_adc ( adc21_t *ctx, uint8_t channel, uint16_t *raw_adc );
  • adc21_read_voltage This function reads raw ADC value from the selected channel and converts it to proportional voltage level depending on the avcc selection.

    err_t adc21_read_voltage ( adc21_t *ctx, uint8_t channel, float avcc, float *voltage );

Example Description

This example demonstrates the use of ADC 21 Click board by reading and displaying the voltage levels from 8 analog input channels.

The demo application is composed of two sections :

Application Init

Initializes the driver and logger.


void application_init ( void )
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    adc21_cfg_t adc21_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.
    adc21_cfg_setup( &adc21_cfg );
    ADC21_MAP_MIKROBUS( adc21_cfg, MIKROBUS_1 );
    if ( SPI_MASTER_ERROR == adc21_init( &adc21, &adc21_cfg ) )
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }

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

Application Task

Reads the voltage levels from all 8 analog input channels and displays the results on the USB UART once per second approximately.

void application_task ( void )
{
    static uint8_t ch_num = ADC21_CHANNEL_0;
    float ch_voltage;
    if ( ADC21_OK == adc21_read_voltage ( &adc21, ch_num, ADC21_AVCC_3V3, &ch_voltage ) )
    {
        log_printf ( &logger, " CH%u voltage: %.2f V\r\n", ( uint16_t ) ch_num, ch_voltage );
    }
    if ( ++ch_num > ADC21_CHANNEL_7 )
    {
        log_printf ( &logger, " ------------------------\r\n\n" );
        ch_num = ADC21_CHANNEL_0;
        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.ADC21

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

7x10 R Click

0

7x10 R Click is a LED dot matrix display Click, which can be used to display graphics or letters in a very simple and easy way. The Click board has two LED dot matrix modules with 7x5 stylish, round, dot-like LED elements. These displays produce clean and uniform patterns since the elements are optically isolated from each other and there is no light bleeding between the adjacent LED cells. Additionally, turn-on and turn-off times of the matrix cells are optimized for a clean and fluid display performance, with no flickering or lag.

[Learn More]

RGB Driver Click

0

RGB Driver Click is an RGB LED driver, capable of driving RGB LED stripes, LED fixtures and other RGB LED applications that demand an increased amount of current and voltage.

[Learn More]

TouchPad 3 click

5

Touchpad 3 Click is a compact add-on board that allows users to easily integrate projected capacitive touch into their applications.

[Learn More]