zoukankan      html  css  js  c++  java
  • CC2530 外部中断 提醒

    #include "ioCC2530.h"


    #define uchar unsigned char


    #define led1    P1_0
    #define led2    P1_1
    #define led3    P1_4
    #define led4    P0_1


    void initled(void)
    {
      P1SEL &=~0x13;
      P1DIR |= 0x13;
      P0SEL &=~0x02;
      P0DIR |= 0x02;
    }


    void init(void)
    {
      
      IEN0|=0x80;   //开总中断
      IEN1|=0x20;   //开p0中断
      P0IEN |=0x20; //注意还要打开 P0对应位的中断 否则不会引起中断
      PICTL|=0x01;  //选择高四位 下降沿置1
    }


    void main(void)
    {
      init();
      initled();
      P0IFG = 0x00;
        led1=0;
        led2=0;
        led3=0;
        led4=0;
      while(1)
      {}
    }
    #pragma vector=P0INT_VECTOR
    __interrupt void P0_IRQ(void)
    {
      if(P0IFG!=0x00)//初始化时标志位就是0
      {
        if(led1==1)
        {
          led1=0;
        }
        else
        {
          led1=1;
        }
        P0IFG=0x00;
        IRCON&=~0x20;
      }
    }

  • 相关阅读:
    一. js高级(1)-面向对象编程
    tips01- 定位
    h5c3 part6 flex
    h5c3 part5 background and transform
    template and pagination
    h5c3 part4
    h5c3 part3
    h5c3 part2
    h5c3 part1
    学习博客
  • 原文地址:https://www.cnblogs.com/riskyer/p/3293913.html
Copyright © 2011-2022 走看看