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-08-27
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: DAC
Downloaded: 3450 times
Not followed.
License: MIT license
DAC 5 Click carries Texas Instruments DAC53608 IC, a low-power, eight-channel, 10-bit buffered Digital-to-Analog Converter.
Do you want to subscribe in order to receive notifications regarding "DAC 5 click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "DAC 5 click" changes.
Do you want to report abuse regarding "DAC 5 click".
Library Description
The library initializes and defines the I2C bus and drivers that offer a choice for writing data in register and reads data from register. The library includes function for sending data to output, configuration device, sets LDAC states, reading device info(DEVICE ID), software reset, clear and generic read and write functions.
Key functions:
uint8_t dac5_sendData(uint8_t dataReg, uint16_t dataBuff)
- Function for sending data to outputvoid dac5_config(uint16_t configData)
- Configuration functionuint8_t dac5_setLdacPin(uint8_t status)
- Function for setting LDAC pin statusvoid dac5_clear()
- Function for clearing data from outputExamples description
The application is composed of three sections :
void applicationTask()
{
uint16_t sender[4] = {0x0118, 0x0FF0, 0x0AAC, 0x0DD4};
uint16_t expected[4] = {140, 2030, 1360, 1760};
uint8_t endCount = 4;
uint8_t i;
for (i = 0; i < endCount; i++)
{
if (dac5_sendData(_DAC5_REG_DAC_A_DATA, sender[i]) == _DAC5_ERROR)
{
mikrobus_logWrite( "-ERROR SENDING DATA", _LOG_LINE);
mikrobus_logWrite( " ", _LOG_LINE);
}
else
{
mikrobus_logWrite( "-SUCCESFUL SENDING DATA", _LOG_LINE);
mikrobus_logWrite( " ", _LOG_LINE);
mikrobus_logWrite( "Sending : ", _LOG_TEXT);
IntToStr(sender[i], demoText);
mikrobus_logWrite( demoText, _LOG_LINE);
mikrobus_logWrite( "Expected return around : ", _LOG_TEXT);
IntToStr(expected[i], demoText);
mikrobus_logWrite( demoText, _LOG_TEXT);
mikrobus_logWrite( " mV ", _LOG_LINE);
}
Delay_ms ( 5000 );
dac5_clear();
mikrobus_logWrite( "Clearing output... ", _LOG_LINE);
mikrobus_logWrite( " ", _LOG_LINE);
mikrobus_logWrite( " ", _LOG_LINE);
Delay_ms ( 2000 );
}
mikrobus_logWrite( "''''''''''''''''''''''''''''''", _LOG_LINE);
mikrobus_logWrite( " ", _LOG_LINE);
mikrobus_logWrite( " ", _LOG_LINE);
Delay_ms ( 1000 );
}
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.