||
此代碼基於LM3S3748 DEMO KIT編寫
//
// Enable the first sample sequence to capture the value of channel 0 when
// the processor trigger occurs.
//
ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR, 0);
ADCSequenceStepConfigure(ADC0_BASE, 0, 0,
ADC_CTL_IE | ADC_CTL_END | ADC_CTL_CH7);
ADCHardwareOversampleConfigure(ADC0_BASE,8);
ADCSequenceEnable(ADC0_BASE, 0);
//
// Trigger the sample sequence.
//
ADCProcessorTrigger(ADC0_BASE, 0);
ADCIntEnable(ADC0_BASE, 0);
IntEnable(INT_ADC0);
unsigned long l_Dat;
while(1)
{
l_Dat++;
l_Dat = l_Dat;
}
}
void
ADCIntHandler(void)
{
unsigned long ulValue;
ADCSequenceDataGet(ADC0_BASE, 0, &ulValue);
ulValue = ulValue;
ADCProcessorTrigger(ADC0_BASE, 0);
}