STM32 DAC configuration basic tutorial

  

STM32F103VCT6 comes with two 12-bit DAC, DAC conversion speed has not been found, some people say that the frequency is 1MHZ, that is 1us. The conversion time of the ADC is 1us at 56MHz operating frequency and 1.17us at 72MHz operating frequency. If AD and DA have a symmetrical relationship, then it is likely to be the same time as the ADC. It is not correct to start the analysis!

Since I am using this DA output voltage. The STM32's DAC fixed voltage configuration is similar to the waveform output configuration, except that it calls one more function: DAC_SoftwareTriggerCmd(DAC_Channel_1, ENABLE); this will output a fixed level.

The specific configuration is as follows:

void DAC_VOLTAGE_Configuration(void)

{

< Wbr> DAC_InitTypeDef DAC_InitStructure;

DAC_DeInit();


DAC_InitStructure.DAC_Trigger = DAC_Trigger_None;

< Wbr> DAC_InitStructure.DAC_WaveGeneration = DAC_WaveGeneration_None;

DAC_InitStructure.DAC_OutputBuffer = DAC_OutputBuffer_Disable;

DAC_Init(DAC_Channel_1, &DAC_InitStructure);

DAC_Cmd(DAC_Channel_1, ENABLE);

DAC_SoftwareTriggerCmd(DAC_Channel_1,ENABLE);

}

After configuration is complete, call DAC_SetChannel1Data (DAC_Align_12b_R, 4000); function can send data!! There are two points to note:

1, the first parameter of the function DAC_Align_12b_R can not rewrite this address according to the way of setting the ADC peripheral address. Because this parameter is without a base address, and we will recalculate the address in the second half of the address, this is not right!

2, each time you change the send data, you must call the following two functions:

DAC_SetChannel1Data(DAC_Align_12b_R,4000);

< Wbr> DAC_SoftwareTriggerCmd(DAC_Channel_1,ENABLE);

As for why, my understanding is: because the DAC does not write to the register immediately after changing the data, it needs to be The update, since it is not updated by the timer trigger, can only be updated by calling the function's method.

Copyright © Windows knowledge All Rights Reserved