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.
我写了个MSP430小中断测试程序,源代码如下:
#include "io430.h"
#include "io430G2231.h"
int main( void )
{
// Stop watchdog timer to prevent time out reset`
WDTCTL = WDTPW + WDTHOLD;
P1DIR |= BIT0; //设置端口方向
P1OUT |= BIT0;
P1DIR &= ~BIT3;
P1IE |= BIT3; //打开1.3中断
P1IES |= BIT3; //中断方式,P1 Interrupt Edge Select
_BIS_SR(GIE); //开系统中断
while(1);
}
#pragma vector=PORT1_VECTOR
___interrupt void PORT1_ISR(void)
{
P1IE &= ~BIT3; //关闭1.3中断
if((P1IFG & BIT3) == BIT3)
P1OUT ^= BIT0;
P1IFG &= ~BIT3;
P1IE |= BIT3; //打开1.3中断
}
编译出现错误:
main.c
Warning[Pe223]: function "_BIS_SR" declared implicitly G:\IAR\ISR\main.c 14
Error[Pe077]: this declaration has no storage class or type specifier G:\IAR\ISR\main.c 19
Warning[Pe609]: this kind of pragma may not be used here G:\IAR\ISR\main.c 18
Error[Pe065]: expected a ";" G:\IAR\ISR\main.c 19
Warning[Pe012]: parsing restarts here after previous syntax error G:\IAR\ISR\main.c 27
Error while running C/C++ compiler
Done. 2 error(s), 3 warning(s)
我的中断服务程序的申明格式有没错误呢?上面程序该怎么修改呢?
谢谢!
是的,解决了一个error,但是还有错误:
Error[e46]: Undefined external "_BIS_SR" referred in main ( G:\IAR\ISR\Debug\Obj\main.r43 )
请问开系统总中断的函数是什么呢?