M261的比较器,为何正负计数数值相差很多?
按道理,进入比较器的中断,不是正端>负端,就是负端>正端,应该是正负计数数值比较接近才是,为何会相差很多?
void ACMP01_IRQHandler(void)
{
/* Clear ACMP 1 interrupt flag */
ACMP_CLR_INT_FLAG(ACMP01, 0);
if(ACMP_GET_OUTPUT(ACMP01, 0))
u32CntH++;// printf("ACMP1_P voltage > VER (%d)\n", u32Cnt);
else
u32CntL++;// printf("ACMP1_P voltage <= VER (%d)\n", u32Cnt);
// u32Cnt++;
}
//初始化代码。
ACMP_Open(ACMP01, 0, ACMP_CTL_NEGSEL_VBG, ACMP_CTL_HYSTERESIS_DISABLE);
/* Select P1 as ACMP positive input channel */
ACMP_SELECT_P(ACMP01, 0, ACMP_CTL_POSSEL_P1);
/* Enable interrupt */
ACMP_ENABLE_INT(ACMP01, 0);
/* Enable ACMP01 interrupt */
NVIC_EnableIRQ(ACMP01_IRQn);
|