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

📄 zlg7289.lst

📁 菜鸟,详细NRF24E1运用,程序,电路
💻 LST
字号:
C51 COMPILER V9.00   ZLG7289                                                               11/09/2010 16:31:12 PAGE 1   


C51 COMPILER V9.00, COMPILATION OF MODULE ZLG7289
OBJECT MODULE PLACED IN Zlg7289.OBJ
COMPILER INVOKED BY: D:\Program Files\KEIL C  V4\C51\BIN\C51.EXE Zlg7289.c LARGE BROWSE DEBUG OBJECTEXTEND

line level    source

*** WARNING C500 IN LINE 1 OF ZLG7289.C: LICENSE ERROR (R208: RENEW LICENSE ID CODE (LIC))

   1          #include "reg24le1.h"
   2          #include "Sys.h"
   3          #include "Zlg7289.h"
   4          //键盘相关的函数的定义部分
   5          
   6          #define SCLK  P00
   7          #define IO    P01
   8          #define CS    P02
   9          #define INT   P03
  10          
  11          typedef  char int8 ;
  12          typedef unsigned char uint8 ;
  13          
  14          //延时函数
  15          void __delayNuS(char x)
  16          {
  17   1      for(;x>0;x--)
  18   1         {
  19   2         ;
  20   2         }
  21   1      }
  22          
  23          //I/O口初始化
  24          
  25          void IO_CONFIG()
  26          {
  27   1      P0DIR&=0XFE;  //设置成输出
  28   1      P0DIR&=0XFB;  //设置成输出
  29   1      P0DIR|=0X08;  //设置成输入 
  30   1      INT=1;
  31   1      CS=1;
  32   1      SCLK=1;   
  33   1      }
  34          
  35          //ZLG7289模拟SPI读的函数
  36          
  37          int8 __zlg7289SPIRead (void)
  38          {
  39   1          unsigned char cDat = 0;
  40   1          unsigned char cT   = 8;
  41   1          P0DIR|=0X02;  //设置输入模式
  42   1          /*
  43   1           *  循环读一个字节的数据
  44   1           */
  45   1          do {
  46   2              SCLK=1;
  47   2              __delayNuS(5);
  48   2              cDat <<= 1;
  49   2              if(IO) {
  50   3                  cDat++;
  51   3              }
  52   2              SCLK=0;
  53   2              __delayNuS(5);
  54   2          } while (--cT != 0);
C51 COMPILER V9.00   ZLG7289                                                               11/09/2010 16:31:12 PAGE 2   

  55   1          return cDat;
  56   1      }
  57          
  58          //ZLG7289模拟SPI写的函数
  59          void __zlg7289SPIWrite (int8 cDat)
  60          {
  61   1          int8 cT = 8;
  62   1          P0DIR&=0XFD;   /*  设置DIO端口为输出模式       */
  63   1          /*
  64   1           *  循环写一个字节的数据
  65   1           */
  66   1          do {
  67   2              if((cDat & 0x80) == 0x80) {
  68   3                  IO=1;
  69   3              } else {
  70   3                  IO=0;
  71   3              }
  72   2              cDat <<= 1;
  73   2             SCLK=1;
  74   2              __delayNuS(5);
  75   2             SCLK=0;
  76   2              __delayNuS(5);
  77   2          } while (--cT != 0);
  78   1      }
  79          
  80          //Zlg写指令
  81          
  82          void zlg7289Cmd (int8  cCmd)
  83          {
  84   1      CS=0;
  85   1      __delayNuS(5);
  86   1      __zlg7289SPIWrite(cCmd);
  87   1      __delayNuS(5);
  88   1      CS=1;
  89   1      }
  90          
  91          //Zlg写数据
  92          
  93          void zlg7289CmdDat (uint8  cCmd, int8  cDat)
  94          {
  95   1      CS=0;
  96   1      __delayNuS(5);
  97   1      __zlg7289SPIWrite(cCmd);
  98   1      __delayNuS(5);
  99   1      __zlg7289SPIWrite(cDat);
 100   1      __delayNuS(5);
 101   1      CS=1;
 102   1      }
 103          
 104          //Zlg的LED显示
 105          void zlg7289Download (uint8  ucMod, int8  cX, int8  cDp, int8  cDat)
 106          {
 107   1          uint8 ucModDat[3] = {0x80,0xC8,0x90};
 108   1          uint8 ucD1;
 109   1          uint8 ucD2;
 110   1          
 111   1          if (ucMod > 2) {
 112   2              ucMod = 2;
 113   2          }
 114   1          
 115   1          ucD1  = ucModDat[ucMod];
 116   1          cX   &= 0x07;
C51 COMPILER V9.00   ZLG7289                                                               11/09/2010 16:31:12 PAGE 3   

 117   1          ucD1 |= cX;
 118   1          ucD2  = cDat & 0x7F;
 119   1          
 120   1          if (cDp  == 1) {
 121   2              ucD2 |= 0x80;
 122   2          }
 123   1          zlg7289CmdDat(ucD1, ucD2);
 124   1      }
 125          
 126          //Zlg的键盘读取函数
 127          int8 zlg7289Key (void)
 128          {
 129   1          int8 cKey;
 130   1          CS=0;
 131   1          __delayNuS(25);
 132   1          __zlg7289SPIWrite(0x15);
 133   1          __delayNuS(15);
 134   1          cKey = __zlg7289SPIRead();
 135   1          CS=1;
 136   1          __delayNuS(5);
 137   1          return cKey;
 138   1      }
 139          
 140          //Zlg7289的复位
 141          void zlg7289Reset()
 142          {
 143   1      zlg7289Cmd(0xA4); //通过软复位的地址 
 144   1      }
 145          
 146          //Zlg7289的初始化
 147          void zlg7289Init (void)
 148          {
 149   1              IO_CONFIG();
 150   1          zlg7289Reset();                                                     /*  复位ZLG7289                 */
 151   1      }
 152          
 153          char key(void)
 154          {
 155   1       static char key;
 156   1       P0CON=0XD3;
 157   1       if(INT==0)
 158   1       key=zlg7289Key();
 159   1       if(key!=0xff)
 160   1       {
 161   2       zlg7289Download(1,0,0,(key/10));
 162   2       zlg7289Download(1,1,0,(key%10));
 163   2       return key;
 164   2       }
 165   1      }
 166          
 167          char press(void)
 168          {
 169   1      static char num=0;
 170   1      P0DIR|=0X80;
 171   1      P0CON=0XD7;
 172   1      if(!P07)
 173   1      {
 174   2      delay(5);
 175   2      if(!P07)
 176   2      {
 177   3      while(!P07);
 178   3      P06=!P06;
C51 COMPILER V9.00   ZLG7289                                                               11/09/2010 16:31:12 PAGE 4   

 179   3      num++;
 180   3      }
 181   2      
 182   2      }
 183   1      if(num==15)
 184   1      num=0;
 185   1      return num;
 186   1      }
 187          
 188          unsigned char getkey(char * ps)
 189          {
 190   1       P1DIR=0XFF;
 191   1       P1=0XFF;
 192   1       //扫描按键1
 193   1       P1CON=0XD0;
 194   1       if(P10==0)
 195   1       {
 196   2       delay(5);
 197   2       if(P10==0)
 198   2       {
 199   3       while(!P10);
 200   3       return next;
 201   3       }
 202   2       }
 203   1      
 204   1        //扫描按键2
 205   1       P1CON=0XD1;
 206   1       if(P11==0)
 207   1       {
 208   2       delay(5);
 209   2       if(P11==0)
 210   2       {
 211   3       while(!P11);
 212   3       return back;
 213   3       }
 214   2       }
 215   1       
 216   1        //扫描按键3
 217   1       P1CON=0XD2;
 218   1       if(P12==0)
 219   1       {
 220   2       delay(5);
 221   2       if(P12==0)
 222   2       {
 223   3       while(!P12);
 224   3       return volp;
 225   3       }
 226   2       }
 227   1      
 228   1        //扫描按键4
 229   1       P1CON=0XD3;
 230   1       if(P13==0)
 231   1       {
 232   2       delay(5);
 233   2       if(P13==0)
 234   2       {
 235   3       while(!P13);
 236   3       return vold;
 237   3       }
 238   2       }
 239   1      
 240   1        //扫描按键5
C51 COMPILER V9.00   ZLG7289                                                               11/09/2010 16:31:12 PAGE 5   

 241   1       P1CON=0XD4;
 242   1       if(P14==0)
 243   1       {
 244   2       delay(5);
 245   2       if(P14==0)
 246   2       {
 247   3       while(!P14);
 248   3       if(ps[0])
 249   3       return play;
 250   3       else if(ps[1])
 251   3       return stop;
 252   3       }
 253   2       }
 254   1      return 0;
 255   1      
 256   1      }
 257          
 258          
 259          
 260          
 261          
 262          
 263          
*** WARNING C291 IN LINE 165 OF ZLG7289.C: not every exit path returns a value


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    552    ----
   CONSTANT SIZE    =      3    ----
   XDATA SIZE       =      2      10
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  2 WARNING(S),  0 ERROR(S)

⌨️ 快捷键说明

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