• 大小: 75KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-05-23
  • 语言: 其他
  • 标签:

资源简介

cc2530红外接收发射模块代码;基于zigbee小板 红外接收 通过串口打印

资源截图

代码片段和文件信息

//By  JIALI  Electronics LTD.
#include 
#define IROUT   P1_1 //红外发射脚
#define RLED  P1_0 //红外发射指示
#define uchar   unsigned char
#define uint    unsigned int
/*****************************************
//定义全局变量
*****************************************/
uint  counter = 0;
uchar LEDFlag = 0;

void Delay(uint); //延时函数
void Delay(uint n)
{
uint i;
for(i = 0;i        for(i = 0;i        for(i = 0;i        for(i = 0;i        for(i = 0;i}
main()
{        
        uint j;
        j=0;
        P1SEL &= ~0x03;                                //设定P1_1为通用I/O
        P1DIR |= 0x03;                                 
        RLED  = 0;                                   
        IROUT = 1;                                     //IROUT 引脚初始化为高电平
        T4CTL  = 0x07;                                 //不分頻,Up-Down Mode(0x00->T1CC0->0x00)
        T4CC0 = 0x64;                                  //设定初值
        TIMIF &= ~0x18;                                //清除Timer4溢出中断标记        
        T4CTL |= 0x08;                                  //设定Timer4溢出中断使能
        IRCON &= ~0x10;                                 //清除Timer4中断标记
        IEN1 |= 0x10;                                   //设定Timer中断使能
        IEN0 |= 0x80;                                   //设定总中断使能 (EAL) 
        T4CTL  |= 0x10;                                 //启动定时器T4             
        while(1)
        {
          if(LEDFlag ==0)
        {
       // RLED = !RLED;
        IROUT = !IROUT;
        LEDFlag =!LEDFlag;
        j++;
        if(j==50000)
        { 
        j=0;
         RLED = !RLED; 
        T4CTL  &= 0xef;        // 关闭定时器T4,停止发送,因为红外接收头无法连续接收,需停止片刻
        Delay(50000);
        T4CTL  |= 0x10; 
        }
       }           
        }
}

#pragma vector = T4_VECTOR
__interrupt void T4_ISR(void)
{
        if((TIMIF &= 0x18) > 0)                        //Timer4溢出?       
        {
                LEDFlag= !LEDFlag;
                TIMIF &= ~0x18;                        //清除Timer4溢出中断标记
        }
                IRCON &= ~0x10;                       //清除Timer4中断标记
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2013-05-09 12:19  ReceiveLED\
     文件         101  2013-05-08 16:12  ReceiveLED\bol.h
     目录           0  2013-05-04 09:23  ReceiveLED\Debug\
     目录           0  2013-05-08 09:16  ReceiveLED\Debug\Exe\
     文件       18847  2013-05-08 16:16  ReceiveLED\Debug\Exe\ReceiveLED.d51
     文件        5534  2013-05-09 12:06  ReceiveLED\Debug\Exe\ReceiveLED.hex
     文件        5536  2013-05-08 16:15  ReceiveLED\Debug\Exe\test.hex
     目录           0  2013-05-04 09:23  ReceiveLED\Debug\List\
     目录           0  2013-05-09 12:19  ReceiveLED\Debug\Obj\
     文件        1245  2013-05-08 08:18  ReceiveLED\Debug\Obj\EWECD1.r51
     文件         441  2013-05-09 12:19  ReceiveLED\Debug\Obj\main.pbi
     文件        5675  2013-05-09 12:06  ReceiveLED\Debug\Obj\main.r51
     文件         441  2013-05-09 12:09  ReceiveLED\Debug\Obj\mode.pbi
     文件       14659  2013-05-09 12:06  ReceiveLED\Debug\Obj\mode.r51
     文件         445  2013-05-09 12:09  ReceiveLED\Debug\Obj\printf.pbi
     文件       16704  2013-05-09 12:06  ReceiveLED\Debug\Obj\printf.r51
     文件         197  2013-05-09 12:19  ReceiveLED\Debug\Obj\ReceiveLED.pbd
     文件           0  2013-05-08 09:59  ReceiveLED\EW86DC.tmp
     文件           0  2013-05-08 09:59  ReceiveLED\EW86DD.tmp
     文件           0  2013-05-08 10:48  ReceiveLED\EWD543.tmp
     文件           0  2013-05-08 10:48  ReceiveLED\EWD544.tmp
     文件       20093  2013-05-08 08:18  ReceiveLED\EWECD0.tmp
     文件           0  2013-05-08 08:17  ReceiveLED\EWECD1.tmp
     文件           0  2013-05-06 20:58  ReceiveLED\EWF0DC.tmp
     文件           0  2013-05-06 20:58  ReceiveLED\EWF0DD.tmp
     文件         861  2013-05-07 10:02  ReceiveLED\hal.h
     文件         492  2013-05-09 12:19  ReceiveLED\main.c
     文件        1853  2013-05-09 12:06  ReceiveLED\mode.c
     文件        1635  2013-05-09 12:06  ReceiveLED\printf.c
     文件        3905  2013-05-09 12:06  ReceiveLED\ReceiveLED.dep
     文件       34291  2013-05-08 09:12  ReceiveLED\ReceiveLED.ewd
............此处省略38个文件信息

评论

共有 条评论

相关资源