The aim of this recipe is to echo the analog voltage input to the ADC to the DAC. The DAC operation is relatively simple as compared to the ADC. The MCBSTM400 evaluation board doesn't provide any means of directly monitoring either of the DAC channels. As DAC channel 2 (output to PA5) drives the clock for the USB 2.0 transceiver (IC6), the only option that we have is to use DAC channel 1 (output PA4). To see an output, we'll need to probe the output PA4 with a test meter. This recipe is called
To set up the DAC follow the steps outlined:
adcTimerISR_c5v0from the Using timers to trigger conversions recipe and extend it by adding the
dac.hfiles. These will be used to define a function called
DAC_Initialize()(shown next) that will be used to set up the DAC; the DAC registers and mask definitions are defined as a data structure in the
#include ""stm32f4xx_hal.h"" /* STM32F4xx Defs */ #include ""DAC...