查看: 1306|回复: 5
打印 上一主题 下一主题

iar编译430问题

[复制链接] qrcode

0

主题

74

帖子

12

积分

新手上路

Rank: 1

积分
12
楼主
发表于 2013-4-27 07:32 PM | 显示全部楼层
程序是在别的编译成功的程序上改的,头文件没敢动,还加了几个,不知道是不是还少哪个,所有程序如下
#include "contiki.h"
#include
#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
#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的中断处理
        }
}
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表