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 (137071 times)
  2. FAT32 Library (70218 times)
  3. Network Ethernet Library (56094 times)
  4. USB Device Library (46395 times)
  5. Network WiFi Library (42013 times)
  6. FT800 Library (41351 times)
  7. GSM click (29109 times)
  8. mikroSDK (26545 times)
  9. PID Library (26486 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

DAC 14 click

Rating:

0

Author: MIKROE

Last Updated: 2024-04-03

Package Version: 2.1.0.5

mikroSDK Library: 2.0.0.0

Category: DAC

Downloaded: 42 times

Not followed.

License: MIT license  

DAC 14 Click is a compact add-on board providing highly accurate digital-to-analog conversion. This board features the DAC53202, a 10-bit dual-channel programmable voltage/current-output DAC from Texas Instruments. The DAC53202 supports high-speed I2C and SPI serial interface alongside Hi-Z Power-Down mode and Hi-Z output during Power-OFF conditions. It has a programmable comparator mode for both DAC channels and one general-purpose I/O pin configurable as multiple functions allowing this smart DAC for processor-less applications.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "DAC 14 click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "DAC 14 click" changes.

Do you want to report abuse regarding "DAC 14 click".

  • Information
  • Comments (0)

mikroSDK Library Blog


DAC 14 click

DAC 14 Click is a compact add-on board providing highly accurate digital-to-analog conversion. This board features the DAC53202, a 10-bit dual-channel programmable voltage/current-output DAC from Texas Instruments. The DAC53202 supports high-speed I2C and SPI serial interface alongside Hi-Z Power-Down mode and Hi-Z output during Power-OFF conditions. It has a programmable comparator mode for both DAC channels and one general-purpose I/O pin configurable as multiple functions allowing this smart DAC for processor-less applications.

dac14_click.png

click Product page


Click library

  • Author : Stefan Filipovic
  • Date : Dec 2022.
  • Type : I2C/SPI type

Software Support

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

Standard key functions :

  • dac14_cfg_setup Config Object Initialization function.

    void dac14_cfg_setup ( dac14_cfg_t *cfg );
  • dac14_init Initialization function.

    err_t dac14_init ( dac14_t *ctx, dac14_cfg_t *cfg );
  • dac14_default_cfg Click Default Configuration function.

    err_t dac14_default_cfg ( dac14_t *ctx );

Example key functions :

  • dac14_set_dac_data This function sets the raw DAC data for the selected DAC channel.

    err_t dac14_set_dac_data ( dac14_t *ctx, uint8_t dac, uint16_t dac_data );
  • dac14_start_function_gen This function starts the function generator for the selected DAC channel.

    err_t dac14_start_function_gen ( dac14_t *ctx, uint8_t dac );
  • dac14_config_function_gen This function configures the function generator for the selected DAC channel.

    err_t dac14_config_function_gen ( dac14_t *ctx, uint8_t dac, uint8_t waveform, uint8_t code_step, uint8_t slew_rate );

Example Description

This example demonstrates the use of DAC 14 click board by changing the voltage level on the OUT0 as well as the waveform signals from a function generator on the OUT1.

The demo application is composed of two sections :

Application Init

Initializes the driver and performs the click default configuration.


void application_init ( void )
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    dac14_cfg_t dac14_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.
    dac14_cfg_setup( &dac14_cfg );
    DAC14_MAP_MIKROBUS( dac14_cfg, MIKROBUS_1 );
    err_t init_flag = dac14_init( &dac14, &dac14_cfg );
    if ( ( I2C_MASTER_ERROR == init_flag ) || ( SPI_MASTER_ERROR == init_flag ) )
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }

    if ( DAC14_ERROR == dac14_default_cfg ( &dac14 ) )
    {
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    }

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

Application Task

Changes the voltage level on the OUT0 as well as the waveform signals from a function generator on the OUT1 every 3 seconds. The state of both outputs will be displayed on the USB UART.

void application_task ( void )
{
    static uint16_t dac = 0;
    static uint8_t waveform = DAC14_WAVEFORM_TRIANGULAR;
    if ( DAC14_OK == dac14_set_dac_data ( &dac14, DAC14_SEL_DAC_0, dac ) )
    {
        log_printf( &logger, "\r\n OUT0: %u -> %.2f V\r\n", 
                    dac, ( float ) dac * DAC14_VDD_3V3 / DAC14_DAC_DATA_MAX );
        dac += 100;
        if ( dac > DAC14_DAC_DATA_MAX )
        {
            dac = DAC14_DAC_DATA_MIN;
        }
    }
    err_t error_flag = dac14_stop_function_gen ( &dac14, DAC14_SEL_DAC_1 );
    error_flag |= dac14_config_function_gen ( &dac14, DAC14_SEL_DAC_1, waveform,
                                              DAC14_CODE_STEP_32_LSB, DAC14_SLEW_RATE_4_US );
    error_flag |= dac14_start_function_gen ( &dac14, DAC14_SEL_DAC_1 );
    if ( DAC14_OK == error_flag )
    {
        log_printf( &logger, " OUT1: " );
        switch ( waveform )
        {
            case DAC14_WAVEFORM_TRIANGULAR:
            {
                log_printf( &logger, "triangular wave at about 4kHz\r\n" );
                waveform = DAC14_WAVEFORM_SAWTOOTH;
                break;
            }
            case DAC14_WAVEFORM_SAWTOOTH:
            {
                log_printf( &logger, "sawtooth wave at about 7.8kHz\r\n" );
                waveform = DAC14_WAVEFORM_INV_SAWTOOTH;
                break;
            }
            case DAC14_WAVEFORM_INV_SAWTOOTH:
            {
                log_printf( &logger, "inverse sawtooth wave at about 7.8kHz\r\n" );
                waveform = DAC14_WAVEFORM_SINE;
                break;
            }
            case DAC14_WAVEFORM_SINE:
            {
                log_printf( &logger, "sine wave at about 10.7kHz\r\n" );
                waveform = DAC14_WAVEFORM_DISABLE;
                break;
            }
            case DAC14_WAVEFORM_DISABLE:
            {
                log_printf( &logger, "function generator disabled\r\n" );
                waveform = DAC14_WAVEFORM_TRIANGULAR;
                break;
            }
            default:
            {
                log_printf( &logger, "unknown state\r\n" );
                break;
            }
        }
    }
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
}

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

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

Magneto 7 click

5

Magneto 7 Click is a high-resolution magnetic sensor Click board which allows contactless orientation sensing.

[Learn More]

M-BUS RF 4 click

0

M-BUS RF 4 Click is a mikroBUS™ add-on board with a MIPOT 32001324 RF wireless transceiver. This module operates in the 868 MHz SRD Band. Thanks to its small LCC form factor (15 x 25 mm only) and its low power consumption this module allows the implementation of highly integrated low power (battery operated) solutions for water, gas, heat or electricity metering applications, both on meter or concentrator devices.

[Learn More]

FT click

0

FT Click is a compact smart transceiver add-on board that helps you add a Free Topology (FT) interface to any host board with the mikroBUS™ socket. Leveraging FT, the most reliable and easiest-to-scale wired communications media, FT Click lets you network sensors and devices to create IoT solutions for automation and control networks that are easier to develop, integrate and install. This Click board™ supports full communication stacks for LON® and BACnet FT, as well as FTMQ (MQTT like messaging format) on board to simplify integration of BACnet, LON or custom IoT networks over twisted pair wire. FT Click is ideal for markets including smart buildings, cities, machines, agriculture, manufacturing, transportation and many more where wireless communications do not provide the required reliability and scale.

[Learn More]