⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 remote_led.lst

📁 一个非常好的微处理器检测遥控器编码的C++ 原代码项目文件,直接可用,LED显示
💻 LST
📖 第 1 页 / 共 3 页
字号:
C51 COMPILER V7.06   REMOTE_LED                                                            12/06/2004 10:42:26 PAGE 1   


C51 COMPILER V7.06, COMPILATION OF MODULE REMOTE_LED
OBJECT MODULE PLACED IN remote_led.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE remote_led.c BROWSE DEBUG OBJECTEXTEND

stmt level    source

   1          //////////////////////////////////////////////////////////////////////////////////////////////////////////
             -//
   2          //file:         remote_led.c                                                                                                                                                          //        
   3          //function:     receive remote cortrol signed for "PHILIP SAA3010" and "NEC PD6122G"                                          //
   4          //          display the usercode or keydata to LED                                                                                                            //        
   5          //input:        p2.0:selec display mode for usercode and keydata                                                                                      //
   6          //                      p3.2:the remote signed                                                                                                                                        //
   7          //output:       device LED:data line a b c d e f g                                                                                                                    //
   8          //                      lock line ctrl_1 ctrl_2 ctrl_3 ctrl_4 ctrl_5                                                                                          //
   9          //////////////////////////////////////////////////////////////////////////////////////////////////////////
             -// 
  10          #include <reg51.h>
  11          #define DEBUG
  12          
  13          #define uchar           unsigned        char
  14          #define uint            unsigned        int
  15          #define CPU_12MHZ               0
  16          #define CPU_24MHZ               1
  17          #define DELAY40ms               40
  18          #define DELAY30s                30000
  19          #define HIGH                    1
  20          #define LOW                             0
  21          #define Display_MODE    0
  22          #define Reserv_MODE             1
  23          #define UserCode                1
  24          #define PHILIP_SAA3010  1
  25          #define NEC_PD6122G             2
  26          #define TIME_T0                 0
  27          #define COUNT_T0                1
  28          //////////////////////////////////////////////////////////////////////////////////////////////////////////
             -//
  29          ////////////////////////////////////define output pin/////////////////////////////////////////////////////
             -//
  30          #define LED_OUT P0
  31          //P0.0 P0.1 P0.2 P0.3 P0.4 P0.5 P0.6
  32          //a    b    c    d    e    f    g   
  33          sbit    bLedCtrl_1=P1^0;//////////////////////////////////////////////////////////LED LSB display  contrlbit 
  34          sbit    bLedCtrl_2=P1^1;
  35          sbit    bLedCtrl_3=P1^4;
  36          sbit    bLedCtrl_4=P1^3;
  37          sbit    bLedCtrl_5=P1^2;
  38          //////////////////////////////////////////////////////////////////////////////////////////////////////////
             -//
  39          /////////////////////////////////////define  input pin////////////////////////////////////////////////////
             -//
  40          sbit    InKey_Selc_UserOrKey_Code=P2^0;
  41          sbit    InKey_Selc_Other=P2^1;
  42          sbit    bInRemote_T0=P3^4;
  43          //////////////////////////////////////////////////////////////////////////////////////////////////////////
             -//
  44          /////////////////////////////////////define  flag/////////////////////////////////////////////////////////
             -//
  45          bit             bCHIP_TYPE_STAU;////////////////////////////////////////////1:the chip tpye is changed; 0:no changed
  46          bit             bDISP_DATA_TYPE;///////////////1:display usercode char "C" on LED 0:display keydata  char "D" on LED
  47          bit             bInRemote_Flag; ///////////////////////////////////////////////////1:have remote signed; 0:no signed 
