TOP Contributors

  1. MIKROE (2751 codes)
  2. Alcides Ramos (372 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 (139059 times)
  2. FAT32 Library (71589 times)
  3. Network Ethernet Library (56988 times)
  4. USB Device Library (47330 times)
  5. Network WiFi Library (43006 times)
  6. FT800 Library (42297 times)
  7. GSM click (29774 times)
  8. mikroSDK (27874 times)
  9. PID Library (26858 times)
  10. microSD click (26129 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 8 Click

Rating:

0

Author: MIKROE

Last Updated: 2024-10-31

Package Version: 2.1.0.14

mikroSDK Library: 2.0.0.0

Category: DAC

Downloaded: 156 times

Not followed.

License: MIT license  

DAC 8 Click is a compact add-on board that contains a fully-featured, general-purpose voltage-output digital-to-analog converter.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "DAC 8 Click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "DAC 8 Click" changes.

Do you want to report abuse regarding "DAC 8 Click".

  • mikroSDK Library 1.0.0.0
  • Comments (0)

mikroSDK Library Blog


DAC 8 Click

DAC 8 Click is a compact add-on board that contains a fully-featured, general-purpose voltage-output digital-to-analog converter.

dac8_click.png

Click Product page


Click library

  • Author : MikroE Team
  • Date : jul 2020.
  • Type : I2C/SPI type

Software Support

We provide a library for the Dac8 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 form compilers IDE(recommended way), or downloaded from our LibStock, or found on mikroE github account.

Library Description

This library contains API for Dac8 Click driver.

Standard key functions :

  • Config Object Initialization function.

    void dac8_cfg_setup ( dac8_cfg_t *cfg );

  • Initialization function.

    DAC8_RETVAL dac8_init ( dac8_t ctx, dac8_cfg_t cfg );

Example key functions :

  • The function set configuration of the DAC8554, 16-bit, quad-channel, ultra-low glitch, voltage

  • output digital-to-analog converter on DAC 8 Click board.

    void dac8_device_config ( dac8_t *ctx, dac8_cfg_data_t cfg_data );

  • The function load DAC s are simultaneously updated with the contents of the corresponding data

  • buffers. Used as a positive edge triggered timing signal for asynchronous DAC updates. Data

  • buffers of all channels must be loaded with desired data before call Load DAC function.

    void dac8_load_dac ( dac8_t *ctx );

  • The function set Vref ( mV ) by write 12-bit to the DAC data register of the DAC60501, 16-Bit,

  • 14-Bit, and 12-Bit, 1-LSB INL, Voltage-Output DACs

  • With Precision Internal Reference on DAC 8 Click board.

    DAC8_RETVAL dac8_set_vref ( dac8_t *ctx, uint16_t vref_mv );

Examples Description

This Click carries 12-bit buffered Digital-to-Analog Converter. It converts digital value to the corresponding voltage level using external voltage reference.

The demo application is composed of two sections :

Application Init

Initialization driver enables - I2C. Configure DAC60501: executes call software reset, disable sync and internal reference and disable Power-down mode, the set reference voltage is internally divided by a factor of 2, amplifier for corresponding DAC has a gain of 2. Initialization driver enables - SPI, enable DAC8554, also write log.


void application_init ( void )
{
    log_cfg_t log_cfg;
    dac8_cfg_t cfg;

    /** 
     * 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.

    dac8_cfg_setup( &cfg );
    DAC8_MAP_MIKROBUS( cfg, MIKROBUS_1 );

    dac8_init( &dac8, &cfg, DAC8_MASTER_I2C );

    log_printf( &logger, "---------------------\r\n" );
    log_printf( &logger, "  I2C driver init.   \r\n" );
    Delay_ms ( 100 );

    log_printf( &logger, "---------------------\r\n" );
    log_printf( &logger, "      DAC60501       \r\n" );
    log_printf( &logger, "---------------------\r\n" );
    log_printf( &logger, "     Soft reset      \r\n" );
    dac8_soft_reset( &dac8 );
    Delay_ms ( 100 );

    log_printf( &logger, "---------------------\r\n" );
    log_printf( &logger, "  Disable sync. mode \r\n" );
    dac8_enable_sync( &dac8, DAC8_SYNC_DISABLE );
    Delay_ms ( 100 );

    log_printf( &logger, "---------------------\r\n" );
    log_printf( &logger, "    Set config.:     \r\n" );
    log_printf( &logger, " Enable:             \r\n" );
    log_printf( &logger, " Internal reference  \r\n" );
    log_printf( &logger, " Disable:            \r\n" );
    log_printf( &logger, " Power-down mode     \r\n" );
    dac8_set_config( &dac8, DAC8_CONFIG_REF_PWDWN_ENABLE, DAC8_CONFIG_DAC_PWDWN_DISABLE );
    Delay_ms ( 100 );

    log_printf( &logger, "---------------------\r\n" );
    log_printf( &logger, "  Vref divided by 2  \r\n" );
    log_printf( &logger, "  Set DAC gain of 2  \r\n" );
    dac8_set_gain( &dac8, DAC8_GAIN_REF_DIV_2, DAC8_GAIN_BUFF_GAIN_1 );
    Delay_ms ( 100 );

    log_printf( &logger, "---------------------\r\n" );
    log_printf( &logger, " Set Vref ~ 2500 mV  \r\n" );
    dac8_set_vref( &dac8, 2500 );
    Delay_ms ( 1000 );

    dac8_init( &dac8, &cfg, DAC8_MASTER_SPI );
    log_printf( &logger, "---------------------\r\n" );
    log_printf( &logger, "  SPI driver init.   \r\n" );
    Delay_ms ( 1000 );

    log_printf( &logger, "---------------------\r\n" );
    log_printf( &logger, "       DAC8554       \r\n" );
    log_printf( &logger, "---------------------\r\n" );
    log_printf( &logger, "    Enable DAC8554   \r\n" );
    dac8_device_enable( &dac8, DAC8_DAC8554_ENABLE );
    Delay_ms ( 100 );
}

Application Task

This is an example that demonstrates the use of the DAC 8 Click board. DAC 8 board changeing output values: Channel A ~ 2500 mV, Channel B ~ 1250 mV, Channel C ~ 625 mV, Channel D ~ 312 mV. All data logs write on USB uart changes every 5 sec.


void application_task ( void )
{
    log_printf( &logger, "---------------------\r\n" );

    cfg_dac.addr = DAC8_ADDR_DEFAULT;
    cfg_dac.ctrl_upd_an_out = DAC8_CTRL_UPD_AN_OUT_SINGLE_CH_STORE;
    cfg_dac.dac_sel = DAC8_DAC_SEL_CH_A;
    cfg_dac.pwr_mode = DAC8_PWR_MODE_POWER_UP;
    cfg_dac.dac_val = 0xFFFF;

    log_printf( &logger, " Channel A ~ 2500 mV \r\n" );
    dac8_device_config( &dac8, cfg_dac );
    dac8_load_dac(  &dac8 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );

    log_printf( &logger, "---------------------\r\n" );

    cfg_dac.addr = DAC8_ADDR_DEFAULT;
    cfg_dac.ctrl_upd_an_out = DAC8_CTRL_UPD_AN_OUT_SINGLE_CH_STORE;
    cfg_dac.dac_sel = DAC8_DAC_SEL_CH_B;
    cfg_dac.pwr_mode = DAC8_PWR_MODE_POWER_UP;
    cfg_dac.dac_val = 0x7FFF;

    log_printf( &logger, " Channel B ~ 1250 mV \r\n" );
    dac8_device_config(  &dac8, cfg_dac );
    dac8_load_dac( &dac8 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );

    log_printf( &logger, "---------------------\r\n" );

    cfg_dac.addr = DAC8_ADDR_DEFAULT;
    cfg_dac.ctrl_upd_an_out = DAC8_CTRL_UPD_AN_OUT_SINGLE_CH_STORE;
    cfg_dac.dac_sel = DAC8_DAC_SEL_CH_C;
    cfg_dac.pwr_mode = DAC8_PWR_MODE_POWER_UP;
    cfg_dac.dac_val = 0x3FFF;

    log_printf( &logger, " Channel C ~  625 mV \r\n" );
    dac8_device_config(  &dac8, cfg_dac );
    dac8_load_dac( &dac8 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );

    log_printf( &logger, "---------------------\r\n" );

    cfg_dac.addr = DAC8_ADDR_DEFAULT;
    cfg_dac.ctrl_upd_an_out = DAC8_CTRL_UPD_AN_OUT_SINGLE_CH_STORE;
    cfg_dac.dac_sel = DAC8_DAC_SEL_CH_D;
    cfg_dac.pwr_mode = DAC8_PWR_MODE_POWER_UP;
    cfg_dac.dac_val = 0x1FFF;

    log_printf( &logger, " Channel D ~  312 mV\r\n" );
    dac8_device_config(  &dac8, cfg_dac );
    dac8_load_dac(  &dac8 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
} 

The full application code, and ready to use projects can be installed directly form compilers IDE(recommneded) or found on LibStock page or mikroE GitHub accaunt.

Other mikroE Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.Dac8

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.


ALSO FROM THIS AUTHOR

Haptic 4 Click

0

Haptic 4 Click is a compact add-on board that enables precise haptic feedback in various electronic projects. This board features the DA7280, a haptic driver designed to drive linear resonant actuator (LRA) and eccentric rotating mass (ERM) actuators from Renesas. The DA7280 boasts a differential output drive and continuous motion sensing for calibration-free operation, coupled with wide-band support to leverage the capabilities of modern LRAs. It supports six independent haptic sequences activated directly via mikroBUS™ pins or externally through I2C or PWM signals, offering extensive flexibility for haptic configuration. Ideal for enhancing user experience in wearables, electronic peripherals, automotive interfaces, industrial controls, and AR/VR controllers, this Click board™ opens new possibilities for interactive and tactile-responsive technology.

[Learn More]

LR 2 Click

0

LR 2 Click is a compact add-on board that contains a low-power, long-range transceiver. This board features the RN2903, RF technology-based SRD transceiver, which operates at a frequency of 915MHz from Microchip Technology. This Click board™ features an embedded LoRaWAN Class A compliant stack, providing a long-range spread spectrum communication with high interference immunity. The RN2903 module is fully compliant with the United States (FCC) and Canada (IC) regulations combined with the advanced and straightforward command interface allowing easy integration into the final application.

[Learn More]

ccRF Click

1

ccRF Click is a low-power 2.4 GHz transceiver designed for the 2400- 2483.5 MHz ISM and SRD frequency bands. It features CC2500 Low-Power 2.4 GHz RF transceiver as well as PCB trace antenna. The CC2500 is integrated with a highly configurable baseband modem that supports various modulation formats and has data rate up to 500 kBaud.

[Learn More]