Skip to Content

DAC Peripheral Block Description

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



DAC block

Table of Contents

Inputs

Input NameTypeDescription
Valueuint16Digital value to be converted into an analog signal.

Outputs

Output NameTypeDescription
Statusuint8Conversion status. Returns:
1 conversion succeeded
0 conversion failed

Block Parameters

ParameterDescription
DAC numberThe number of the DAC module. For MCUs with a single DAC module, this must be set to 0.
DAC ChannelThe DAC channel number:
DAC_CHANNEL_1 - channel 1
DAC_CHANNEL_2 - channel 2
DAC alignmentData alignment method for conversion:
DAC_ALIGN_12B_R - right alignment for 12-bit DAC
DAC_ALIGN_12B_L - left alignment for 12-bit DAC
DAC_ALIGN_8B_R - right alignment for 8-bit DAC
Sample time [s]The sampling time for the DAC function.


Block parameters for DAC

CubeMX Configuration for a Given MCU Model

CubeMX Settings

No.NamePathSettingDescriptionScreenshot
1Output BufferPinout & Configuration > Analog > DAC* > Output BufferEnabled if neededEnabling the output buffer for the DAC channel. When enabled, the DAC output has increased output current capability but may limit the full voltage range.DAC Output Buffer setting
2TriggerPinout & Configuration > Analog > DAC* > TriggerNoneSetting 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.DAC Trigger setting

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