adc26 2.1.0.0
Loading...
Searching...
No Matches
Main Page

ADC 26 Click

‍ADC 26 Click is a compact add-on board for precise analog-to-digital signal conversion. This board features the ADS1015L, a low-power 12-bit ADC with an I2C-compatible interface from Texas Instruments. The ADS1015L features a ΔΣ ADC core with an internal voltage reference, programmable gain amplifier (PGA), and digital comparator, capable of measuring differential signals with a flexible input range from ±0.256V to ±6.144V at up to 3300 samples per second (SPS). It supports single-shot and continuous-conversion modes, offering both energy efficiency and real-time performance.

Click Product page


Click library

  • Author : Stefan Filipovic
  • Date : Sep 2024.
  • Type : I2C type

Software Support

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

Standard key functions :

  • adc26_cfg_setup Config Object Initialization function.
    void adc26_cfg_setup(adc26_cfg_t *cfg)
    ADC 26 configuration object setup function.
    ADC 26 Click configuration object.
    Definition adc26.h:232
  • adc26_init Initialization function.
    err_t adc26_init ( adc26_t *ctx, adc26_cfg_t *cfg );
    err_t adc26_init(adc26_t *ctx, adc26_cfg_t *cfg)
    ADC 26 initialization function.
    ADC 26 Click context object.
    Definition adc26.h:215
  • adc26_default_cfg Click Default Configuration function.
    err_t adc26_default_cfg ( adc26_t *ctx );
    err_t adc26_default_cfg(adc26_t *ctx)
    ADC 26 default configuration function.

Example key functions :

  • adc26_start_conversion This function starts a single-shot conversion for the selected MUX channel and gain level (full-scale range).
    err_t adc26_start_conversion ( adc26_t *ctx, uint8_t mux, uint8_t pga );
    err_t adc26_start_conversion(adc26_t *ctx, uint8_t mux, uint8_t pga)
    ADC 26 start conversion function.
  • adc26_get_alert_pin This function returns the ALERT (data ready) pin logic state.
    uint8_t adc26_get_alert_pin ( adc26_t *ctx );
    uint8_t adc26_get_alert_pin(adc26_t *ctx)
    ADC 26 get alert pin function.
  • adc26_read_voltage This function reads the RAW ADC measurement and converts it to a voltage level.
    err_t adc26_read_voltage ( adc26_t *ctx, float *voltage );
    err_t adc26_read_voltage(adc26_t *ctx, float *voltage)
    ADC 26 read voltage function.

Example Description

‍This example demonstrates the use of ADC 26 Click board by reading and displaying the voltage levels from IN0-IN1 differential and IN2-IN3 single-ended analog input channels.

The demo application is composed of two sections :

Application Init

‍Initializes the driver and performs the Click default configuration.

void application_init ( void )
{
log_cfg_t log_cfg;
adc26_cfg_t adc26_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
adc26_cfg_setup( &adc26_cfg );
ADC26_MAP_MIKROBUS( adc26_cfg, MIKROBUS_1 );
if ( I2C_MASTER_ERROR == adc26_init( &adc26, &adc26_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( ADC26_ERROR == adc26_default_cfg ( &adc26 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
@ ADC26_ERROR
Definition adc26.h:250
#define ADC26_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition adc26.h:202
void application_init(void)
Definition main.c:34

Application Task

‍Reads the voltage levels from IN0-IN1 differential (+/- 2.048V) and IN2-IN3 single-ended (+/- 4.096V) analog input channels and displays the results on the USB UART once per second approximately.

void application_task ( void )
{
float voltage = 0;
{
while ( adc26_get_alert_pin ( &adc26 ) ); // Waits for a data ready indication
if ( ADC26_OK == adc26_read_voltage ( &adc26, &voltage ) )
{
log_printf ( &logger, " Voltage between IN0[P] and IN1[N]: %.3f V\r\n", voltage );
}
}
{
while ( adc26_get_alert_pin ( &adc26 ) ); // Waits for a data ready indication
if ( ADC26_OK == adc26_read_voltage ( &adc26, &voltage ) )
{
log_printf ( &logger, " Voltage between IN2 and GND: %.3f V\r\n", voltage );
}
}
{
while ( adc26_get_alert_pin ( &adc26 ) ); // Waits for a data ready indication
if ( ADC26_OK == adc26_read_voltage ( &adc26, &voltage ) )
{
log_printf ( &logger, " Voltage between IN3 and GND: %.3f V\r\n\n", voltage );
}
}
Delay_ms ( 1000 );
}
@ ADC26_OK
Definition adc26.h:249
#define ADC26_MUX_P_AIN3_N_GND
Definition adc26.h:150
#define ADC26_MUX_P_AIN0_N_AIN1
ADC 26 MUX setting.
Definition adc26.h:143
#define ADC26_PGA_4_096V
Definition adc26.h:160
#define ADC26_MUX_P_AIN2_N_GND
Definition adc26.h:149
#define ADC26_PGA_2_048V
Definition adc26.h:159
void application_task(void)
Definition main.c:70

Note

‍Do not apply more than VCC + 0.3 V to the analog inputs of the device.

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

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.