Regular DAC

<< Click to Display Table of Contents >>

Navigation:  STM32F4 Target > Demos > Standard Peripherals Demos > DAC >

Regular DAC

Previous pageReturn to chapter overviewNext page

Demo File: stm32f4_regulardac_demo.mdl




This example demonstrates how to use the Regular DAC Block to output 2 analog signals

1.Triangular Waveform frequency 1kHz, Amplitude 0 - 2V
2.Sinusoidal Waveform frequency 1kHz, Ampliture  0.5 - 2.5V

as shown in the picture below.

Note that:

The values used to drive DAC Module in this example are derived from native Simulink block from Simulink Source block library. This approach is not suitable for generating high-frequency signals. This is because the Source blocks compute each value by solving relevant equation analytically, hence there is computation time lost.

To generate high frequency signal, use Arbitrary Function Generator Block. This block requires you to pre-define all values of the signal before uses. It also uses hardware DMA to optimize speed. Hence, it is possible to output analog signal at the maximum possible frequency (e.g. 2MHz for STM32F4xx).

How to Setup







What should be happening?

2 Analog signals should be generated from pin A4 (Triangular) and A5 (Sinusoidal) as shown below.