参考电压是2.5V,数值是4095的时候,输出的电压竟然是2.0189V,输出到是挺稳定。
我现在不明白,为什么输出不到2.5V.
是那种原因?
还要注意,输出buffer关掉后,DAC的带负载能力会更差
不行啊?
DAC_InitStructure.DAC_Trigger = DAC_Trigger_Software;
DAC_InitStructure.DAC_WaveGeneration = DAC_WaveGeneration_None;
//DAC_InitStructure.DAC_LFSRUnmask_TriangleAmplitude = DAC_LFSRUnmask_Bits8_0;
DAC_InitStructure.DAC_OutputBuffer = DAC_OutputBuffer_Disable;
DAC_Init(DAC_Channel_1, &DAC_InitStructure);
关闭后出现的现象,把缓存关闭后,数据从0v和2.011两个值换。
搞定了
为什么这样行
刚好相反呢?
void dac_out_value_data(INT16U value)
{
DAC_InitTypeDef DAC_InitStructure;
DAC_InitStructure.DAC_Trigger = DAC_Trigger_Software;
DAC_InitStructure.DAC_WaveGeneration = DAC_WaveGeneration_None;
//DAC_InitStructure.DAC_LFSRUnmask_TriangleAmplitude = DAC_LFSRUnmask_Bits8_0;
DAC_InitStructure.DAC_OutputBuffer = DAC_OutputBuffer_Disable;//
DAC_Init(DAC_Channel_1, &DAC_InitStructure);
DAC_SetChannel1Data(DAC_Align_12b_R, value);
DAC_SoftwareTriggerCmd(DAC_Channel_1, ENABLE);
DAC_InitStructure.DAC_Trigger = DAC_Trigger_Software;
DAC_InitStructure.DAC_WaveGeneration = DAC_WaveGeneration_None;
//DAC_InitStructure.DAC_LFSRUnmask_TriangleAmplitude = DAC_LFSRUnmask_Bits8_0;
DAC_InitStructure.DAC_OutputBuffer = DAC_OutputBuffer_Enable;//DAC_OutputBuffer_Enable;//
DAC_Init(DAC_Channel_1, &DAC_InitStructure);
}
DAC应该很简单的,可为什么还那么让人纠结呢,现在我遇到 的问题是SPI和DAC的输出引脚共用了,SPI重映射后又 要禁止JTAG,可禁了结果还是不对,真搞不懂到底是重映射有问题,还是我理解上有问题,或者是硬件上已经PA4已经连接到SPI的NSS上不能再重映射了,哎,搞不懂