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

📄 hldkzqv11.lst

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


C51 COMPILER V7.06, COMPILATION OF MODULE HLDKZQV11
OBJECT MODULE PLACED IN hldkzqv11.OBJ
COMPILER INVOKED BY: d:\Keil\C51\BIN\C51.EXE hldkzqv11.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          #define V_TH0   0xff  /* 时间常数高8位 (65536-500)/256                  */
  29          #define V_TL0   0xff  /* 时间常数低8位 (65536-500)%256   11.0592*/
  30          #define V_TMOD  0x01                     /* 定时器T0方式控制字 */
  31          
  32          /* 定义定时器T0的时间常数值和方式控制字 */                
  33          
  34          #define  REGL XBYTE[0x9003] //控制寄存器护栏管的长度
  35          #define  FPGH XBYTE[0x9001] //闪存页高位
  36          #define  FPGL XBYTE[0x9002] //闪存页低位
  37          //**********************************************
  38          sbit    senden=P3^2;
  39          
  40          sbit    wdgclr=P1^7;
  41          //*************************************************
  42          uchar   zhepe;                                  //帧频
  43          uint   ms;                                              //毫秒定时
  44          uchar   ADD;                                    //地址
  45          uchar   idata send_buf[72];             //接收缓冲区
  46          uchar   pointer,subchk;                 //接收指针 和校验
  47          uchar   paklen;                                 //包长
  48          uint    page_sta,page_end;              //显示的开始帧和结束帧
  49          uint    dis_page;                               //当前显示的帧号
  50          uint    page;                                   //扇区号
  51          uchar   bdata flag;
  52          sbit    frameok=flag^0;                 //rece ok
  53          sbit    color=flag^1;                   //0 sing red color 1 red green color
  54          sbit    rec_sta=flag^2;                 //1 进入接状态,不显示
  55          sbit    rec_end=flag^3;
C51 COMPILER V7.06   HLDKZQV11                                                             08/10/2004 19:20:16 PAGE 2   

  56          sbit    timout=flag^4;
  57          //jmp_buf env;
  58          //int retval;
  59          
  60          //******************************************* 
  61          //从FLASH加载数据到RAM, flash -> ram 000
  62          //入口参数:帧号 取值范围:0--8095
  63          //******************************************
  64          //#pragma NOMODDP2
  65          void load_data(uint page)
  66          {
  67   1      uchar xdata *s;
  68   1      uchar xdata *sp;
  69   1      uchar xdata *rp;
  70   1      sp=((page<<10)&0x0fff)|0x8000;
  71   1      FPGH=(page>>2)/256;FPGL=(page>>2)%256;
  72   1      s=0x000;
  73   1      //for(i=0;i<1024;i++)*s++=*sp++;
  74   1      rp=memcpy(s,sp,1024);
  75   1      }
  76          /*************************************************
  77          
  78          ************************************************/
  79          void delayms( uchar ticks )
  80          {
  81   1              uint    Count;
  82   1              uchar   Tick;
  83   1              for (Tick=ticks;Tick>0;Tick--)
  84   1              {
  85   2                      for (Count=0;Count<=500;Count++);
  86   2              }
  87   1      }
  88          /************************************************************************/
  89          /* PROCEDURE:   Erase_One_Sector                                        */
  90          /*                                                                      */
  91          /* This procedure can be used to erase a total of 4096 bytes.           */
  92          /*                                                                      */
  93          /* Input:                                                               */
  94          /*      Dst     DESTINATION address where the erase operation starts    */
  95          /*                                                                      */
  96          /* Output:                                                              */
  97          /*      NONE                                                            */
  98          /************************************************************************/
  99          
 100          void Erase_One_Sector (uint  Sec)
 101          {
 102   1         // uchar xdata *Temp;
 103   1              //Temp=0x0000;
 104   1              FPGH=0;FPGL=5;
 105   1              XBYTE[0x8555]=0Xaa;
 106   1              FPGL=2;
 107   1              XBYTE[0x8aaa]=0x55;
 108   1              FPGL=5;
 109   1              XBYTE[0x8555]=0X80;
 110   1              FPGL=5;
 111   1              XBYTE[0x8555]=0Xaa;
 112   1              FPGL=2;
 113   1              XBYTE[0x8aaa]=0X55;
 114   1              FPGH=Sec/256;FPGL=Sec%256;
 115   1              XBYTE[0x8000]=0x30;
 116   1          delayms(25);       /* Delay time = Tse                 */
 117   1      }
