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

📄 hldkzqts.lst

📁 LED照明行业地砖及护栏控制器程序 从现况来看
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V7.06   HLDKZQTS                                                              07/20/2004 13:59:29 PAGE 1   


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

stmt level    source

   1          /*############################################################################
   2          鼎立照明        16级灰度护栏灯控制器程序                                                
   3          创建时间:2004-07-01
   4          硬件资源:
   5                          RAM ADDRESS :0000H---7FFFH
   6                          FLASH   ADDRESS:8000H---8FFFH
   7                          CPLD    ADDRESS:9000H---FFFFH
   8                          RAM     SIZE    :32K   FLASH SIZE:8MBYTE = 4K*512PAGE*4PCS
   9          2004-07-09      :测试程序
  10          */
  11          #include <reg52.h>
  12          #include <intrins.h>
  13          //#include <ctype.h>//字符函数
  14          #include <string.h>//字符串函数
  15          #include <stdio.h>//一般I/O函数
  16          #include <stdlib.h>//标准函数
  17          //#include <math.h>//数学函数
  18          #include <absacc.h>//绝对地址
  19          #include <intrins.h>//内部函数  
  20          #include        <setjmp.h>
  21          #define uchar unsigned char
  22          #define uint unsigned int
  23          #define byte unsigned char
  24          #define word unsigned  
  25          #define bool bit
  26          #define TRUE 1
  27          #define FALSE 0
  28          /*
  29          code uchar demo_tab[]=
  30          {
  31          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0
             -x00,0x00,0x00,
  32          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0
             -x00,0x00,0x00,
  33          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0
             -x00,0x00,0x00,
  34          0x10,0xF8,0x3E,0xF8,0xFC,0xFC,0x3C,0xE7,0x7C,0x3E,0xEE,0xE0,0xEE,0xC7,0x38,0xFC,0x38,0xFC,0x3E,0xE7,0xE7,0
             -xD6,0xE7,0xEE,
  35          0x10,0x44,0x42,0x44,0x42,0x42,0x44,0x42,0x10,0x08,0x44,0x40,0x6C,0x62,0x44,0x42,0x44,0x42,0x42,0x42,0x42,0
             -x92,0x42,0x44,
  36          0x18,0x44,0x42,0x42,0x48,0x48,0x44,0x42,0x10,0x08,0x48,0x40,0x6C,0x62,0x82,0x42,0x82,0x42,0x42,0x42,0x42,0
             -x92,0x24,0x44,
  37          0x28,0x44,0x80,0x42,0x48,0x48,0x80,0x42,0x10,0x08,0x50,0x40,0x6C,0x52,0x82,0x42,0x82,0x42,0x40,0x42,0x44,0
             -x92,0x24,0x28,
  38          0x28,0x78,0x80,0x42,0x78,0x78,0x80,0x42,0x10,0x08,0x70,0x40,0x6C,0x52,0x82,0x42,0x82,0x7C,0x20,0x42,0x24,0
             -x92,0x18,0x28,
  39          0x24,0x44,0x80,0x42,0x48,0x48,0x80,0x7E,0x10,0x08,0x50,0x40,0x54,0x4A,0x82,0x7C,0x82,0x48,0x18,0x42,0x24,0
             -xAA,0x18,0x10,
  40          0x3C,0x42,0x80,0x42,0x48,0x48,0x8E,0x42,0x10,0x08,0x48,0x40,0x54,0x4A,0x82,0x40,0x82,0x48,0x04,0x42,0x28,0
             -xAA,0x18,0x10,
  41          0x44,0x42,0x80,0x42,0x40,0x40,0x84,0x42,0x10,0x08,0x48,0x40,0x54,0x4A,0x82,0x40,0xB2,0x44,0x02,0x42,0x28,0
             -x6C,0x24,0x10,
  42          0x42,0x42,0x42,0x42,0x42,0x40,0x44,0x42,0x10,0x08,0x44,0x40,0x54,0x46,0x82,0x40,0xCA,0x44,0x42,0x42,0x18,0
             -x44,0x24,0x10,
  43          0x42,0x44,0x44,0x44,0x42,0x40,0x44,0x42,0x10,0x08,0x44,0x42,0x54,0x46,0x44,0x40,0x4C,0x42,0x42,0x42,0x10,0
C51 COMPILER V7.06   HLDKZQTS                                                              07/20/2004 13:59:29 PAGE 2   

             -x44,0x42,0x10,
  44          0xE7,0xF8,0x38,0xF8,0xFC,0xE0,0x38,0xE7,0x7C,0x08,0xEE,0xFE,0xD6,0xE2,0x38,0xE0,0x38,0xE3,0x7C,0x3C,0x10,0
             -x44,0xE7,0x38,
  45          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x88,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0
             -x00,0x00,0x00,
  46          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0
             -x00,0x00,0x00,
  47          
  48          };*/
  49          /* 定义定时器T0的时间常数值和方式控制字 */                
  50          #define V_TH0   0x4c                     /* 时间常数高8位 */
  51          #define V_TL0   0x00                     /* 时间常数低8位50ms  12mhz */
  52          #define V_TMOD  0x01                     /* 定时器T0方式控制字 */
  53          
  54          #define  REGL XBYTE[0x9003] //控制寄存器护栏管的长度
  55          #define  FPGH XBYTE[0x9001] //闪存页高位
  56          #define  FPGL XBYTE[0x9002] //闪存页低位
  57          //**********************************************
  58          sbit    senden=P1^5;
  59          
  60          //*************************************************
  61          uchar   setx,sety;                              //显示屏的尺寸设置
  62          uchar   ADD;                                    //地址
  63          uchar   idata send_buf[72];             //接收缓冲区
  64          uchar   pointer,subchk;                 //接收指针 和校验
  65          uchar   paklen;                                 //包长
  66          jmp_buf env;
  67          int retval;
  68          uint    dis_page;                       //当前显示的帧号
  69          sbit    led=P1^7;
  70          uchar   bdata flag;
  71          sbit    frameok=flag^0;                 //rece ok
  72          sbit    color=flag^1;                   //0 sing red color 1 red green color
  73          sbit    rec_sta=flag^2;                 //1 进入接状态,不显示
  74          sbit    rec_end=flag^3;
  75          uint page;
  76          //************************************** 
  77          //清除显存内容立即引出  0000h--03FFH = 0
  78          //**************************************
  79          void cler(void)
  80          {
  81   1      uint i;
  82   1      uchar xdata *s;
  83   1      s=0x000;
  84   1      for(i=0;i<1024;i++)*s++=0;
  85   1      }
  86          //******************************************* 
  87          //从FLASH加载数据到RAM, flash -> ram 000
  88          //入口参数:帧号 取值范围:0--8095
  89          //******************************************
  90          void load_data(uint page)
  91          {
  92   1      uint i;
  93   1      uchar xdata *s;
  94   1      uchar xdata *sp;
  95   1      sp=(page<<10                                                                                              
             -                                                                                                                        
             -                                                                                                                        
             -                                               )|0x8000;
  96   1      FPGH=(page>>2)/256;FPGL=(page>>2)%256;
  97   1      s=0x000;
  98   1      for(i=0;i<4096;i++)*s++=*sp++;
C51 COMPILER V7.06   HLDKZQTS                                                              07/20/2004 13:59:29 PAGE 3   

  99   1      
 100   1      }
 101          /*************************************************
 102          
 103          ************************************************/
 104          void delayms( uchar ticks )
 105          {
 106   1              uint    Count;
 107   1              uchar   Tick;
 108   1              for (Tick=ticks;Tick>0;Tick--)
 109   1              {
 110   2                      for (Count=0;Count<=2000;Count++);
 111   2              }
 112   1      }
 113          /************************************************************************/
 114          /* PROCEDURE:   Erase_One_Sector                                        */
 115          /*                                                                      */
 116          /* This procedure can be used to erase a total of 4096 bytes.           */
 117          /*                                                                      */
 118          /* Input:                                                               */
 119          /*      Dst     DESTINATION address where the erase operation starts    */
 120          /*                                                                      */
 121          /* Output:                                                              */
 122          /*      NONE                                                            */
 123          /************************************************************************/
 124          
 125          void Erase_One_Sector (uint  Sec)
 126          {
 127   1          uchar xdata *Temp;
 128   1              Temp=0x0000;
 129   1              FPGH=(Sec/256)&0x06;FPGL=5;
 130   1              XBYTE[0x8555]=0Xaa;
 131   1              FPGL=2;
 132   1              XBYTE[0x8aaa]=0x55;
 133   1              FPGL=5;
 134   1              XBYTE[0x8555]=0X80;
 135   1              FPGL=5;
 136   1              XBYTE[0x8555]=0Xaa;
 137   1              FPGL=2;
 138   1              XBYTE[0x8aaa]=0X55;
 139   1              FPGH=Sec/256;FPGL=Sec%256;
 140   1              *Temp=0x30;
 141   1          delayms(25);       /* Delay time = Tse                 */
 142   1      }
 143          
 144          /************************************************************************/
 145          /* PROCEDURE:    Check_Toggle_Ready                                     */
 146          /*                                                                      */
 147          /* During the internal program cycle, any consecutive read operation    */
 148          /* on DQ6 will produce alternating 0's and 1's (i.e. toggling between   */
 149          /* 0 and 1). When the program cycle is completed, DQ6 of the data will  */
 150          /* stop toggling. After the DQ6 data bit stops toggling, the device is  */
 151          /* ready for next operation.                                            */
 152          /*                                                                      */
 153          /* Input:                                                               */
 154          /*           Dst        Must already be set-up by the caller            */
 155          /*                                                                      */
 156          /* Output:                                                              */
 157          /*           None                                                       */
 158          /************************************************************************/
 159          
 160          void Check_Toggle_Ready (uchar xdata  *Dst)
