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.

[参考译文] TM4C123GH6PM:设置一个计时器、以在没有中断的情况下触发序列发生器采样

Guru**** 1794070 points
Other Parts Discussed in Thread: EK-TM4C123GXL
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1398050/tm4c123gh6pm-setting-up-a-timer-to-trigger-sequencer-sampling-without-interruptions

器件型号:TM4C123GH6PM
Thread 中讨论的其他器件:EK-TM4C123GXL

工具与软件:

为了减少处理器使用率和中断开销、我尝试使用计时器作为序列发生器的触发器。 我唯一的问题是、定时器总是生成一个中断、所以中断开销仍然存在、即使回调函数被设定为 NULL 也是如此。

计时器是否有配置可将其用作事件触发器?

此致、

Vinicius。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

     我想您在使用 ADC 获取模拟样本、对吗?  

     是的、您可以将 ADC 配置为根据计时器触发器采样。 计时器不需要 t 生成中断。 可以将计时器配置为生成 ADC 的触发信号、而不是生成中断。  C:\ti\TivaWare_C_Series-2.2.0.295\examples\boards\ek-tm4c123gxl\adc_udma_pingpong 中提供了该函数的示例。 下面是代码片段。 请参阅下面以红色突出显示的代码、以使用 timer0作为 ADCSS0的触发器。  

    //
    // Enable sample sequence 0 with a processor signal trigger. Sequence 0
    // will do a single sample when the processor sends a signal to start the
    // conversion.
    //
    ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_TIMER, 0);

    //
    // Configure step 0 on sequence 0. Sample channel 3 (ADC_CTL_CH3) in
    // single-ended mode (default) and configure the interrupt flag
    // (ADC_CTL_IE) to be set when the sample is done. Tell the ADC logic
    // that this is the last conversion on sequence 0 (ADC_CTL_END). Sequence
    // 0 has 8 programmable steps. Since we are only doing a single conversion
    // using sequence 0 we will only configure step 0. For more information
    // on the ADC sequences and steps, reference the datasheet.
    //
    ADCSequenceStepConfigure(ADC0_BASE, 0, 0, ADC_CTL_CH3 | ADC_CTL_END |
    ADC_CTL_IE);

    //
    // Since sample sequence 0 is now configured, it must be enabled.
    //
    ADCSequenceEnable(ADC0_BASE, 0);

    //
    // Clear the interrupt status flag. This is done to make sure the
    // interrupt flag is cleared before we sample.
    //
    ADCIntClear(ADC0_BASE, 0);

    //
    // Enables the DMA channel for the ADC0 sample sequence 0.
    //
    ADCSequenceDMAEnable(ADC0_BASE, 0);

    //
    // Enable the ADC 0 sample sequence 0 interrupt.
    //
    ADCIntEnable(ADC0_BASE, 0);

    //
    // Enable the interrupt for ADC0 sequence 0 on the processor (NVIC).
    //
    IntEnable(INT_ADC0SS0);

    //
    // Configure a 16-bit periodic timer.
    //
    TimerConfigure(TIMER0_BASE, TIMER_CFG_SPLIT_PAIR | TIMER_CFG_A_PERIODIC);

    //
    // Set ADC sampling frequency to be 16KHz i.e. every 62.5uS.
    //
    TimerLoadSet(TIMER0_BASE, TIMER_A, (SysCtlClockGet()/16000) - 1);

    //
    // Enable the ADC trigger output for Timer A.
    //
    TimerControlTrigger(TIMER0_BASE, TIMER_A, true);

    //
    // Enable processor interrupts.
    //
    IntMasterEnable();

    //
    // Enable Timer 0 which will start the whole application process.
    //
    TimerEnable(TIMER0_BASE, TIMER_A);

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    嗨、Charles!

    这正是我想要的!

    感谢您的输入、非常容易按此方式进行设置!