C51 COMPILER V7.06   HLDKZQV11                                                             08/10/2004 19:20:16 PAGE 3   

 118          
 119          /************************************************************************/
 120          /* PROCEDURE:    Check_Toggle_Ready                                     */
 121          /*                                                                      */
 122          /* During the internal program cycle, any consecutive read operation    */
 123          /* on DQ6 will produce alternating 0's and 1's (i.e. toggling between   */
 124          /* 0 and 1). When the program cycle is completed, DQ6 of the data will  */
 125          /* stop toggling. After the DQ6 data bit stops toggling, the device is  */
 126          /* ready for next operation.                                            */
 127          /*                                                                      */
 128          /* Input:                                                               */
 129          /*           Dst        Must already be set-up by the caller            */
 130          /*                                                                      */
 131          /* Output:                                                              */
 132          /*           None                                                       */
 133          /************************************************************************/
 134          
 135          void Check_Toggle_Ready (uchar xdata  *Dst)
 136          {
 137   1              uchar Loop = TRUE;
 138   1              uchar  PreData;
 139   1              uchar  CurrData;
 140   1              unsigned int TimeOut = 0;
 141   1      
 142   1              PreData = *Dst;
 143   1              PreData = PreData & 0x40;
 144   1              while ((TimeOut< 0xFFFF) && (Loop))
 145   1              {
 146   2                  CurrData = *Dst;
 147   2                  CurrData = CurrData & 0x40;
 148   2                  if (PreData == CurrData)
 149   2                          Loop = FALSE;   /* ready to exit the while loop */
 150   2                  PreData = CurrData;
 151   2                  TimeOut++;
 152   2              }
 153   1      }
 154          /************************************************************************/
 155          /* PROCEDURE:   Program_One_Byte                                        */
 156          /*                                                                      */
 157          /* This procedure can be used to program ONE byte of data to the        */
 158          /* 39VF016.                                                             */
 159          /*                                                                      */
 160          /* NOTE:  It is necessary to first erase the sector containing the      */
 161          /*        byte to be programmed.                                        */
 162          /*                                                                      */
 163          /* Input:                                                               */
 164          /*           Src     The BYTE which will be written to the 39VF016      */
 165          /*           Dst     DESTINATION address which will be written with the */
 166          /*                   data passed in from Src                            */
 167          /*                                                                      */
 168          /* Output:                                                              */
 169          /*           None                                                       */
 170          /************************************************************************/
 171          
 172          void Program_One_Byte (uchar Src, uchar xdata *Dst)
 173          {
 174   1      //      uchar xdata *Temp;
 175   1          uchar xdata *DestBuf;
 176   1          DestBuf = Dst;
 177   1              FPGH=0;FPGL=5;
 178   1              XBYTE[0x8555]=0Xaa;
 179   1              FPGL=2;
C51 COMPILER V7.06   HLDKZQV11                                                             08/10/2004 19:20:16 PAGE 4   

 180   1              XBYTE[0x8aaa]=0x55;
 181   1              FPGL=5;
 182   1              XBYTE[0x8555]=0Xa0;
 183   1              FPGH=page/256;FPGL=page%256;
 184   1              *DestBuf=Src;
 185   1          Check_Toggle_Ready(DestBuf);    /* wait for TOGGLE bit to get ready */
 186   1      }
 187          
 188          
 189          /************************************************************************/
 190          /* PROCEDURE:   Program_One_Sector                                      */
 191          /*                                                                      */
 192          /* This procedure can be used to program a total of 4096 bytes of data  */
 193          /* to the SST39VF016.                                                   */
 194          /*                                                                      */
 195          /* NOTES: 1. It is necessary to first erase the sector before the       */
 196          /*        programming.                                                  */
 197          /*        2. This sample code assumes the destination address passed    */
 198          /*        from the calling function is the starting address of the      */
 199          /*        sector.                                                       */
 200          /*                                                                      */
 201          /* Input:                                                               */
 202          /*           Src     SOURCE address containing the data which will be   */
 203          /*                   written to the 39VF016                             */
 204          /*           Dst     DESTINATION address which will be written with the */
 205          /*                   data passed in from Src                            */
 206          /*                                                                      */
 207          /* Output:                                                              */
 208          /*           None                                                       */
 209          /************************************************************************/
 210          
 211          void Program_One_Sector (uint Dst)
 212          {
 213   1              uchar xdata *SourceBuf;
 214   1              uchar xdata *DestBuf;
 215   1      
 216   1              uint Index;
 217   1                      page=Dst;
 218   1              SourceBuf = 0x1000;
 219   1              DestBuf = 0x8000;
 220   1      
 221   1              Erase_One_Sector(Dst);          /* erase the sector first */
 222   1      
 223   1              for (Index = 0; Index < 4096; Index++)
 224   1                      {
 225   2                              Program_One_Byte( *SourceBuf, DestBuf);
 226   2                              DestBuf++;
 227   2                              SourceBuf++;
 228   2                      }
 229   1      }
 230          
 231          //***********************************************
 232          //                      接收数据
 233          //************************************************
 234          void rece_picture(bit type)
 235          {
 236   1      uchar i;

⌨️ 快捷键说明

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