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注册中断向量表link出错...

我在starup.s的文件中添加了这两个中断处理程序,但是编译出现这样的错误,请问应该怎么去解决这个问题

还有就是顺便问一下timer定时器在固件库中捕获上升下降沿的函数是什么,有例程的话就谢谢了!

  • 你的工程师自己配置的还是用的官方的,这么写是没错的,这两个地方修改了即可。怀疑是你工程配置的问题,比如头文件的包含等。

    参考官方的这个例程,也是用的定时器中断,仔细检查下配置。

  • 配置是自己配置的,我不懂您说的这两个地方指的是什么,我定时器中断进得去,但是那个上升沿捕获的进不去

    以下是我的环境和工程配置文件图

  • 在.s文件里面有添加这样

  • 那个问题解决了,您能否帮我看一下为什么这个进不去一个上升沿中断,

    我设置的是从PB4角捕获上升沿,每捕获一次上升沿frequce+1最后经过一个周期,去计算一次频率,然后GPIOPinConfigure(设置的是 GPIO_PB4_T1CCP0)

     但是上升沿中断一直进不去,中断函数在.s里面有去添加,定时的中断进的去,
     不知道是配置的问题还是中断触发事件有问题 
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    #include <stdint.h>
    #include <stdbool.h>
    #include "inc/hw_memmap.h"
    #include "inc/hw_ints.h"
    #include "inc/hw_types.h"
    #include "driverlib/debug.h"
    #include "driverlib/timer.h"
    #include "driverlib/gpio.h"
    #include "driverlib/sysctl.h"
    #include "driverlib/pin_map.h"
    #include "driverlib/interrupt.h"
    #include "utils/uartstdio.h"
    #include "driverlib/uart.h"
    #include "driverlib/rom.h"

    #define uint unsigned int 
    #define uchar unsigned char

    uint frequce = 0;
    uint frequce_temp = 0;
    void Timer0IntHandler()
    {
    //一次周期后进行频率计算
    TimerIntClear(TIMER0_BASE,TIMER_TIMA_TIMEOUT);
    frequce = frequce_temp/(SysCtlClockGet());
    UARTprintf("frequce = %d\n",frequce);
    }
    void Timer3IntHandler()
    {
    TimerIntClear(TIMER1_BASE,TIMER_CAPA_EVENT);
    //每进来一次,frequce+1;
    frequce_temp++; 
    }
    void
    ConfigureUART(void)
    {
    //
    // Enable the GPIO Peripheral used by the UART.
    //
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);

    //
    // Enable UART0
    //
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);

    //
    // Configure GPIO Pins for UART mode.
    //
    ROM_GPIOPinConfigure(GPIO_PA0_U0RX);
    ROM_GPIOPinConfigure(GPIO_PA1_U0TX);
    ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);

    //
    // Use the internal 16MHz oscillator as the UART clock source.
    //
    UARTClockSourceSet(UART0_BASE, UART_CLOCK_PIOSC);

    //
    // Initialize the UART for console I/O.
    //
    UARTStdioConfig(0, 115200, 16000000);
    }

    /*******************************************************
    **系统的一些时钟和使能
    **时间:16MHZ,OSC,一分频
    **使能:
    *******************************************************/
    void sysctl_time()
    {
    SysCtlClockSet(SYSCTL_SYSDIV_1|SYSCTL_USE_OSC|SYSCTL_OSC_MAIN|SYSCTL_XTAL_16MHZ);
    //使能TIMER0和TIMER4的外设
    SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER1);
    //使用B5进行捕获 
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
    //设置B5为timer输入
    GPIOPinConfigure(GPIO_PB4_T1CCP0);
    GPIOPinTypeTimer(GPIO_PORTB_BASE,GPIO_PIN_4);

    }
    int main()
    {

    sysctl_time();
    ConfigureUART();
    //使能处理器的中断
    IntMasterEnable();
    //配置定时器的周期,为周期时钟
    TimerConfigure(TIMER0_BASE,TIMER_CFG_PERIODIC);
    //2个半宽定时器
    TimerConfigure(TIMER1_BASE,TIMER_CFG_SPLIT_PAIR);
    // TimerConfigure(TIMER1_BASE,TIMER_CFG_PERIODIC);

    //配置控件事件类型,TIMER (A_4),为上升沿捕获
    TimerControlEvent(TIMER1_BASE,TIMER_A,TIMER_EVENT_POS_EDGE);

    //设置定时器的装载值,一个周期进入一次
    TimerLoadSet(TIMER0_BASE,TIMER_A,SysCtlClockGet());

    //设置定时器的中断模式
    IntEnable(INT_TIMER0A);
    IntEnable(INT_TIMER1A);

    //一个为超时中断,一个为匹配中断
    TimerIntEnable(TIMER0_BASE,TIMER_TIMA_TIMEOUT);
    TimerIntEnable(TIMER1_BASE,TIMER_CAPA_EVENT);

    //使能定时器0和定时器1
    TimerEnable(TIMER0_BASE,TIMER_A);
    TimerEnable(TIMER1_BASE,TIMER_A);
    while(1);
    }