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]
Rating:
Author: MIKROE
Last Updated: 2020-08-28
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: DAC
Downloaded: 2202 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. This board features the DAC8554IPWR, a 16-bit QUAD channel voltage-output digital to analog converter from Texas Instruments.
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".
Library Description
The library covers all the necessary functions to control the DAC 8 Click board. A library performs the communication with the DAC60501 via I2C and communication with DAC8554 the SPI interface.
Key functions:
void dac8_generic_i2c_write ( uint8_t reg, uint16_t tx_data )
- Generic I2C ( DAC60501 ) write function.uint16_t dac8_generic_i2c_read ( uint8_t reg )
- Generic I2C ( DAC60501 ) read function.void dac8_generic_spi_write ( uint32_t tx_data )
- Generic SPI ( DAC8554 ) write function.Examples description
The application is composed of three sections :
void application_task ( )
{
mikrobus_logWrite( "---------------------", _LOG_LINE );
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;
mikrobus_logWrite( " Channel A ~ 2500 mV ", _LOG_LINE );
dac8_device_config( cfg_dac );
dac8_load_dac( );
Delay_ms( 5000 );
mikrobus_logWrite( "---------------------", _LOG_LINE );
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;
mikrobus_logWrite( " Channel B ~ 1250 mV ", _LOG_LINE );
dac8_device_config( cfg_dac );
dac8_load_dac( );
Delay_ms( 5000 );
mikrobus_logWrite( "---------------------", _LOG_LINE );
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;
mikrobus_logWrite( " Channel C ~ 625 mV ", _LOG_LINE );
dac8_device_config( cfg_dac );
dac8_load_dac( );
Delay_ms( 5000 );
mikrobus_logWrite( "---------------------", _LOG_LINE );
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;
mikrobus_logWrite( " Channel D ~ 312 mV", _LOG_LINE );
dac8_device_config( cfg_dac );
dac8_load_dac( );
Delay_ms( 5000 );
}
Other mikroE Libraries used in the example:
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.