配置ADC0 四通道采样,软件触发,为什么每次采回的数据顺序都不一样,是跟溢出有关吗,请问怎样解决。测试代码如下:
#define ADC_Sequencer 1
#define ADC_BASE ADC0_BASE
void main(void) [
SysCtlClockSet(SYSCTL_SYSDIV_4|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|
SYSCTL_OSC_MAIN);
SystemClock=SysCtlClockGet();
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
MAP_GPIOPinTypeADC(GPIO_PORTD_BASE, GPIO_PIN_1);
MAP_GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_2);
MAP_GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_1);
MAP_GPIOPinTypeADC(GPIO_PORTD_BASE, GPIO_PIN_2);
ADCSequenceConfigure(ADC_BASE, ADC_Sequencer, ADC_TRIGGER_PROCESSOR, 0);
ADCHardwareOversampleConfigure(ADC_BASE,8);
ADCSequenceStepConfigure(ADC_BASE, ADC_Sequencer, 0,
ADC_CTL_CH1);
ADCSequenceStepConfigure(ADC_BASE, ADC_Sequencer, 1,
ADC_CTL_CH2);
ADCSequenceStepConfigure(ADC_BASE, ADC_Sequencer, 2,
ADC_CTL_CH4);
ADCSequenceStepConfigure(ADC_BASE, ADC_Sequencer, 3,
ADC_CTL_IE | ADC_CTL_END | ADC_CTL_CH5);
ADCSequenceEnable(ADC_BASE, ADC_Sequencer);
ADCIntClear(ADC0_BASE, ADC_Sequencer);
ADCIntRegister(ADC0_BASE,ADC_Sequencer,ADC1IntHandler);
ADCIntEnable(ADC0_BASE,ADC_Sequencer);
IntMasterEnable();
while(1)
[
ADCProcessorTrigger(ADC_BASE, ADC_Sequencer);
SysCtlDelay(5000);
_nop();
]
]
void ADC1IntHandler()
[
ADCIntClear(ADC0_BASE, ADC_Sequencer);
ADCSequenceDataGet(ADC0_BASE, ADC_Sequencer, AD0IN4);
_nop();
]
0