一个简单的P1口中断例程,编译时出现如下错误,请问这是我哪里设置的不对还是少了那个头文件,还是其他什么问题,求大神指教
Error[Pe020]: identifier "SCG0" is undefined E:msp430中断新建文件夹contiki-2.6cpumsp430f5xxxmsp430.c 46
Error[Pe020]: identifier "uint16_t" is undefined E:msp430中断新建文件夹contiki-2.6cpumsp430f5xxxmsp430.c 50
Error[Pe020]: identifier "UCSCTL0" is undefined E:msp430中断新建文件夹contiki-2.6cpumsp430f5xxxmsp430.c 51
Error[Pe020]: identifier "UCSCTL1" is undefined E:msp430中断新建文件夹contiki-2.6cpumsp430f5xxxmsp430.c 52
Error[Pe020]: identifier "DCORSEL_4" is undefined E:msp430中断新建文件夹contiki-2.6cpumsp430f5xxxmsp430.c 52
Error[Pe020]: identifier "UCSCTL2" is undefined E:msp430中断新建文件夹contiki-2.6cpumsp430f5xxxmsp430.c 54
Error[Pe020]: identifier "MSP430_CPU_SPEED" is undefined E:msp430中断新建文件夹contiki-2.6cpumsp430f5xxxmsp430.c 54
Error[Pe020]: identifier "UCSCTL4" is undefined E:msp430中断新建文件夹contiki-2.6cpumsp430f5xxxmsp430.c 55
Warning[Pe223]: function "__bic_SR_register" declared implicitly E:msp430中断新建文件夹contiki-2.6cpumsp430f5xxxmsp430.c 58
Error[Pe020]: identifier "P1IE" is undefined E:msp430中断新建文件夹contiki-2.6cpumsp430f5xxxmsp430.c 132
Error[Pe020]: identifier "P2IE" is undefined E:msp430中断新建文件夹contiki-2.6cpumsp430f5xxxmsp430.c 133
Error[Pe020]: identifier "MSP430_REQUIRE_LPM1" is undefined E:msp430中断新建文件夹contiki-2.6cpumsp430f5xxxmsp430.c 151
Error[Pe020]: identifier "MSP430_REQUIRE_LPM1" is undefined E:msp430中断新建文件夹contiki-2.6cpumsp430f5xxxmsp430.c 159
Warning[Pe223]: function "dint" declared implicitly E:msp430中断新建文件夹contiki-2.6cpumsp430f5xxxmsp430.c 167
Warning[Pe223]: function "eint" declared implicitly E:msp430中断新建文件夹contiki-2.6cpumsp430f5xxxmsp430.c 172
Warning[Pe223]: function "__get_SR_register" declared implicitly E:msp430中断新建文件夹contiki-2.6cpumsp430f5xxxmsp430.c 221
Warning[Pe223]: function "__bic_SR_register" declared implicitly E:msp430中断新建文件夹contiki-2.6cpumsp430f5xxxmsp430.c 222
Error[Pe020]: identifier "GIE" is undefined E:msp430中断新建文件夹contiki-2.6cpumsp430f5xxxmsp430.c 222
Warning[Ta031]: When defining __low_level_init the header file 'intrinsics.h' should E:msp430中断新建文件夹contiki-2.6cpumsp430f5xxxmsp430.c 231
have been included
Error[Pe020]: identifier "WDTCTL" is undefined E:msp430中断新建文件夹contiki-2.6cpumsp430f5xxxmsp430.c 234
Error[Pe020]: identifier "WDTPW" is undefined E:msp430中断新建文件夹contiki-2.6cpumsp430f5xxxmsp430.c 234
Error[Pe020]: identifier "WDTHOLD" is undefined E:msp430中断新建文件夹contiki-2.6cpumsp430f5xxxmsp430.c 234
Error while running C/C++ compiler
wismote_simple_main.c
Warning[Pa050]: non-native end of line sequence detected (this diagnostic is only E:msp430中断新建文件夹contiki-2.6coresysautostart.h 1
issued once)
Warning[Pe223]: function "button_init" declared implicitly E:msp430中断新建文件夹contiki-2.6platformwismotewismote_simple_main.c 71
Total number of errors: 16
Total number of warnings: 10
此帖出自
小平头技术问答
#include "contiki.h"
#include <string.h>
#include "blink3.h"
#include "leds.h"
#include "uart1.h"
#include "stdio.h"
#include "dev/cc2520.h"
#include "lib/random.h"
#include "net/netstack.h"
#include "net/mac/frame802154.h"
#include "net/rime.h"
#include "node-id.h"
#include "sys/autostart.h"
#include "sys/profile.h"
//#include "sprintf.h"
#include "ds2411.h"
#include "i2c.h"
#include "light.h"
#include "dev/button-sensor.h"
#include "msp430x54x.h"
#include "isr_compat.h"
#include <stdio.h>
#ifndef NODE_ID
#define NODE_ID 0x4
#endif /* NODE_ID */
void main(void)
{
/*
* Initalize hardware.
*/
WDTCTL = WDTPW + WDTHOLD;
msp430_cpu_init();
clock_init();
I2C_Init();
leds_init();
ds2411_init();
button_init();
sensors_light_init();
uart1_init(115200);
//点亮LED灯
P5OUT |= BIT2;
P5DIR |= BIT2;
P1DIR &= ~BIT4; //中断引脚应该设置为输入
P1IES |= BIT4; //设置为下降沿触发 =0上升沿触发
P1IFG &= ~BIT4; //因为P1IES设置会使中断标志位置位,故清零
P1IE |= BIT4; //设置中断使能
_EINT(); //打开总中断
LPM3; //设置为LPM3低功耗模式,产生中断时自动激活
//为活动模式,如果在中断中没有修改低功耗模
//式,中断程序执行完成后,又进入LPM3模式
while(1);
}
#pragma vector = PORT1_VECTOR
__interrupt void P1_Interrupt(void)
{
if((P1IFG&0x10) == BIT4)//判断是不是按键P10产生的中断
//因为P1端口共用这个中断向量表
{
P1IFG &= ~BIT4; //中断标志清楚(注意)
P5OUT ^= BIT2; //LED取反
}
else
{
P1IFG &= ~BIT4; //非P10的中断处理
}
}
一周热门 更多>