dac3 2.0.0.0
|
DAC3 click carries Microchip’s MCP4726 IC, a 12-bit digital-to-analog converter, along with voltage output screw terminals. The digital value is converted to the appropriate voltage level in the range between GND and REFERENCE (VCC or 4.096V), which is proportional to the received 12-bit number.
We provide a library for the DAC3 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.
This library contains API for DAC3 Click driver.
- Initialization function.void dac3_cfg_setup ( dac3_cfg_t *cfg );
DAC3_RETVAL dac3_init ( dac3_t *ctx, dac3_cfg_t *cfg );
void dac3_default_cfg ( dac3_t *ctx );
- This function sends a command to the click module using SPI communication.void dac3_write_all_mem ( dac3_t *ctx, uint16_t value );
void dac3_send_command ( dac3_t *ctx, uint8_t cmd );
void dac3_set_out_voltage ( dac3_t *ctx, uint16_t output );
This example showcases how to initialize, configure and use the DAC 3 click module. The click performs digital to analog conversion and the output voltage can be read on the output termi- nal using a multimeter. An oscilloscope is required to read the analog signal.
The demo application is composed of two sections :
This function configures and initializes the click and logger modules. The write_all_mem(...) function configures DAC settings.
This function resets and wakes up the click module and then changes the output voltage on the output terminal a few times in a loop with a 5 second delay. It does so every 1 second.
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:
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.