Highly accurate digital-to-analog conversion
A
A
Hardware Overview
How does it work?
DAC 13 Click is based on the AD3541R, a single channel, 16-bit, 16-MUPS voltage output DAC from Analog Devices, with programmable output ranges. It uses a current-steering DAC architecture with a reference voltage of 2.5V (internal but also with the possibility of an external reference voltage supplied on the VREF header), where DAC current is converted to a voltage through an internal transimpedance amplifier (TIA). The AD3541R also features multiple error-checkers in analog and digital domains to guarantee safe operation in various applications such as data acquisition systems, process control equipment, and many more.The AD3541R has five pre-configured output voltage ranges: 0V to 2.5V; 0V to 5V; 0V to 10V; -5V to +5V; and -2.5V to +7.5V. The selection of the output range requires a combination of register configurations and a given transimpedance gain (x1 or x2 Output Gain jumper position). These drift-compensating feedback resistors, or transimpedance gain, for the internal TIA, scale the output voltage.
The supply for the TIA, integrated into AD3542R, must be adjusted depending on the selected output span. In addition to the internal TIA supply, the user is provided with the possibility of an external trans-impedance amplifier supply on the connector marked with VEXT. Selection can be performed by an onboard SMD jumper labeled as Output Amp Voltage by placing it in an appropriate position marked as INT or EXT. This Click board™ communicates with MCU through a versatile SPI interface capable of operating in classic and dual SPI modes with a single or double data rate. The AD3541R has two update modes offering maximum speed and maximum accuracy, synchronously or asynchronously. A synchronous update occurs when the change of the DAC output is triggered by an external LDC signal routed to the AN pin of the mikroBUS™ socket, which with its low state, causes the DAC register to update if the input register has new data, Otherwise, the DAC automatically updates when new data is written to the input register
(LDC high). An asynchronous update occurs when the change of the DAC output follows an operation on the register set. The AD3541R also possesses an additional interrupt alert signal, routed on the INT pin of the mikroBUS™ socket labeled as ALT, indicating abnormal conditions both in the analog and digital domains, and general reset function routed on the RST pin of the mikroBUS™ socket. The ALT pin is also set after reset and in case of initialization failure. This Click board™ can operate with both 3.3V and 5V logic voltage levels selected via the VCC SEL jumper. A logic voltage level conversion is performed by an appropriate voltage level translator, while an onboard LDO, the AP2112, ensures recommended supply voltage level to power the AD3541R. However, the Click board™ comes equipped with a library containing easy-to-use functions and an example code that can be used, as a reference, for further development.
Features overview
Development board
PIC32MZ Clicker is a compact starter development board that brings the flexibility of add-on Click boards™ to your favorite microcontroller, making it a perfect starter kit for implementing your ideas. It comes with an onboard 32-bit PIC32MZ microcontroller with FPU from Microchip, a USB connector, LED indicators, buttons, a mikroProg connector, and a header for interfacing with external electronics. Thanks to its compact design with clear and easy-recognizable silkscreen markings, it provides a fluid and immersive working experience, allowing access anywhere and under
any circumstances. Each part of the PIC32MZ Clicker development kit contains the components necessary for the most efficient operation of the same board. In addition to the possibility of choosing the PIC32MZ Clicker programming method, using USB HID mikroBootloader, or through an external mikroProg connector for PIC, dsPIC, or PIC32 programmer, the Clicker board also includes a clean and regulated power supply module for the development kit. The USB Micro-B connection can provide up to 500mA of current, which is more than enough to operate all onboard
and additional modules. All communication methods that mikroBUS™ itself supports are on this board, including the well-established mikroBUS™ socket, reset button, and several buttons and LED indicators. PIC32MZ Clicker is an integral part of the Mikroe ecosystem, allowing you to create a new application in minutes. Natively supported by Mikroe software tools, it covers many aspects of prototyping thanks to a considerable number of different Click boards™ (over a thousand boards), the number of which is growing every day.
Microcontroller Overview
MCU Card / MCU
Architecture
PIC32
MCU Memory (KB)
1024
Silicon Vendor
Microchip
Pin count
64
RAM (Bytes)
524288
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Click board™ Schematic
Step by step
Project assembly
Track your results in real time
Application Output
This Click board can be interfaced and monitored in two ways:
Application Output
- Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
UART Terminal
- Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.
Software Support
Library Description
This library contains API for DAC 13 Click driver.
Key functions:
dac13_set_output_range
This function sets the output voltage range and the @b ctx->v_zero_scale and @b ctx->v_full_scale variables for the selected range.dac13_set_dac_value
This function sets the raw DAC value.dac13_set_output_voltage
This function sets the DAC output voltage.
Open Source
Code example
The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.
/*!
* @file main.c
* @brief DAC 13 Click example
*
* # Description
* This example demonstrates the use of DAC 13 click board by changing
* the outputs voltage level every 2 seconds.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes the driver and performs the click default configuration.
*
* ## Application Task
* Changes the output voltage every 2 seconds and logs the voltage value on the USB UART.
* It will go through the entire voltage range taking into account the number of steps
* which is defined below.
*
* @author Stefan Filipovic
*
*/
#include "board.h"
#include "log.h"
#include "dac13.h"
#define NUMBER_OF_STEPS 20 // A number of steps by which the entire voltage range will be divided, must be >= 1.
static dac13_t dac13;
static log_t logger;
void application_init ( void )
{
log_cfg_t log_cfg; /**< Logger config object. */
dac13_cfg_t dac13_cfg; /**< Click config object. */
/**
* 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.
dac13_cfg_setup( &dac13_cfg );
DAC13_MAP_MIKROBUS( dac13_cfg, MIKROBUS_1 );
if ( SPI_MASTER_ERROR == dac13_init( &dac13, &dac13_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( DAC13_ERROR == dac13_default_cfg ( &dac13 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
void application_task ( void )
{
float step = ( dac13.v_full_scale - dac13.v_zero_scale ) / ( NUMBER_OF_STEPS - 1 );
float out_voltage = dac13.v_zero_scale;
for ( uint8_t cnt = 0; cnt < NUMBER_OF_STEPS; cnt++ )
{
if ( DAC13_OK == dac13_set_output_voltage ( &dac13, out_voltage ) )
{
log_printf ( &logger, " Output voltage : %.2f V\r\n\n", out_voltage );
out_voltage += step;
Delay_ms ( 2000 );
}
}
}
void main ( void )
{
application_init( );
for ( ; ; )
{
application_task( );
}
}
// ------------------------------------------------------------------------ END