C51 COMPILER V7.06   REMOTE_LED                                                            12/06/2004 10:42:26 PAGE 2   

  48          bit             bDelay30s_Overflow;////////////////////////in 30s no input remote the LED will display "- - - - C&D"
  49          bit             bWait_LowToHigh;//////////////////////////////////////////////1:wait the press KEY release; 0:no use
  50          bit             bInKey_Valid;//////////////////////////////////////////1:the press KEY is valid; 0:no KEY is pressed
  51          bit             bDelayFlag_PressKey;/////////////////////////////////////1:delay 40ms flag while press KEY; 0:no use
  52          bit             bTimerOrCounter_Flag;//////////////////////////COUNT_T0:T0 is used counter; TIME_T0:T0 is used timer
  53          bit             bNoise_IR;//////////////////////////////////////////////////1:the remote signed is noise; 0:no noise
  54          bit             CPU_CLK;
  55          //////////////////////////////////////////////////////////////////////////////////////////////////////////
             -//
  56          /////////////////////////////////////define public var////////////////////////////////////////////////////
             -//
  57          uchar   data    DelayValue_PressKey, Key_Data, Copy_TL1, Copy_TH1, Copy_TL0, Copy_TH0;
  58          uchar   data    UsercodeL, UsercodeH, Keydata, Counter, DISP_CHIP_TYPE;
  59          uchar   data    disp_buff[5], *disp_str;
  60          uint    data    Delay_DEC30s=0;
  61          //////////////////////////////////////////////////////////////////////////////////////////////////////////
             -//
  62          /////////////////////////////////////define display data//////////////////////////////////////////////////
             -//
  63          uchar   code    Disp_00To0F[18]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,
  64          ////////////////////////////////////0    1    2    3    4        5        6    7        8///////////////////////////////
  65                                                                       0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e,0x89,0xbf};
  66          ////////////////////////////////////9    A    B    C    D    E    F  H(X)   -/////////////////////////////
             -//
  67          uchar   code    Disp_Philp[]={0x8c,0xc7,0xcf,0x89,0x8c,0x00};
  68          /////////////////////////////////P    L    I   H     P////////////////////////////////////////////////////
             -//
  69          uchar   code    Disp_Nec[]={0xc6,0x86,0xc8,0x00};
  70          ///////////////////////////////C    E    N////////////////////////////////////////////////////////////////
             -//
  71          uchar   code    Disp_Error[]={0x8f,0xc0,0x8f,0x8f,0x86,0x00};
  72          /////////////////////////////////R    O    R    R    E////////////////////////////////////////////////////
             -//
  73          uchar   code    Disp_Noise[]={0x86,0x92,0xcf,0xc0,0xc8,0x00};
  74          /////////////////////////////////E        S    I   O    N//////////////////////////////////////////////////////
  75          uchar   code    Disp_COBY[]={0x91,0x83,0xc0,0xc6,0x00};////////////////////////////////////////////////////
  76          //////////////////////////////Y    B    O    C   /////////////////////////////////////////////////////////
             -/
  77          void    Initial();
  78          void    Display_Led(uchar Disp_Data,uchar position);
  79          void    Display_Str();
  80          bit     InRemote();
  81          bit     InRemote_Philip();
  82          bit     InRemote_Nec();
  83          void    Display_Message();
  84          //////////////////////////////////////////////////////////////////////////////////////////////////////////
             -//
  85          //////////////////////////////////////main function///////////////////////////////////////////////////////
             -//
  86          void    main()
  87                  {       
  88   1                      uint    delay1s;
  89   1                      Initial();
  90   1                      do
  91   1                              {       if      ((bInKey_Valid)&&(Key_Data==Display_MODE))
  92   2                                               { bDISP_DATA_TYPE=!bDISP_DATA_TYPE;}
  93   2                                      else {;}
  94   2                                      bInKey_Valid=LOW;
  95   2                                      if      (bDISP_DATA_TYPE==UserCode) disp_buff[0]=Disp_00To0F[0x0c];
  96   2                                      else disp_buff[0]=Disp_00To0F[0x0d];
  97   2                                      disp_buff[4]=Disp_COBY[3];
  98   2                                      disp_buff[3]=Disp_COBY[2];
C51 COMPILER V7.06   REMOTE_LED                                                            12/06/2004 10:42:26 PAGE 3   

  99   2                                      disp_buff[2]=Disp_COBY[1];
 100   2                                      disp_buff[1]=Disp_COBY[0];
 101   2                                      disp_str=disp_buff;
 102   2                                      for     (;(!(bInKey_Valid)&&(!bInRemote_Flag));)        Display_Str();
 103   2                                      if      (bInRemote_Flag)/////////////////////////////////////////////////check the remote signed
 104   2                                              {       bInRemote_Flag=LOW;
 105   3                                                      if      (InRemote())
 106   3                                                              {       Delay_DEC30s=DELAY30s; bDelay30s_Overflow=LOW;
 107   4                                                                      for     (;!bDelay30s_Overflow;)//////////////////////////////normal receive area
 108   4                                                                              {       if      (bCHIP_TYPE_STAU) 
 109   5                                                                                              {       switch  (DISP_CHIP_TYPE)
 110   6                                                                                                              {       case PHILIP_SAA3010 :           disp_str=Disp_Philp;break;
 111   7                                                                                                                      case NEC_PD6122G        :               disp_str=Disp_Nec;break;
 112   7                                                                                                               default:       break;
 113   7                                                                                                               }
 114   6                                                                                                      TR0=LOW;        
 115   6                                                                                                      delay1s=Delay_DEC30s;////////////////////display CHIP_TYPE 1s
 116   6                                                                                                      for (;(delay1s-Delay_DEC30s)<1000;) Display_Str();
 117   6                                                                                                      bCHIP_TYPE_STAU=LOW; TR0=HIGH;
 118   6                                                                                              }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -