adc24  2.1.0.0
Main Page

ADC 24 click

ADC 24 Click is a compact add-on board for high-speed analog to digital conversion. This board features the AD7490, a 12-bit, 16-channel successive approximation ADC from Analog Devices, optimized for efficient power usage with a consumption of just 2.5mA from a 5V supply while achieving up to 1MSPS throughput rates. The board features 16 single-ended analog inputs with a configurable input range, supported by a channel sequencer for sequential channel conversion and multiple operational modes for flexible power management. This makes ADC 24 Click ideal for extensive system monitoring applications such as multichannel system monitoring, power line monitoring, data acquisition, instrumentation, and process control, serving various industrial and tech applications.

click Product page


Click library

  • Author : Nenad Filipovic
  • Date : Dec 2023.
  • Type : SPI type

Software Support

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

Standard key functions :

Example key functions :

  • adc24_get_voltage This function reads the results of 12-bit ADC raw data and converts them to proportional voltage levels by using the SPI serial interface.
    err_t adc24_get_voltage ( adc24_t *ctx, adc24_ctrl_t ctrl, uint8_t *in_pos, float *voltage );
  • adc24_get_adc_data This function reads a conversion result and selected channel by using the SPI serial interface.
    err_t adc24_get_adc_data ( adc24_t *ctx, adc24_ctrl_t ctrl, uint8_t *in_pos, uint16_t *adc_data );

Example Description

This example demonstrates the use of the ADC 24 Click board by reading and writing data by using the SPI serial interface and reading results of AD conversion.

The demo application is composed of two sections :

Application Init

Initialization of SPI module and log UART.

void application_init ( void )
{
log_cfg_t log_cfg;
adc24_cfg_t adc24_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
adc24_cfg_setup( &adc24_cfg );
ADC24_MAP_MIKROBUS( adc24_cfg, MIKROBUS_1 );
if ( SPI_MASTER_ERROR == adc24_init( &adc24, &adc24_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
ctrl.ch_sel = ADC24_CH_SEL_IN_0;
ctrl.pm = ADC24_PM_NORMAL;
ctrl.seq_shadow = ADC24_SEQ_SHADOW_AN_INPUT;
ctrl.range = ADC24_RANGE_VREF_5V;
ctrl.coding = ADC24_CODING_BIN;
log_info( &logger, " Application Task " );
log_printf( &logger, "_____________\r\n" );
}

Application Task

The demo application reads the voltage levels from all 15 analog input channels and displays the results. Results are being sent to the UART Terminal, where you can track their changes.

void application_task ( void )
{
uint8_t ch_pos = 0;
float voltage = 0;
for ( uint8_t n_cnt = ADC24_CH_SEL_IN_0; n_cnt <= ADC24_CH_SEL_IN_15; n_cnt++ )
{
ctrl.ch_sel = n_cnt;
if ( ADC24_OK == adc24_get_voltage( &adc24, ctrl, &ch_pos, &voltage ) )
{
log_printf( &logger, " IN%u : %.3f V\r\n", ( uint16_t ) ch_pos, voltage );
}
Delay_ms( 100 );
}
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.ADC24

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.


adc24_get_adc_data
err_t adc24_get_adc_data(adc24_t *ctx, adc24_ctrl_t ctrl, uint8_t *in_pos, uint16_t *adc_data)
ADC 24 get ADC data function.
adc24_init
err_t adc24_init(adc24_t *ctx, adc24_cfg_t *cfg)
ADC 24 initialization function.
ADC24_CH_SEL_IN_15
#define ADC24_CH_SEL_IN_15
Definition: adc24.h:127
ADC24_OK
@ ADC24_OK
Definition: adc24.h:256
ADC24_CODING_BIN
#define ADC24_CODING_BIN
Definition: adc24.h:157
adc24_t
ADC 24 Click context object.
Definition: adc24.h:208
application_task
void application_task(void)
Definition: main.c:70
ADC24_PM_NORMAL
#define ADC24_PM_NORMAL
Definition: adc24.h:136
adc24_cfg_t
ADC 24 Click configuration object.
Definition: adc24.h:221
adc24_cfg_setup
void adc24_cfg_setup(adc24_cfg_t *cfg)
ADC 24 configuration object setup function.
ADC24_WEAK_DOUT_THREE_STATE
#define ADC24_WEAK_DOUT_THREE_STATE
ADC 24 serial transfer setting.
Definition: adc24.h:142
adc24_get_voltage
err_t adc24_get_voltage(adc24_t *ctx, adc24_ctrl_t ctrl, uint8_t *in_pos, float *voltage)
ADC 24 get voltage level function.
application_init
void application_init(void)
Definition: main.c:32
ADC24_SEQ_SHADOW_AN_INPUT
#define ADC24_SEQ_SHADOW_AN_INPUT
ADC 24 sequence selection setting.
Definition: adc24.h:103
ADC24_RANGE_VREF_5V
#define ADC24_RANGE_VREF_5V
ADC 24 analog input range selection setting.
Definition: adc24.h:149
ADC24_MAP_MIKROBUS
#define ADC24_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition: adc24.h:194
adc24_ctrl_t
ADC 24 Click control object.
Definition: adc24.h:240
ADC24_CH_SEL_IN_0
#define ADC24_CH_SEL_IN_0
ADC 24 channel selection setting.
Definition: adc24.h:112