TOP Contributors

  1. MIKROE (2660 codes)
  2. Alcides Ramos (356 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 (137009 times)
  2. FAT32 Library (70133 times)
  3. Network Ethernet Library (56028 times)
  4. USB Device Library (46350 times)
  5. Network WiFi Library (41966 times)
  6. FT800 Library (41291 times)
  7. GSM click (29055 times)
  8. mikroSDK (26489 times)
  9. PID Library (26452 times)
  10. microSD click (25413 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-04-03

Package Version: 2.1.0.5

mikroSDK Library: 2.0.0.0

Category: ADC

Downloaded: 51 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

Ambient 7 click

5

Ambient 7 Click is a light intensity-sensing and measuring Click board, which features an accurate light-intensity sensor labeled as SFH 5701 A01, made by Osram Opto Semiconductors.

[Learn More]

Shake2Wake Click

1

Shake2Wake click carries an ADXL362 accelerometer, a ADP195 power switch, and a screw terminal for activating external devices using the accelerometer’s built-in activity detection modes.

[Learn More]

eINK 1.54 inch display

0

eINK click is an adapter Click boardâ„¢, used to interface a compatible eINK display with the host MCU.

[Learn More]