DAC Peripheral Block Description
This block handles the digital-to-analog conversion (DAC) in STM microcontrollers.

Table of Contents
Inputs
| Input Name | Type | Description |
|---|---|---|
| Value | uint16 | Digital value to be converted into an analog signal. |
Outputs
| Output Name | Type | Description |
|---|---|---|
| Status | uint8 | Conversion status. Returns:1 conversion succeeded0 conversion failed |
Block Parameters
| Parameter | Description |
|---|---|
| DAC number | The number of the DAC module. For MCUs with a single DAC module, this must be set to 0. |
| DAC Channel | The DAC channel number:DAC_CHANNEL_1 - channel 1DAC_CHANNEL_2 - channel 2 |
| DAC alignment | Data alignment method for conversion:DAC_ALIGN_12B_R - right alignment for 12-bit DACDAC_ALIGN_12B_L - left alignment for 12-bit DACDAC_ALIGN_8B_R - right alignment for 8-bit DAC |
| Sample time [s] | The sampling time for the DAC function. |

CubeMX Configuration for a Given MCU Model
H7
CubeMX Settings
| No. | Name | Path | Setting | Description | Screenshot |
|---|---|---|---|---|---|
| 1 | Output Buffer | Pinout & Configuration > Analog > DAC* > Output Buffer | Enabled if needed | Enabling the output buffer for the DAC channel. When enabled, the DAC output has increased output current capability but may limit the full voltage range. | ![]() |
| 2 | Trigger | Pinout & Configuration > Analog > DAC* > Trigger | None | Setting the DAC conversion trigger source. In this case, it is set to no trigger, which means the conversion is executed immediately after setting the value at the block input. | ![]() |
Interrupts for the DAC are not required.
DAC* - the asterisk (*) symbol represents the number of the DAC module used in the model, e.g., DAC1, DAC2 etc.
See Also
Last updated on

