Coming soon |
This article explains what is DAC and how to use it through examples
1. DAC definition
Provide digital data to analog output conversion
1.1. Objective
• Learn how to setup DAC as wave generator in CubeMX • Generate Code in CubeMX and use HAL functions
1.2. How
Follow step by step work instructions:
Menu > File > New Project
Open Board Selector On Initialize all peripherals with their default Mode? > Select No Select Nucleo-L476RG
2. DAC Overview
2.1. What is DAC
2.2. Simplified Diagram
The DAC output can be buffered for low impedance loads Raw output from R-2R type resistor ladder DAC When unbuffered, the output is directly connected to the R 2-R resistor ladder network type of DAC The DAC support different input format: • 8-bit mode: Right aligned data input (on 16 bit data register) 8-bit + 8-bit data input for Dual channel mode
• 12-bit mode: Right aligned data input (on 16-bit data register) Left aligned data input (on 16-bit data register)
2.3. Low Power Mode
This is a feature available for extremely low power requirements.
insert figure []
3. Let's get started
3.1. Start a new project
Note: After downloading the firmware package with STM32CubeMX, existing examples could be found at the following relative path : \STM32Cube\Repository\STM32Cube_FW_L4_V1.17.2\Projects\NUCLEO-L476RG\Examples\DAC and open them with STM32CubeMX. insert fig [] Search for DAC1 in the left search field Search for PA5 then click Reset_State Insert fig [] • If you want to start the project with a board, the LED pin is already selected (PA5 on NucleoL476RG. For other boards refer to the user manual), we can measure the output waveform on this pin. [] insert fig []
4. Test
[[category:Getting_started_with_STM32_system_peripherals | 15]] </noinclude