初级会员

- 积分
- 115
- 金钱
- 115
- 注册时间
- 2016-5-31
- 在线时间
- 19 小时
|
5金钱
程序在战舰上是可以运行的,但是在我自己的三个板子上(两个学长做的板子,一个开发板icore2 ),均没有输出。可是串口printf("%d \n",DAC_GetDataOutputValue(DAC_Channel_1));又能看到数据
while(1)
{
DAC_SetChannel1Data(DAC_Align_12b_R,1000);
printf("%d \n",DAC_GetDataOutputValue(DAC_Channel_1));
}
static void DAC_Config(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
DAC_InitTypeDef DAC_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
RCC_APB1PeriphClockCmd(RCC_APB1Periph_DAC, ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN;
GPIO_Init(GPIOA, &GPIO_InitStructure);
DAC_InitStructure.DAC_Trigger = DAC_Trigger_None;
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);
}
|
|