TOP Contributors

  1. MIKROE (2650 codes)
  2. Alcides Ramos (350 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 (136534 times)
  2. FAT32 Library (69727 times)
  3. Network Ethernet Library (55837 times)
  4. USB Device Library (46170 times)
  5. Network WiFi Library (41798 times)
  6. FT800 Library (40984 times)
  7. GSM click (28921 times)
  8. PID Library (26383 times)
  9. mikroSDK (26276 times)
  10. microSD click (25297 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

ADAC 3 click

Rating:

0

Author: MIKROE

Last Updated: 2024-04-03

Package Version: 2.1.0.5

mikroSDK Library: 2.0.0.0

Category: ADC-DAC

Downloaded: 57 times

Not followed.

License: MIT license  

ADAC 3 Click is a compact add-on board representing the ADC/DAC combo solution. This board features the PCF8591, a low-power 8-bit CMOS data acquisition device with four analog inputs, one analog output, and a serial I2C interface from NXP Semiconductors. The PCF8591 includes analog input multiplexing, an on-chip track and hold function and 8-bit analog-to-digital conversion alongside an 8-bit digital-to-analog conversion. In addition, the user is given the option to select the PCF8591 reference voltage value, choosing between 2,048 and 4,096V.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "ADAC 3 click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "ADAC 3 click" changes.

Do you want to report abuse regarding "ADAC 3 click".

  • Information
  • Comments (0)

mikroSDK Library Blog


ADAC 3 click

ADAC 3 Click is a compact add-on board representing the ADC/DAC combo solution. This board features the PCF8591, a low-power 8-bit CMOS data acquisition device with four analog inputs, one analog output, and a serial I2C interface from NXP Semiconductors. The PCF8591 includes analog input multiplexing, an on-chip track and hold function and 8-bit analog-to-digital conversion alongside an 8-bit digital-to-analog conversion. In addition, the user is given the option to select the PCF8591 reference voltage value, choosing between 2,048 and 4,096V.

adac3_click.png

click Product page


Click library

  • Author : Stefan Filipovic
  • Date : May 2022.
  • Type : I2C type

Software Support

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

Standard key functions :

  • adac3_cfg_setup Config Object Initialization function.

    void adac3_cfg_setup ( adac3_cfg_t *cfg );
  • adac3_init Initialization function.

    err_t adac3_init ( adac3_t *ctx, adac3_cfg_t *cfg );
  • adac3_default_cfg Click Default Configuration function.

    err_t adac3_default_cfg ( adac3_t *ctx );

Example key functions :

  • adac3_write_control This function writes a control byte by using I2C serial interface.

    err_t adac3_write_control ( adac3_t *ctx, uint8_t control );
  • adac3_write_dac This function writes a DAC byte by using I2C serial interface.

    err_t adac3_write_dac ( adac3_t *ctx, uint8_t dac );
  • adac3_read_adc This function reads the AD conversion byte by using I2C serial interface.

    err_t adac3_read_adc ( adac3_t *ctx, uint8_t *adc );

Example Description

This example demonstrates the use of ADAC 3 click board by setting the DAC output and reading the ADC results from 2 single-ended channels (AIN0, AIN1) and from a differential channel (AIN2+, AIN3-).

The demo application is composed of two sections :

Application Init

Initializes the driver and performs the click default configuration which enables DAC output, sets the analog input mode to single-ended (AIN0, AIN1) and differential (AIN2+, AIN3-), and enables the auto increment mode.


void application_init ( void )
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    adac3_cfg_t adac3_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.
    adac3_cfg_setup( &adac3_cfg );
    ADAC3_MAP_MIKROBUS( adac3_cfg, MIKROBUS_1 );
    if ( I2C_MASTER_ERROR == adac3_init( &adac3, &adac3_cfg ) ) 
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }

    if ( ADAC3_ERROR == adac3_default_cfg ( &adac3 ) )
    {
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    }

    log_info( &logger, " Application Task " );
}

Application Task

Sets the DAC output increasing the value by 1 after each iteration, and reads the ADC results from 2 single-ended and 1 differential channels, and displays the results on the USB UART every 100ms approximately.

void application_task ( void )
{
    static uint8_t dac = 0;
    uint8_t ain0, ain1, ain2_ain3_diff;
    if ( ADAC3_OK == adac3_write_dac ( &adac3, dac ) )
    {
        log_printf ( &logger, " DAC : %u mV\r\n", 
                     ( uint16_t ) ( ( ADAC3_VREF_2048mV / ADAC3_RESOLUTION ) * dac++ ) );
    }
    if ( ADAC3_OK == adac3_read_adc ( &adac3, &ain0 ) )
    {
        log_printf ( &logger, " AIN0+: %u mV\r\n", 
                     ( uint16_t ) ( ( ADAC3_VREF_2048mV / ADAC3_RESOLUTION ) * ain0 ) );
    }
    if ( ADAC3_OK == adac3_read_adc ( &adac3, &ain1 ) )
    {
        log_printf ( &logger, " AIN1+: %u mV\r\n",
                     ( uint16_t ) ( ( ADAC3_VREF_2048mV / ADAC3_RESOLUTION ) * ain1 ) );
    }
    if ( ADAC3_OK == adac3_read_adc ( &adac3, &ain2_ain3_diff ) )
    {
        log_printf ( &logger, " AIN2+ - AIN3-: %d mV\r\n\n",
                     ( int16_t ) ( ( ADAC3_VREF_2048mV / ADAC3_RESOLUTION ) * ( int8_t ) ain2_ain3_diff ) );
    }
    Delay_ms ( 100 );
}

Note

Inputs should be connected to GND when not in use.

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

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

Thermo 7 click

0

Thermo 7 click is a Click board™ equipped with the sensor IC, which can digitize temperature measurements between -55°C and +125°C so that the temperature measurement data can be processed by the host MCU.

[Learn More]

Ambient 4 click

5

Ambient 4 click is a light, intensity-sensing and measuring Click boardâ„¢, which features an accurate, light-intensity sensor labeled as BH1721FVC, made by ROHM corporation.

[Learn More]

ADC 20 click

0

ADC 20 Click is a compact add-on board with a high-performance data converter. This board features the TLA2518, an SPI-configurable eight-channel 12-bit successive approximation register analog-to-digital converter (SAR ADC) from Texas Instruments. The TLA2518 has an internal oscillator for the ADC conversion and supports averaging multiple data samples with a single conversion start. Also, the built-in programmable averaging filters help reduce noise from the analog inputs and reduce the number of data samples required to be read by the host MCU. All eight channels can be used as analog inputs, with the addition that the four channels can be used as digital inputs or digital outputs.

[Learn More]