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]
Rating:
Author: MIKROE
Last Updated: 2024-12-18
Package Version: 2.1.0.1
mikroSDK Library: 2.0.0.0
Category: ADC
Downloaded: 4 times
Not followed.
License: MIT license
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.
Do you want to subscribe in order to receive notifications regarding "ADC 26 Click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "ADC 26 Click" changes.
Do you want to report abuse regarding "ADC 26 Click".
DOWNLOAD LINK | RELATED COMPILER | CONTAINS |
---|---|---|
5805_adc_26_click.zip [594.10KB] | mikroC AI for ARM GCC for ARM Clang for ARM mikroC AI for PIC mikroC AI for PIC32 XC32 GCC for RISC-V Clang for RISC-V mikroC AI for AVR mikroC AI for dsPIC XC16 |
|
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.
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.
This library contains API for ADC 26 Click driver.
adc26_cfg_setup
Config Object Initialization function.
void adc26_cfg_setup ( adc26_cfg_t *cfg );
adc26_init
Initialization function.
err_t adc26_init ( adc26_t *ctx, adc26_cfg_t *cfg );
adc26_default_cfg
Click Default Configuration function.
err_t adc26_default_cfg ( adc26_t *ctx );
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 );
adc26_get_alert_pin
This function returns the ALERT (data ready) pin logic state.
uint8_t adc26_get_alert_pin ( adc26_t *ctx );
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 );
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 :
Initializes the driver and performs the Click default configuration.
void application_init ( void )
{
log_cfg_t log_cfg; /**< Logger config object. */
adc26_cfg_t adc26_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.
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 " );
}
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;
if ( ADC26_OK == adc26_start_conversion ( &adc26, ADC26_MUX_P_AIN0_N_AIN1, ADC26_PGA_2_048V ) )
{
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 );
}
}
if ( ADC26_OK == adc26_start_conversion ( &adc26, ADC26_MUX_P_AIN2_N_GND, ADC26_PGA_4_096V ) )
{
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 );
}
}
if ( ADC26_OK == adc26_start_conversion ( &adc26, ADC26_MUX_P_AIN3_N_GND, ADC26_PGA_4_096V ) )
{
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 );
}
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:
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.