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: 2019-12-27
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: DAC
Downloaded: 3503 times
Not followed.
License: MIT license
DAC 7 Click carries Texas Instruments AD5624R, a low-power four-channel, 12-bit buffered Digital-to-Analog Converter. AD5624R converts digital value to the corresponding voltage level using external voltage reference.
Do you want to subscribe in order to receive notifications regarding "DAC 7 click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "DAC 7 click" changes.
Do you want to report abuse regarding "DAC 7 click".
Library Description
The library covers all the necessary functions to control DAC 7 click board. Library performs a standard SPI interface communication.
Key functions:
DAC7_RETVAL_T dac7_set_ch_voltage ( uint8_t addr_ch, uint16_t vol_val, uint16_t v_ref_mv )
- Set the voltage values of the specified channel function.DAC7_RETVAL_T dac7_set_power ( uint8_t pwr_en, uint8_t sel_ch )
- Set power mode function.DAC7_RETVAL_T dac7_sw_reset ( void )
- Software reset function.Examples description
The application is composed of three sections :
void application_task ( )
{
if ( dac7_set_ch_voltage ( DAC7_CHANNEL_A, 1000, v_ref_sel ) == DAC7_SUCCESS )
{
mikrobus_logWrite( " Channel A : 1000 mV ", _LOG_LINE );
}
else
{
mikrobus_logWrite( " ERROR ", _LOG_LINE );
for ( ; ; );
}
Delay_ms( 5000 );
mikrobus_logWrite( "-----------------------", _LOG_LINE );
if ( dac7_set_ch_voltage ( DAC7_CHANNEL_B, 2000, v_ref_sel ) == DAC7_SUCCESS )
{
mikrobus_logWrite( " Channel B : 2000 mV ", _LOG_LINE );
}
else
{
mikrobus_logWrite( " ERROR ", _LOG_LINE );
for ( ; ; );
}
Delay_ms( 5000 );
mikrobus_logWrite( "-----------------------", _LOG_LINE );
if ( dac7_set_ch_voltage ( DAC7_CHANNEL_C, 3000, v_ref_sel ) == DAC7_SUCCESS )
{
mikrobus_logWrite( " Channel C : 3000 mV ", _LOG_LINE );
}
else
{
mikrobus_logWrite( " ERROR ", _LOG_LINE );
for ( ; ; );
}
Delay_ms( 5000 );
mikrobus_logWrite( "-----------------------", _LOG_LINE );
if ( dac7_set_ch_voltage ( DAC7_CHANNEL_D, 4000, v_ref_sel ) == DAC7_SUCCESS )
{
mikrobus_logWrite( " Channel D : 4000 mV ", _LOG_LINE );
}
else
{
mikrobus_logWrite( " ERROR ", _LOG_LINE );
for ( ; ; );
}
Delay_ms( 5000 );
mikrobus_logWrite( "-----------------------", _LOG_LINE );
if ( dac7_set_ch_voltage ( DAC7_CHANNEL_ALL, 5000, v_ref_sel ) == DAC7_SUCCESS )
{
mikrobus_logWrite( " All Channels: 5000 mV ", _LOG_LINE );
}
else
{
mikrobus_logWrite( " ERROR ", _LOG_LINE );
for ( ; ; );
}
Delay_ms( 5000 );
mikrobus_logWrite( "-----------------------", _LOG_LINE );
}
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.