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.

C6657 定时器中断禁用

Other Parts Discussed in Thread: SYSBIOS

在使用C6657过程中,在SYS/BIOS操作系统下,有一个定时器中断需要反复启停,我在搜索官方例程和资料时,只发现了有关于定时器中断的配置,没有发现关于定时器中断禁用的资料及例程,请问有相关的函数和资料可供参考吗?

  • Void Timer_start(Timer_Handle handle);
    Void Timer_stop(Timer_Handle handle);
    这个两个函数用来启停timer,具体请看sys/bios api文档,打开后到ti\sysbios\timers路径下。
    C:\ti\c665x SDK 5.03\bios_6_75_02_00\docs\Bios_APIs
  • 您好,我想做的程序是在第一个硬件中断中启用一个定时器中断,在另一个硬件中断中停用这个定时器中断,如果直接设置,程序编译会报定时器没有被定义,程序代码如下:

    Void Syn0(UArg arg)       //配置定时器中断并启动
    {
        Timer_Params timerParams;
        Timer_Handle Timer3;
        Timer_Params_init(&timerParams);
        // 配置周期
        timerParams.period = 100; // 0.1ms
        timerParams.periodType = Timer_PeriodType_MICROSECS;
        // 实例化定时器
        Timer3 = Timer_create(3, TimerIsr1, &timerParams, NULL);

    }

    void Pluse1()           //禁用定时器中断
    {

        Timer_stop(Timer3);
    }

    编译后报错说Timer3没有被定义

    请问之中情况应该怎么解决?如何能定义一个适用全局的句柄呢

  • 定时器配置可以放在中断子程序外面做,中断子程序中不建议做很多的操作,只使能timer就好了。
  • 我将定时器的配置放在主程序中,但是在中断服务函数中依然提示我变量未被定义。

    Description Resource Path Location Type
    #20 identifier "Timer3" is undefined main.c /SYSBIOS_Timer line 763 C/C++ Problem
    #20 identifier "Timer3" is undefined main.c /SYSBIOS_Timer line 775 C/C++ Problem
    gmake: *** [main.obj] Error 1 SYSBIOS_Timer C/C++ Problem
    gmake: Target 'all' not remade because of errors. SYSBIOS_Timer C/C++ Problem

  • 您好,就动态配置而言,哪一句算是使能呢?
    Timer_Handle Timer3;
    Timer_Params_init(&timerParams);
    // 配置周期
    timerParams.period = 100; // 0.1ms
    timerParams.periodType = Timer_PeriodType_MICROSECS;
    Timer3 = Timer_create(3, TimerIsr1, &timerParams, NULL);
    if(Timer3 == NULL)
    {
    System_abort("Timer create failed");
    }
  • 请问中断子程序在main.c主程序中吗?如果是两个.c文件的话,用extern Timer_Handle myTimer;定义一下。
    另外,有添加#include <ti/sysbios/hal/Timer.h>头文件吧?
  • 您好,中断子程序在main.c中,extern Timer_Handle myTimer这局应该加在哪里,我试着加到主函数和Timer.h 文件中,都报错。