TOP Contributors

  1. MIKROE (2663 codes)
  2. Alcides Ramos (358 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 (137080 times)
  2. FAT32 Library (70222 times)
  3. Network Ethernet Library (56094 times)
  4. USB Device Library (46409 times)
  5. Network WiFi Library (42029 times)
  6. FT800 Library (41373 times)
  7. GSM click (29109 times)
  8. mikroSDK (26554 times)
  9. PID Library (26487 times)
  10. microSD click (25483 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: 99 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

6DOF IMU 13 click

0

6DOF IMU 13 Click is a compact add-on board that contains an eCompass that consists of a 3-axis linear accelerometer and a 3-axis magnetic field sensor. This board features the MC6470, an accelerometer and magnetometer for a 6 DoF (6 Degrees of Freedom) sensor solution, from mCube Inc.

[Learn More]

Force 2 click

5

Force 2 Click is a mikroBUS add-on board with circuitry for implementing Honeywell’s FSS-SMT Series force sensors into your projects (with a single zone force sensing resistor included with the click).

[Learn More]

Silent Step click

0

Silent Step Click is the complete integrated bipolar step motor driver solution, rich with many features that allow extremely smooth and silent operation of the connected motor while being able to provide up to 2.5A peak motor current and withstand up to 46V supply voltage. The specialized TMC5130 IC driver from Trinamic Company far exceeds the capabilities of similar step motor drivers that are commonly used.

[Learn More]