This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
这个是我测试ADC中断服务的小程序,发现怎么调都无法进入中断服务程序,求各位指教。
void ADCinthandler(void);
int main(void) {
SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_OSC_MAIN|SYSCTL_XTAL_16MHZ);
SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
ADCHardwareOversampleConfigure(ADC0_BASE, 64);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_3);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3);
ADCIntClear(ADC0_BASE, 3);
ADCSequenceConfigure(ADC0_BASE, 3, ADC_TRIGGER_PROCESSOR, 0);
ADCSequenceStepConfigure(ADC0_BASE,3,0,ADC_CTL_CH0|ADC_CTL_IE|ADC_CTL_END);
ADCSequenceEnable(ADC0_BASE, 3);
IntMasterEnable();
ADCIntEnable(ADC0_BASE,3);
ADCIntEnableEx(ADC0_BASE,ADC_INT_SS3);
ADCProcessorTrigger(ADC0_BASE, 3);
while(1);
}
void ADCinthandler(void) {
ADCIntClear(ADC0_BASE, 3);
ADCIntClearEx(ADC0_BASE,ADC_INT_SS3);
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3, 2);
}
思路很简单,就是ADC发生一次中断以后,进入中断服务,红灯亮。服务程序已经加入到startup函数中
分享给你一个用ADC0 SS0的,对应修改就好了:
ADCIntEnable(ADC0_BASE, 0);
IntEnable(INT_ADC0SS0);
IntMasterEnable();
ADCIntClear(ADC0_BASE, 0);
ADCSequenceEnable(ADC0_BASE, 0);