初始化ACMP模块
void ACMP_Init(ACMP_Type *pACMPx, ACMP_ConfigType *pConfig)
{
if(ACMP0 == pACMPx)
{
/* 使能ACMP模块的总线时钟 */
SIM->SCGC |= SIM_SCGC_ACMP0_MASK;
/* 使能ACMP中断 */
if(pConfig->sCtrlStatus.bits.bIntEn)
NVIC_EnableIRQ(ACMP0_IRQn);
}
else
{
SIM->SCGC |= SIM_SCGC_ACMP1_MASK;
if(pConfig->sCtrlStatus.bits.bIntEn)
NVIC_EnableIRQ(ACMP1_IRQn);
}
/*选择ACMP正输入和负输入,正输入和负输入引脚不同*/
pACMPx->C0 = pConfig->sPinSelect.byte;
ACMP_ConfigDAC(pACMPx, &pConfig->sDacSet );
//pACMPx->C1 = pConfig->sDacSet.byte;
pACMPx->C2 = pConfig->sPinEnable.byte;
pACMPx->CS = pConfig->sCtrlStatus.byte;
}
|