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.

板子msp-exp430f5529lp,用的是energia,移植arduino的程序到430上来,interrupt怎么改?

Other Parts Discussed in Thread: MSP-EXP430F5529LP, ENERGIA

板子msp-exp430f5529lp,用的是energia,移植arduino的程序到430上来,interrupt怎么改?

Interrupt.ino: In function 'void interruptSetup()':
Interrupt.ino:17:3: error: 'TCCR2A' was not declared in this scope
Interrupt.ino:18:3: error: 'TCCR2B' was not declared in this scope
Interrupt.ino:19:3: error: 'OCR2A' was not declared in this scope
Interrupt.ino:20:3: error: 'TIMSK2' was not declared in this scope
Interrupt.ino:21:7: error: 'sei' was not declared in this scope
Interrupt.ino: At global scope:
Interrupt.ino:27:4: error: expected constructor, destructor, or type conversion before '(' token


ARDUINO程序在ENERGIA里编译出现这样的错误提示,请问这个怎么改?
或者在哪里能看到有关interrupt的说明?

出错的5句,在ARDUINO里是这么写的

TCCR2A = 0x02;
TCCR2B = 0x05;
OCR2A = 0X7C;
TIMSK2 = 0x02;
sei();

还有这个板子有时钟吗?

  • 给你一个使用LM4F LaunchPad增加中断的例子:

    1、在系统文件夹中找到Startup_gcc.c;

    2、在应用程序入口声明处,添加外部中断的声明extern xxxx();

    3、修改中断向量定义;

    4、打开Energia.h头文件,增加中断程序的声明;

    5、在Energia环境中,可以定义中断程序了!

    举一反三,仔细分析一下,自然知道怎么增加中断了。

    TCCR2A等等是对定时器的寄存器进行设置从而实现定时或者PWM功能,而在MSP430中,相关的定时器的名字发生了变化,自然无法认知TCCR2A,需要做相应的替换才可以。

    注意:在Energia中有一个定时器是系统占用的,不可以使用。

     

  • 你好,我最近也遇到了 同样的问题,请问你解决了吗
  • hi user5288518

    你用的也是msp-exp430f5529lp吗?

    按楼上的方法你试试