TOP Contributors

  1. MIKROE (2762 codes)
  2. Alcides Ramos (374 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 codes)
  5. Bugz Bensce (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 (139248 times)
  2. FAT32 Library (71743 times)
  3. Network Ethernet Library (57115 times)
  4. USB Device Library (47428 times)
  5. Network WiFi Library (43082 times)
  6. FT800 Library (42403 times)
  7. GSM click (29835 times)
  8. mikroSDK (28073 times)
  9. PID Library (26885 times)
  10. microSD click (26198 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-10-31

Package Version: 2.1.0.7

mikroSDK Library: 2.0.0.0

Category: ADC-DAC

Downloaded: 104 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

Color 17 Click

0

Color 17 Click is a compact add-on board representing an accurate color-sensing solution. This board features the OPT4048, a high-speed precision tristimulus XYZ color sensor from Texas Instruments. The sensor has four sensing channels and uses precision optical filters to mimic the normal vision of the human eye. The OPT4048 also has 12 configurable conversion times that range from 600μs up to 800ms, with measurements that can be read synchronously or asynchronously. It is not excessively sensitive to micro-shadows and the small particles on the optical surface.

[Learn More]

6DOF IMU 14 click

5

6DOF IMU 14 Click is a compact add-on board that contains a 6-axis MEMS motion tracking device combining a 3-axis gyroscope and a 3-axis accelerometer. This board features the ICM-42688-P, high precision 6-axis MEMS motion tracking device, from TDK InvenSense.

[Learn More]

Opto Encoder 2 Click

0

Opto Encoder 2 Click is a linear incremental optical sensor/encoder Click which can be used for the movement or rotation encoding.

[Learn More]