TI中文支持网
TI专业的中文技术问题搜集分享网站

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();   //开启总中断

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

Susan Yang:ADC采样的设置是通过 ADC Sequence来实现的。

您可以看一下

www.ti.com.cn/…/tm4c1294kcpdt.pdf

的 15.3.1 Sample Sequencers 以及 15.3.2.6 Sample Phase Control

赞(0)
未经允许不得转载:TI中文支持网 » TM4C1294ADC采样
分享到: 更多 (0)