EADC_Open(EADC, EADC_CTL_DIFFEN_SINGLE_END); //设置为单端,不就采样一次结果吗??????
EADC_SetInternalSampleTime(EADC, 6);
EADC_ConfigSampleModule(EADC, 0, EADC_ADINT0_TRIGGER, 2);// 另外,明明是软件触发,不能设置软件触发源,必须设置为ADINT0
EADC_ENABLE_CMP0(EADC, 0, EADC_CMP_CMPCOND_LESS_THAN, 0x800, 0x5);//当大于或者等于0x800才能算一次
EADC_ENABLE_CMP1(EADC, 0, EADC_CMP_CMPCOND_GREATER_OR_EQUAL, 0x800, 0x5);
EADC_ENABLE_SAMPLE_MODULE_INT(EADC, 0, 0x1);
EADC_CLR_INT_FLAG(EADC, (0x1 << 3)); //开启ADINT3也不见在handler中清楚中断
EADC_ENABLE_INT(EADC, (0x1 << 3));
NVIC_EnableIRQ(ADC03_IRQn);
//开启两个cmp中断
EADC_CLR_INT_FLAG(EADC, (0x1 << 4));
EADC_ENABLE_CMP_INT(EADC, 0);
EADC_CLR_INT_FLAG(EADC, (0x1 << 5));
/* Enable ADC comparator 1 interrupt */
EADC_ENABLE_CMP_INT(EADC, 1);
g_u32AdcCmp0IntFlag = 0;
g_u32AdcCmp1IntFlag = 0;
EADC_START_CONV(EADC, 0x1); //开始
while((g_u32AdcCmp0IntFlag == 0) && (g_u32AdcCmp1IntFlag == 0));
//我的问题:既然要大于0x800五次,那至少不得采样5次,我不理解????开启了ADINT3也没有清零???我上一个贴子是在询问差分,主要是结果理解不了????这是官方程序肯定没错
|