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.

TM4C1294ADC采样



 void
CONFIG_ADC()
{
    // The ADC0 peripheral must be enabled for use.
    SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
    // ADC0 is used with AIN0/1 on port E3.
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
    // GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_3);
    GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_3);//PE3---IN0
    // 设置ADC参考电压为外部3V
    ADCReferenceSet(ADC0_BASE, ADC_REF_EXT_3V);
    // Enable sample sequence 3 with a processor signal trigger.  Sequence 3
    // will do a single sample when the processor sends a signal to start the
    // conversion.  Each ADC module has 4 programmable sequences, sequence 0
    // to sequence 3.  This example is arbitrarily using sequence 3.
    ADCSequenceConfigure(ADC0_BASE, ADC_Seqnum, ADC_TRIGGER_PROCESSOR, 0);

    // ADCSequenceStepConfigure(ADC0_BASE, 3, 0, ADC_CTL_D | ADC_CTL_CH0 |
                                 //ADC_CTL_IE | ADC_CTL_END);
    // 注意ADC的配置参数,ADC_CTL_D这个参数代表是差分输入
    ADCSequenceStepConfigure(ADC0_BASE, ADC_Seqnum, 0, ADC_CTL_CH0 |
                  ADC_CTL_IE | ADC_CTL_END);
    // Since sample sequence 3 is now configured, it must be enabled.
    ADCSequenceEnable(ADC0_BASE, ADC_Seqnum);

    // Clear the interrupt status flag.  This is done to make sure the
    // interrupt flag is cleared before we sample.
    ADCIntClear(ADC0_BASE, ADC_Seqnum);
    ADCIntEnable(ADC0_BASE, ADC_Seqnum);
    ADCProcessorTrigger(ADC0_BASE, ADC_Seqnum);
    ADCIntRegister(ADC0_BASE,ADC_Seqnum,ADC0_IntHandler);  // 注册序列3中断 函数
    ADCIntEnable(ADC0_BASE,ADC_Seqnum);  //   开启adc中断
    IntMasterEnable();   //开启总中断

这程序里面哪句话是定义采样时间的?或者怎么设置