Download Print this page

ST STM32F301 6 Series Reference Manual page 284

Advanced arm-based 32-bit mcus

Advertisement

Digital-to-analog converter (DAC1)
13.7
Triangle-wave generation
It is possible to add a small-amplitude triangular waveform on a DC or slowly varying signal.
DAC triangle-wave generation is selected by setting WAVEx[1:0] to "10". The amplitude is
configured through the MAMPx[3:0] bits in the DAC_CR register. An internal triangle counter
is incremented three APB clock cycles after each trigger event. The value of this counter is
then added to the DAC_DHRx register without overflow and the sum is stored into the
DAC_DORx register. The triangle counter is incremented as long as it is less than the
maximum amplitude defined by the MAMPx[3:0] bits. Once the configured amplitude is
reached, the counter is decremented down to 0, then incremented again and so on.
It is possible to reset triangle wave generation by resetting the WAVEx[1:0] bits.
DAC_DHRx base value
Figure 76. DAC conversion (SW trigger enabled) with triangle wave generation
APB1_CLK
DHR
DOR
SWTRIG
Note:
The DAC trigger must be enabled for triangle generation by setting the TENx bit in the
DAC_CR register.
The MAMPx[3:0] bits must be configured before enabling the DAC, otherwise they cannot
be changed.
284/874
Figure 75. DAC triangle wave generation
MAMPx[3:0] max amplitude
+ DAC_DHRx base value
0
0xABE
0xABE
RM0366 Rev 5
0xABF
0xAC0
RM0366
ai14715c
ai14716b

Advertisement

loading
Need help?

Need help?

Do you have a question about the STM32F301 6 Series and is the answer not in the manual?

This manual is also suitable for:

Stm32f301 8 seriesStm32f318 8 series