请问STM32F103VET6有没有DAC的功能啊?如果有,为什么会没有DAC输出啊?
这事搞了我两天了,自已实在找不出下面哪里错了,怎么会没有DA输出呢?
DAC输出引脚为PA4(DAC_OUT1)和PA5(DAC_OUT2),我设定的是由软件触发DA输出,基准为电源电压3.3V,下面是DAC输出的程序,还请哪位高人能帮忙看下问题出在哪里?谢谢了!!!
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4; //
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN; //
GPIO_Init(GPIOA, &GPIO_InitStructure); //A端口
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5; //
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_OD; //
GPIO_Init(GPIOA, &GPIO_InitStructure); //A端口
DAC_DeInit();
DAC_Cmd(DAC_Channel_1,ENABLE); //
DAC_Cmd(DAC_Channel_2, ENABLE);
DAC_StructInit(&DAC_Struct);//将DAC_Struct的值设为默认
DAC_Struct.DAC_Trigger=DAC_Trigger_Software;//由软件触发
DAC_Struct.DAC_WaveGeneration=DAC_WaveGeneration_None;//关闭波形生成
DAC_Struct.DAC_LFSRUnmask_TriangleAmplitude=DAC_TriangleAmplitude_4095;
DAC_Struct.DAC_OutputBuffer=DAC_OutputBuffer_Enable;//使能DAC通道缓存
DAC_Init(DAC_Channel_1,&DAC_Struct);
DAC_Init(DAC_Channel_2,&DAC_Struct);
/* Enable DAC Channel1 */
DAC_Cmd(DAC_Channel_1, ENABLE);
/* Enable DAC Channel2 */
DAC_Cmd(DAC_Channel_2, ENABLE);
DAC_SetChannel1Data(DAC_Align_12b_R,0x7ff);//12位右对齐,输出一半的基准电压
DAC_SetChannel2Data(DAC_Align_12b_R,0x7ff);//输出一半的基准电压
DAC_DualSoftwareTriggerCmd(ENABLE);//使能软件触发,更新DAC的值 |