ADC 10 click
ADC 10 Click is a compact add-on board that contains a high-performance data converter. This board features the ADS122U04, a 24-bit precision ΔΣ analog-to-digital converter with UART compatible interface from Texas Instruments.
click Product page
Click library
- Author : Nenad Filipovic
- Date : Dec 2020.
- Type : UART type
Software Support
We provide a library for the Adc10 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 10 Click driver.
Standard key functions :
adc10_cfg_setup
Config Object Initialization function.
void adc10_cfg_setup(adc10_cfg_t *cfg)
ADC 10 configuration object setup function.
ADC 10 Click configuration object.
Definition adc10.h:416
adc10_init
Initialization function.
err_t adc10_init(adc10_t *ctx, adc10_cfg_t *cfg)
ADC 10 initialization function.
ADC 10 Click context object.
Definition adc10.h:391
adc10_default_cfg
Click Default Configuration function.
void adc10_default_cfg(adc10_t *ctx)
ADC 10 default configuration function.
Example key functions :
adc10_start_sync
ADC 10 Start the synchronization function.
void adc10_start_sync(adc10_t *ctx)
ADC 10 Start the synchronization function.
adc10_get_ch_output
ADC 10 Get the channel output function.
int32_t adc10_get_ch_output(adc10_t *ctx, uint8_t sel_ch)
ADC 10 Get the channel output function.
adc10_calc_voltage
ADC 10 Calculate the voltage function.
float adc10_calc_voltage(adc10_t *ctx, int32_t adc_data, float vref, uint8_t gain)
ADC 10 Calculate the voltage function.
Examples Description
This is an example that demonstrates the use of the ADC 10 click board.
The demo application is composed of two sections :
Application Init
Initialization driver enables - UART,
select analog input channel 0, perform a hardware and software reset and set the default device configuration, also, write a log.
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_printf( &logger, "\r\n-------------------------\r\n" );
log_info( &logger, " Application Init " );
err_t init_flag =
adc10_init( &adc10, &adc10_cfg );
if ( init_flag == UART_ERROR ) {
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
Delay_ms ( 100 );
Delay_ms ( 1000 );
log_info( &logger, " Application Task " );
Delay_ms ( 100 );
}
#define ADC10_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition adc10.h:377
#define ADC10_ANALOG_INPUT_CH_3
Definition adc10.h:321
void adc10_reset(adc10_t *ctx)
ADC 10 Software reset function.
void adc10_hw_reset(adc10_t *ctx)
ADC 10 Hardware reset function.
void application_init(void)
Definition main.c:37
Application Task
In this example, we monitor and display
24-bits of data ( from 0 to 8388607 ) of ADC and voltage ( from 0 mV to 2048 mV ) on the selected channel ( CH-0, CH-1, CH-2 or CH-3 ). Results are being sent to the Usart Terminal where you can track their changes. All data logs write on USB uart changes approximately for every 1 sec.
Delay_ms ( 1 );
log_printf( &logger, "-------------------------\r\n" );
log_printf( &logger, " ADC CH-%u : %.0f\r\n", ( uint16_t ) select_ch, ( float ) out_data );
log_printf( &logger, " Voltage : %.2f mV\r\n", voltage );
Delay_ms ( 1000 );
}
#define ADC10_VREF_INTERNAL
Definition adc10.h:349
#define ADC10_GAIN_1
ADC 10 Gain value.
Definition adc10.h:334
#define ADC10_NEW_DATA_NOT_READY
Definition adc10.h:328
uint8_t adc10_check_drdy(adc10_t *ctx)
ADC 10 Check DRDY function.
void application_task(void)
Definition main.c:86
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.Adc10
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.