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 TIMER中断

Hi,

芯片规格书和timer.h文件中,能够看出通用timer能够支持TIMER_TIMA_MATCH和TIMER_TIMB_MATCH中断,为什么驱动文件timer.c的函数TimerIntEnable()却没有列出TIMER_TIMA_MATCH和TIMER_TIMB_MATCH?我的库版本是1.1。

实际测试TIMER_TIMA_MATCH是正常的。

//*****************************************************************************
//
//! Enables individual timer interrupt sources.
//!
//! \param ui32Base is the base address of the timer module.
//! \param ui32IntFlags is the bit mask of the interrupt sources to be enabled.
//!
//! This function enables the indicated timer interrupt sources.  Only the
//! sources that are enabled can be reflected to the processor interrupt;
//! disabled sources have no effect on the processor.
//!
//! The \e ui32IntFlags parameter must be the logical OR of any combination of
//! the following:
//!
//! - \b TIMER_CAPB_EVENT  - Capture B event interrupt
//! - \b TIMER_CAPB_MATCH  - Capture B match interrupt
//! - \b TIMER_TIMB_TIMEOUT  - Timer B timeout interrupt
//! - \b TIMER_RTC_MATCH  - RTC interrupt mask
//! - \b TIMER_CAPA_EVENT  - Capture A event interrupt
//! - \b TIMER_CAPA_MATCH  - Capture A match interrupt
//! - \b TIMER_TIMA_TIMEOUT  - Timer A timeout interrupt
//!
//! \return None.
//
//*****************************************************************************
void
TimerIntEnable(uint32_t ui32Base, uint32_t ui32IntFlags)
{
    //
    // Check the arguments.
    //
    ASSERT(_TimerBaseValid(ui32Base));

    //
    // Enable the specified interrupts.
    //
    HWREG(ui32Base + TIMER_O_IMR) |= ui32IntFlags;
}

  • Bruce

    感谢你的反馈,user's guide 并没有完全标明所有已经define的宏定义。Timer中断的宏如下所示:

    //*****************************************************************************
    //
    // Values that can be passed to TimerIntEnable, TimerIntDisable, and
    // TimerIntClear as the ui32IntFlags parameter, and returned from
    // TimerIntStatus.
    //
    //*****************************************************************************
    #define TIMER_TIMB_MATCH 0x00000800 // TimerB match interrupt
    #define TIMER_CAPB_EVENT 0x00000400 // CaptureB event interrupt
    #define TIMER_CAPB_MATCH 0x00000200 // CaptureB match interrupt
    #define TIMER_TIMB_TIMEOUT 0x00000100 // TimerB time out interrupt
    #define TIMER_TIMA_MATCH 0x00000010 // TimerA match interrupt
    #define TIMER_RTC_MATCH 0x00000008 // RTC interrupt mask
    #define TIMER_CAPA_EVENT 0x00000004 // CaptureA event interrupt
    #define TIMER_CAPA_MATCH 0x00000002 // CaptureA match interrupt
    #define TIMER_TIMA_TIMEOUT 0x00000001 // TimerA time out interrupt

    实际使用中,请以timer.h中定义的为准。