TOP Contributors

  1. MIKROE (2655 codes)
  2. Alcides Ramos (353 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 (136772 times)
  2. FAT32 Library (69977 times)
  3. Network Ethernet Library (55947 times)
  4. USB Device Library (46270 times)
  5. Network WiFi Library (41888 times)
  6. FT800 Library (41183 times)
  7. GSM click (28987 times)
  8. PID Library (26418 times)
  9. mikroSDK (26372 times)
  10. microSD click (25381 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 12 click

Rating:

0

Author: MIKROE

Last Updated: 2024-04-03

Package Version: 2.1.0.11

mikroSDK Library: 2.0.0.0

Category: ADC

Downloaded: 96 times

Not followed.

License: MIT license  

ADC 12 Click is a compact add-on board that contains a fully-featured, general-purpose analog-to-digital converter. This board features the ADS7828, a low-power 12-bit data acquisition device that features a serial I2C interface and an 8-channel multiplexer from Texas Instruments.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "ADC 12 click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "ADC 12 click" changes.

Do you want to report abuse regarding "ADC 12 click".

  • mikroSDK Library 1.0.0.0
  • Comments (0)

mikroSDK Library Blog


ADC 12 click

ADC 12 Click is a compact add-on board that contains a fully-featured, general-purpose analog-to-digital converter. This board features the ADS7828, a low-power 12-bit data acquisition device that features a serial I2C interface and an 8-channel multiplexer from Texas Instruments.

adc12_click.png

click Product page


Click library

  • Author : Stefan Filipovic
  • Date : Jun 2021.
  • Type : I2C type

Software Support

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

Standard key functions :

  • adc12_cfg_setup Config Object Initialization function.

    void adc12_cfg_setup ( adc12_cfg_t *cfg );
  • adc12_init Initialization function.

    ADC12_RETVAL adc12_init ( adc12_t *ctx, adc12_cfg_t *cfg );

Example key functions :

  • adc12_read_voltage This function reads the voltage in milivolts from the desired channel.

    err_t adc12_read_voltage ( adc12_t *ctx, uint8_t ch, uint16_t vref, float *data_out );
  • adc12_read_raw_data This function reads raw 12-bit ADC data from the desired channel.

    err_t adc12_read_raw_data ( adc12_t *ctx, uint8_t ch, uint16_t *data_out );
  • adc12_set_sd_mode This function sets the input mode.

    void adc12_set_sd_mode ( adc12_t *ctx, uint8_t sd_mode );

Example Description

This example demonstrates the use of ADC 12 click board.

The demo application is composed of two sections :

Application Init

Initializes the driver and sets the input and power-down modes.


void application_init ( void )
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    adc12_cfg_t adc12_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.

    adc12_cfg_setup( &adc12_cfg );
    ADC12_MAP_MIKROBUS( adc12_cfg, MIKROBUS_1 );
    err_t init_flag = adc12_init( &adc12, &adc12_cfg );
    if ( init_flag == I2C_MASTER_ERROR ) 
    {
        log_error( &logger, " Application Init Error. " );
        log_info( &logger, " Please, run program again... " );

        for ( ; ; );
    }

    adc12_set_sd_mode ( &adc12, ADC12_CMD_SD_SINGLE_END );
    adc12_set_pd_mode( &adc12, ADC12_CMD_PD_IRON_ADON );
    log_info( &logger, " Application Task " );
}

Application Task

Reads the RAW ADC data and converts it to voltage in milivolts and displays both values on the USB UART every second.


void application_task ( void )
{
    uint16_t raw_adc;
    float voltage;

    adc12_read_raw_data ( &adc12, ADC12_SINGLE_END_CH0, &raw_adc );
    adc12_read_voltage ( &adc12, ADC12_SINGLE_END_CH0, ADC12_INTERNAL_VREF, &voltage );

    log_printf( &logger, " RAW ADC: %u \r\n", raw_adc );
    log_printf( &logger, " Voltage from Channel 0: %.2f mV \r\n", voltage );
    log_printf( &logger, " ---------------------------\r\n" );
    Delay_ms ( 1000 );
}

Note

With internal reference voltage set the click measures up to 2500 mV.

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

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

VCP Monitor 2 click

0

VCP Monitor 2 Click is a three-channel, high-side current and bus voltage monitor with alert indication function ensuring the intended application works within desired operating conditions. Featured chip INA3221-Q1, by Texas Instruments, monitors both shunt voltage drops and bus supply voltages, in addition to having programmable conversion times and averaging modes for these signals.

[Learn More]

Stepper 4 click

0

Stepper 4 click carries a TB67S269FTG - a two-phase bipolar stepping motor driver using a PWM chopper, with a clock in decoder built in. Rating is 50 V/2.0 A. Microstepping resolution is externally manipulated, as well as output current scaling.

[Learn More]

LTE IoT click

0

LTE IoT click is a Click board™ that allows connection to the LTE and 2G networks

[Learn More]