TA的每日心情 | 开心 2018-3-29 09:22 |
---|
签到天数: 15 天 连续签到: 1 天 [LV.4]偶尔看看III
|
楼主 |
发表于 2016-6-13 23:18:47
|
显示全部楼层
void AdcInit(void)
{
RCC->APB1CCR |= RCC_APB1CCR_DACEN;
RCC->AHBCCR |= RCC_AHBCCR_PAEN; //IOCLOCK
GPIOA->OSPD |= 0xffffffff;//ÉÏÀ
GPIOA->PUPD |= 0x00555500;//ËÙ¶È
GPIOA->OMODE |= 0x0000; //Êä³öÀàÐÍ
GPIOA->CTLR |= 0x00000f00;//Êä³öģʽ
GPIOA->DOR |= 0x00000000; //Êä³öÄÚÈÝ
//GPIOA->AFS[0] = 0x1100;//IO AFS 2,3
DAC->CTLR = 0x0016000e;//ADC1,ADC2,tim3,tim2
DAC->CTLR |= 0x00010000;//DAC2 enable
DAC->CTLR |= 0x00000001;//DAC1 enable
DAC->SWTR |= 0x00000010;//DAC2 soft trigger
DAC->SWTR |= 0x00000001;//DAC1 soft trigger
// DAC_SetDAC1Data(DAC_ALIGN_12B_R, 0x7FF0);
// DAC_SetDAC2Data(DAC_ALIGN_12B_R, 0x7FF0);
}
|
|