C51 COMPILER V7.06   HLDKZQTS                                                              07/20/2004 13:59:29 PAGE 4   

 161          {
 162   1              uchar Loop = TRUE;
 163   1              uchar  PreData;
 164   1              uchar  CurrData;
 165   1              unsigned int TimeOut = 0;
 166   1      
 167   1              PreData = *Dst;
 168   1              PreData = PreData & 0x40;
 169   1              while ((TimeOut< 0xFFFF) && (Loop))
 170   1              {
 171   2                  CurrData = *Dst;
 172   2                  CurrData = CurrData & 0x40;
 173   2                  if (PreData == CurrData)
 174   2                          Loop = FALSE;   /* ready to exit the while loop */
 175   2                  PreData = CurrData;
 176   2                  TimeOut++;
 177   2              }
 178   1      }
 179          /************************************************************************/
 180          /* PROCEDURE:   Program_One_Byte                                        */
 181          /*                                                                      */
 182          /* This procedure can be used to program ONE byte of data to the        */
 183          /* 39VF016.                                                             */
 184          /*                                                                      */
 185          /* NOTE:  It is necessary to first erase the sector containing the      */
 186          /*        byte to be programmed.                                        */
 187          /*                                                                      */
 188          /* Input:                                                               */
 189          /*           Src     The BYTE which will be written to the 39VF016      */
 190          /*           Dst     DESTINATION address which will be written with the */
 191          /*                   data passed in from Src                            */
 192          /*                                                                      */
 193          /* Output:                                                              */
 194          /*           None                                                       */
 195          /************************************************************************/
 196          
 197          void Program_One_Byte (uchar Src, uchar xdata *Dst)
 198          {
 199   1      //      uchar xdata *Temp;
 200   1          uchar xdata *DestBuf;
 201   1          DestBuf = Dst;
 202   1              FPGH=(page/256)&0x06;FPGL=5;
 203   1              XBYTE[0x8555]=0Xaa;
 204   1              FPGL=2;
 205   1              XBYTE[0x8aaa]=0x55;
 206   1              FPGL=5;
 207   1              XBYTE[0x8555]=0Xa0;
 208   1              FPGH=page/256;FPGL=page%256;

⌨️ 快捷键说明

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