daq 2.0.0.0
Main Page

DAQ click

‍DAQ Click is a compact add-on board representing a data acquisition solution. This board features the ADAQ7768-1, a 24-bit precision data acquisition (DAQ) μModule system that encapsulates signal conditioning, conversion, and processing blocks into one SiP from Analog Devices. It supports a fully differential input signal with a maximum voltage range of ±12V with an excellent common-mode rejection ratio (CMRR). The input signal is fully buffered with a low input bias current, enabling the ADAQ7768-1 to interface to sensors with high output impedance directly.

click Product page


Click library

  • Author : Luka Filipovic
  • Date : Jun 2021.
  • Type : SPI type

Software Support

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

Standard key functions :

  • daq_cfg_setup Config Object Initialization function.
    void daq_cfg_setup ( daq_cfg_t *cfg );
    void daq_cfg_setup(daq_cfg_t *cfg)
    DAQ configuration object setup function.
    DAQ Click configuration object.
    Definition daq.h:699
  • daq_init Initialization function.
    err_t daq_init ( daq_t *ctx, daq_cfg_t *cfg );
    err_t daq_init(daq_t *ctx, daq_cfg_t *cfg)
    DAQ initialization function.
    DAQ Click context object.
    Definition daq.h:676
  • daq_default_cfg Click Default Configuration function.
    err_t daq_default_cfg ( daq_t *ctx );
    err_t daq_default_cfg(daq_t *ctx)
    DAQ default configuration function.

Example key functions :

  • daq_set_gain Set gain range.
    err_t daq_set_gain ( daq_t *ctx, daq_gain gain );
    daq_gain
    DAQ GAIN configuration values.
    Definition daq.h:633
    err_t daq_set_gain(daq_t *ctx, daq_gain gain)
    Set gain range.
  • daq_read_data Reading adc data.
    err_t daq_read_data ( daq_t *ctx, int32_t *adc_data );
    err_t daq_read_data(daq_t *ctx, int32_t *adc_data)
    Reading adc data.
  • daq_calculate_voltage Convert data from raw ADC to voltage.
    void daq_calculate_voltage ( daq_t *ctx, int32_t adc_data, float *voltage );
    void daq_calculate_voltage(daq_t *ctx, int32_t adc_data, float *voltage)
    Convert data from raw ADC to voltage.

Example Description

‍This example showcases ability of the device to read ADC

data and calculate voltage for set configuration.

The demo application is composed of two sections :

Application Init

‍Initialization of communication modules (SPI, UART) and

additional pins for controling device. Resets device and then configures default configuration and sets read range by setting gain to +-12V. In the end reads vendor and device ID to confirm communication.

void application_init ( void )
{
log_cfg_t log_cfg;
daq_cfg_t daq_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
daq_cfg_setup( &daq_cfg );
DAQ_MAP_MIKROBUS( daq_cfg, MIKROBUS_1 );
err_t init_flag = daq_init( &daq, &daq_cfg );
if ( SPI_MASTER_ERROR == init_flag )
{
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
if ( daq_default_cfg ( &daq ) )
{
log_error( &logger, " Default configuration. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
uint8_t id = 0;
log_printf( &logger, " > Vendor: \t0x%.2X", ( uint16_t )id );
log_printf( &logger, "%.2X\r\n", ( uint16_t )id );
log_printf( &logger, " > ID: \t\t0x%.2X", ( uint16_t )id );
log_printf( &logger, "%.2X\r\n", ( uint16_t )id );
Delay_ms ( 1000 );
log_info( &logger, " Application Task " );
}
#define DAQ_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition daq.h:659
#define DAQ_REG_PRODUCT_ID_L
Definition daq.h:74
#define DAQ_REG_VENDOR_L
Definition daq.h:78
#define DAQ_REG_PRODUCT_ID_H
Definition daq.h:75
#define DAQ_REG_VENDOR_H
Definition daq.h:79
err_t daq_generic_read(daq_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
DAQ data reading function.
void application_init(void)
Definition main.c:32

Application Task

‍Reads ADC data and calculates voltage from it, every 0.3 seconds.

void application_task ( void )
{
int32_t adc_data = 0;
float voltage = 0.0;
daq_read_data( &daq, &adc_data );
daq_calculate_voltage( &daq, adc_data, &voltage );
log_printf( &logger, " > Data: %ld\r\n", adc_data );
log_printf( &logger, " > Voltage: %.2f\r\n", voltage );
log_printf( &logger, "***********************************\r\n" );
Delay_ms ( 300 );
}
void application_task(void)
Definition main.c:84

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

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. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.