C51 COMPILER V7.07   E51PRO                                                                10/28/2003 18:27:17 PAGE 1   


C51 COMPILER V7.07, COMPILATION OF MODULE E51PRO
OBJECT MODULE PLACED IN e51pro.OBJ
COMPILER INVOKED BY: f:\winsoft\Keil\C51\BIN\C51.EXE e51pro.c WARNINGLEVEL(1) OPTIMIZE(5,SIZE) REGFILE(.\E51Pro.ORC) BRO
                    -WSE INCDIR(G:\MCU工程\E51Pro\) DEBUG OBJECTEXTEND CODE

stmt level    source

   1          //////////////////////////////////////////////////////////////////////////////////////////////////
   2          //E51Pro.c
   3          //Easy 51Pro编程器主程序，负责通讯，管理编程操作
   4          ///////////////////////////////////////////////////////////////////////////////////////////////////
   5          
   6          #include <E51Pro.h>
   7          
   8          BYTE ComBuf[18];//串口通讯数据缓存，发送和接收都使用
   9          UINT nAddress;//ROM中地址计数
  10          UINT nTimeOut;//超时计数
  11          ProWork pw;//编程器一般操作
  12          
  13          void Delay_us(BYTE nUs)//微秒级延时<255us
  14          {
  15   1              TH0=0;
  16   1              TL0=0;
  17   1              TR0=1;
  18   1              while(TL0<nUs)//利用T0做定时计数器，循环采样，直到达到定时值
  19   1              {
  20   2              }
  21   1              TR0=0;
  22   1      }
  23          
  24          void Delay_ms(UINT nMs)//豪秒级的延时<65535ms
  25          {
  26   1              UINT n=0;
  27   1              TR0=1;
  28   1              while(n<nMs)////利用T0做定时计数器，循环采样，直到达到定时值
  29   1              {
  30   2                      TH0=0;
  31   2                      TL0=20;
  32   2                      while(TH0<4)
  33   2                      {
  34   3                      }
  35   2                      n++;
  36   2              }
  37   1              TR0=0;
  38   1      }
  39           
  40          BOOL WaitComm()//等待上位机的命令,18字节
  41          {
  42   1              BYTE n=0;
  43   1              RI=0;
  44   1              while(!RI){}//等待第一个字节
  45   1              ComBuf[n]=SBUF;
  46   1              RI=0;
  47   1              n++;
  48   1              for(n;n<=17;n++)
  49   1              {
  50   2                      nTimeOut=0;
  51   2                      while(!RI)
  52   2                      {
  53   3                              nTimeOut++;
  54   3                              if(nTimeOut>10000)//后17个字节都有超时限制 
C51 COMPILER V7.07   E51PRO                                                                10/28/2003 18:27:17 PAGE 2   

  55   3                                      return 0;
  56   3                      }
  57   2                      ComBuf[n]=SBUF;
  58   2                      RI=0;
  59   2              }
  60   1              return 1;
  61   1      }
  62          
  63          BOOL WaitResp()//等待上位机回应,1字节,有超时限制 
  64          {
  65   1              nTimeOut=0;
  66   1              RI=0;
  67   1              while(!RI)
  68   1              {
  69   2                      nTimeOut++;
  70   2                      if(nTimeOut>50000) 
  71   2                      {
  72   3                              return 0;
  73   3                      }
  74   2              }
  75   1              RI=0;
  76   1              ComBuf[0]=SBUF;
  77   1              return 1;
  78   1      }
  79          
  80          BOOL WaitData()//写器件时等待上位机数据，18字节，有超时限制 
  81          {
  82   1              BYTE n;
  83   1              RI=0;
  84   1              for(n=0;n<=17;n++)
  85   1              {
  86   2                      nTimeOut=0;
  87   2                      while(!RI)
  88   2                      {
  89   3                              nTimeOut++;
  90   3                              if(nTimeOut>10000)
  91   3                              {
  92   4                                      return 0;
  93   4                              }
  94   3                      }
  95   2                      RI=0;
  96   2                      ComBuf[n]=SBUF;
  97   2              }
  98   1              return 1;
  99   1      }
 100          
 101          void SendData()//发送数据或回应操作完成,18字节
 102          {
 103   1              BYTE n=0;
 104   1              for(n;n<=17;n++)
 105   1              {
 106   2                      TI=0;
 107   2                      SBUF=ComBuf[n];
 108   2                      while(!TI){}
 109   2                      TI=0;
 110   2              }
 111   1      }
 112          
 113          void SendResp()//回应上位机1个字节,在写器件函数中使用
 114          {
 115   1              TI=0;
 116   1              SBUF=ComBuf[0];
C51 COMPILER V7.07   E51PRO                                                                10/28/2003 18:27:17 PAGE 3   

 117   1              while(!TI){}
 118   1              TI=0;
 119   1      }
 120          
 121          void SetVpp5V()//设置Vpp为5v
 122          {
 123   1              P3_4=0;
 124   1              P3_3=0;
 125   1      }
 126          
 127          void SetVpp0V()//设置Vpp为0v
 128          {
 129   1              P3_3=0;
 130   1              P3_4=1;
 131   1      }
 132          
 133          void SetVpp12V()//设置Vpp为12v
 134          {
 135   1              P3_4=0;
 136   1              P3_3=1;
 137   1      }
 138          
 139          void RstPro()//编程器复位
 140          {
 141   1              pw.fpProOver();//直接编程结束
 142   1              SendData();//通知上位机，表示编程器就绪，可以直接用此函数因为协议号（ComBuf[0]）还没被修改，下同
 143   1      }
 144          
 145          void ReadSign()//读特征字
 146          {
 147   1              pw.fpReadSign();
 148   1              SendData();//通知上位机，送出读出器件特征字
 149   1      }
 150          
 151          void Erase()//擦除器件
 152          {
 153   1              pw.fpErase();
 154   1              SendData();//通知上位机，擦除了器件
 155   1      }
 156          
 157          void Write()//写器件
 158          {
 159   1              BYTE n;
 160   1              pw.fpInitPro();//编程前的准备工作
 161   1              SendData();//回应上位机表示进入写器件状态，可以发来数据
 162   1              while(1)
 163   1              {
 164   2                      if(WaitData())//如果等待数据成功
 165   2                      {
 166   3                              if(ComBuf[0]==0x07)//判断是否继续写
 167   3                              {
 168   4                                      for(n=2;n<=17;n++)//ComBuf[2~17]为待写入数据块
 169   4                                      {
 170   5                                              if(!pw.fpWrite(ComBuf[n]))//<<<<<<<<<<<<<<<<<<<调用写该器件一个单元的函数
 171   5                                              {
 172   6                                                      pw.fpProOver();//出错了就结束编程
 173   6                                                      ComBuf[0]=0xff;
 174   6                                                      SendResp();//回应上位机一个字节，表示写数据出错了
 175   6                                                      WaitData();//等待上位机的回应后就结束
 176   6                                                      return; 
 177   6                                              }
 178   5                                              nAddress++;//下一个单元
C51 COMPILER V7.07   E51PRO                                                                10/28/2003 18:27:17 PAGE 4   

 179   5                                      }
 180   4                                      ComBuf[0]=1;//回应上位机一个字节，表示数据块顺利完成，请求继续
 181   4                                      SendResp();
 182   4                              }
 183   3                              else if(ComBuf[0]==0x00)//写器件结束
 184   3                                      break;
 185   3                              else//可能是通讯出错了
 186   3                              {
 187   4                                      pw.fpProOver();
 188   4                                      return;
 189   4                              }
 190   3                      }
 191   2                      else//等待数据失败
 192   2                      {
 193   3                              pw.fpProOver();
 194   3                              return;
 195   3                      }
 196   2              }
 197   1              pw.fpProOver();//编程结束后的工作
 198   1              Delay_ms(50);//延时等待上位机写线程结束
 199   1              ComBuf[0]=0;//通知上位机编程器进入就绪状态
 200   1              SendData();
 201   1      }
 202          
 203          void Read()//读器件
 204          {
 205   1              BYTE n;
 206   1              pw.fpInitPro();//先设置成编程状态
 207   1              SendData();//回应上位机表示进入读状态
 208   1              while(1)
 209   1              {
 210   2                      if(WaitResp())//等待上位机回应1个字节
 211   2                      {
 212   3                              if(ComBuf[0]==0)//ComBuf[0]==0表示读结束
 213   3                              {
 214   4                                      break;
 215   4                              }
 216   3                              else if(ComBuf[0]==0xff)//0xff表示重发
 217   3                              {
 218   4                                      nAddress=nAddress-0x0010;
 219   4                              }
 220   3                              for(n=2;n<=17;n++)//ComBuf[2~17]保存读出的数据块
 221   3                              {
 222   4                                      ComBuf[n]=pw.fpRead();//<<<<<<<<<<<<<<<<<<<调用写该器件一个单元的函数
 223   4                                      nAddress++;//下一个单元
 224   4                              }
 225   3                              ComBuf[0]=6;//向上位机发送读出的数据块
 226   3                              SendData();
 227   3                      }
 228   2                      else
 229   2                              break;//等待回应失败    
 230   2      
 231   2              }
 232   1              pw.fpProOver();//操作结束设置为运行状态
 233   1              ComBuf[0]=0;//通知上位机编程器进入就绪状态
 234   1              SendData();
 235   1      }
 236          
 237          void Lock()//写锁定位
 238          {
 239   1              pw.fpLock();
 240   1              SendData();
C51 COMPILER V7.07   E51PRO                                                                10/28/2003 18:27:17 PAGE 5   

 241   1      }
 242          
 243          ///////////////////////////////////////////////////////////////////////////////////////////////////
 244          //所支持的FID,请在这里继续添加
 245          ///////////////////////////////////////////////////////////////////////////////////////////////////
 246          extern void PreparePro00();//FID=00:AT89C51编程器
 247          extern void PreparePro01();//FID=01:AT89C2051编程器
 248          extern void PreparePro02();//FID=02:AT89S51编程器
 249          
 250          void main()
 251          {
 252   1              SP=0x60;
 253   1              SetVpp5V();//先初始化Vpp为5v
 254   1              SCON=0x00;
 255   1              TCON=0x00;
 256   1              //PCON=0x00;//波特率*2
 257   1              IE=0x00;
 258   1              //TMOD: GATE|C/!T|M1|M0|GATE|C/!T|M1|M0
 259   1              //        0    0   1  0   0    0   0  1
 260   1              TMOD=0x21;//T0用于延时程序
 261   1              TH1=0xff;
 262   1              TL1=0xff;//波特率28800*2,注意PCON
 263   1              //SCON: SM0|SM1|SM2|REN|TB8|RB8|TI|RI
 264   1          //        0   1   0   1   0   0  0  0
 265   1              SCON=0x50;
 266   1              TR1=1;
 267   1              Delay_ms(1000);//延时1秒后编程器自举
 268   1              ComBuf[0]=0;
 269   1              SendData();
 270   1              while(1)//串口通讯采用查询方式
 271   1              {
 272   2                      if(!WaitComm())//如果超时,通讯出错
 273   2                      {
 274   3                              Delay_ms(500);
 275   3                              ComBuf[0]=0;//让编程器复位,使编程器就绪
 276   3                      }
 277   2                      switch(ComBuf[1])//根据FID设置(ProWork)pw中的函数指针
 278   2                      {
 279   3                              case 0://at89c51编程器
 280   3                                      PreparePro00();
 281   3                                      break;
 282   3                              case 1://at89c2051编程器
 283   3                                      PreparePro01();
 284   3                                      break;
 285   3                              case 2://at89s51编程器
 286   3                                      PreparePro02();
 287   3                                      break;
 288   3                              //case 3:支持新器件时，请继续向下添加
 289   3                              //      break;
 290   3                              //case 4:
 291   3                              //      break;
 292   3                              default:
 293   3                                      ComBuf[0]=0xff;
 294   3                                      ComBuf[1]=0xff;//表示无效的操作
 295   3                                      break;
 296   3                      }
 297   2                      switch(ComBuf[0])//根据操作ID跳到不同的操作函数
 298   2                      {
 299   3                              case 0x00:
 300   3                                      RstPro();//编程器复位
 301   3                                      break;
 302   3                              case 0x01:
C51 COMPILER V7.07   E51PRO                                                                10/28/2003 18:27:17 PAGE 6   

 303   3                                      ReadSign();//读特征字
 304   3                                      break;
 305   3                              case 0x02:
 306   3                                      Erase();//擦除器件
 307   3                                      break;
 308   3                              case 0x03:
 309   3                                      Write();//写器件
 310   3                                      break;
 311   3                              case 0x04:
 312   3                                      Read();//读器件
 313   3                                      break;
 314   3                              case 0x05:
 315   3                                      Lock();//写锁定位
 316   3                                      break;
 317   3                              default:
 318   3                                      SendData();
 319   3                                      break;
 320   3                      }
 321   2              }
 322   1      }
 323          
 324          
C51 COMPILER V7.07   E51PRO                                                                10/28/2003 18:27:17 PAGE 7   

ASSEMBLY LISTING OF GENERATED OBJECT CODE


             ; FUNCTION _Delay_us (BEGIN)
                                           ; SOURCE LINE # 13
;---- Variable 'nUs' assigned to Register 'R7' ----
                                           ; SOURCE LINE # 14
                                           ; SOURCE LINE # 15
0000 E4                CLR     A
0001 F58C              MOV     TH0,A
                                           ; SOURCE LINE # 16
0003 F58A              MOV     TL0,A
                                           ; SOURCE LINE # 17
0005 D28C              SETB    TR0
0007         ?C0001:
                                           ; SOURCE LINE # 18
0007 E58A              MOV     A,TL0
0009 C3                CLR     C
000A 9F                SUBB    A,R7
000B 40FA              JC      ?C0001
                                           ; SOURCE LINE # 19
                                           ; SOURCE LINE # 20
000D         ?C0002:
                                           ; SOURCE LINE # 21
000D C28C              CLR     TR0
                                           ; SOURCE LINE # 22
000F 22                RET     
             ; FUNCTION _Delay_us (END)

             ; FUNCTION _Delay_ms (BEGIN)
                                           ; SOURCE LINE # 24
;---- Variable 'nMs' assigned to Register 'R6/R7' ----
                                           ; SOURCE LINE # 25
                                           ; SOURCE LINE # 26
;---- Variable 'n' assigned to Register 'R4/R5' ----
0000 E4                CLR     A
0001 FD                MOV     R5,A
0002 FC                MOV     R4,A
                                           ; SOURCE LINE # 27
0003 D28C              SETB    TR0
0005         ?C0004:
                                           ; SOURCE LINE # 28
0005 C3                CLR     C
0006 ED                MOV     A,R5
0007 9F                SUBB    A,R7
0008 EC                MOV     A,R4
0009 9E                SUBB    A,R6
000A 5014              JNC     ?C0005
                                           ; SOURCE LINE # 29
                                           ; SOURCE LINE # 30
000C E4                CLR     A
000D F58C              MOV     TH0,A
                                           ; SOURCE LINE # 31
000F 758A14            MOV     TL0,#014H
0012         ?C0006:
                                           ; SOURCE LINE # 32
0012 E58C              MOV     A,TH0
0014 C3                CLR     C
0015 9404              SUBB    A,#04H
0017 40F9              JC      ?C0006
                                           ; SOURCE LINE # 33
                                           ; SOURCE LINE # 34
C51 COMPILER V7.07   E51PRO                                                                10/28/2003 18:27:17 PAGE 8   

0019         ?C0007:
                                           ; SOURCE LINE # 35
0019 0D                INC     R5
001A ED                MOV     A,R5
001B 7001              JNZ     ?C0086
001D 0C                INC     R4
001E         ?C0086:
                                           ; SOURCE LINE # 36
001E 80E5              SJMP    ?C0004
0020         ?C0005:
                                           ; SOURCE LINE # 37
0020 C28C              CLR     TR0
                                           ; SOURCE LINE # 38
0022 22                RET     
             ; FUNCTION _Delay_ms (END)

             ; FUNCTION WaitComm (BEGIN)
                                           ; SOURCE LINE # 40
                                           ; SOURCE LINE # 41
                                           ; SOURCE LINE # 42
;---- Variable 'n' assigned to Register 'R7' ----
0000 E4                CLR     A
0001 FF                MOV     R7,A
                                           ; SOURCE LINE # 43
0002 C298              CLR     RI
0004         ?C0009:
                                           ; SOURCE LINE # 44
0004 3098FD            JNB     RI,?C0009
0007         ?C0010:
                                           ; SOURCE LINE # 45
0007 7400        R     MOV     A,#LOW ComBuf
0009 2F                ADD     A,R7
000A F8                MOV     R0,A
000B A699              MOV     @R0,SBUF
                                           ; SOURCE LINE # 46
000D C298              CLR     RI
                                           ; SOURCE LINE # 47
000F 0F                INC     R7
                                           ; SOURCE LINE # 48
0010         ?C0011:
0010 EF                MOV     A,R7
0011 D3                SETB    C
0012 9411              SUBB    A,#011H
0014 5025              JNC     ?C0012
                                           ; SOURCE LINE # 49
                                           ; SOURCE LINE # 50
0016 E4                CLR     A
0017 F500        R     MOV     nTimeOut,A
0019 F500        R     MOV     nTimeOut+01H,A
001B         ?C0014:
                                           ; SOURCE LINE # 51
001B 209812            JB      RI,?C0015
                                           ; SOURCE LINE # 52
                                           ; SOURCE LINE # 53
001E 0500        R     INC     nTimeOut+01H
0020 E500        R     MOV     A,nTimeOut+01H
0022 7002              JNZ     ?C0087
0024 0500        R     INC     nTimeOut
0026         ?C0087:
                                           ; SOURCE LINE # 54
0026 D3                SETB    C
0027 9410              SUBB    A,#010H
C51 COMPILER V7.07   E51PRO                                                                10/28/2003 18:27:17 PAGE 9   

0029 E500        R     MOV     A,nTimeOut
002B 9427              SUBB    A,#027H
002D 40EC              JC      ?C0014
                                           ; SOURCE LINE # 55
002F 22                RET     
                                           ; SOURCE LINE # 56
0030         ?C0015:
                                           ; SOURCE LINE # 57
0030 7400        R     MOV     A,#LOW ComBuf
0032 2F                ADD     A,R7
0033 F8                MOV     R0,A
0034 A699              MOV     @R0,SBUF
                                           ; SOURCE LINE # 58
0036 C298              CLR     RI
                                           ; SOURCE LINE # 59
0038 0F                INC     R7
0039 80D5              SJMP    ?C0011
003B         ?C0012:
                                           ; SOURCE LINE # 60
003B D3                SETB    C
                                           ; SOURCE LINE # 61
003C         ?C0017:
003C 22                RET     
             ; FUNCTION WaitComm (END)

             ; FUNCTION WaitResp (BEGIN)
                                           ; SOURCE LINE # 63
                                           ; SOURCE LINE # 64
                                           ; SOURCE LINE # 65
0000 E4                CLR     A
0001 F500        R     MOV     nTimeOut,A
0003 F500        R     MOV     nTimeOut+01H,A
                                           ; SOURCE LINE # 66
0005 C298              CLR     RI
0007         ?C0018:
                                           ; SOURCE LINE # 67
0007 20981C            JB      RI,?C0019
                                           ; SOURCE LINE # 68
                                           ; SOURCE LINE # 69
000A 0500        R     INC     nTimeOut+01H
000C E500        R     MOV     A,nTimeOut+01H
000E 7002              JNZ     ?C0088
0010 0500        R     INC     nTimeOut
0012         ?C0088:
                                           ; SOURCE LINE # 70
0012 AE00        R     MOV     R6,nTimeOut
0014 FF                MOV     R7,A
0015 E4                CLR     A
0016 FC                MOV     R4,A
0017 FD                MOV     R5,A
0018 7B50              MOV     R3,#050H
001A 7AC3              MOV     R2,#0C3H
001C F9                MOV     R1,A
001D F8                MOV     R0,A
001E C3                CLR     C
001F 120000      E     LCALL   ?C?SLCMP
0022 50E3              JNC     ?C0018
                                           ; SOURCE LINE # 71
                                           ; SOURCE LINE # 72
0024 C3                CLR     C
0025 22                RET     
                                           ; SOURCE LINE # 73
C51 COMPILER V7.07   E51PRO                                                                10/28/2003 18:27:17 PAGE 10  

                                           ; SOURCE LINE # 74
0026         ?C0019:
                                           ; SOURCE LINE # 75
0026 C298              CLR     RI
                                           ; SOURCE LINE # 76
0028 859900      R     MOV     ComBuf,SBUF
                                           ; SOURCE LINE # 77
002B D3                SETB    C
                                           ; SOURCE LINE # 78
002C         ?C0021:
002C 22                RET     
             ; FUNCTION WaitResp (END)

             ; FUNCTION WaitData (BEGIN)
                                           ; SOURCE LINE # 80
                                           ; SOURCE LINE # 81
                                           ; SOURCE LINE # 83
0000 C298              CLR     RI
                                           ; SOURCE LINE # 84
;---- Variable 'n' assigned to Register 'R7' ----
0002 E4                CLR     A
0003 FF                MOV     R7,A
0004         ?C0022:
0004 EF                MOV     A,R7
0005 D3                SETB    C
0006 9411              SUBB    A,#011H
0008 5025              JNC     ?C0023
                                           ; SOURCE LINE # 85
                                           ; SOURCE LINE # 86
000A E4                CLR     A
000B F500        R     MOV     nTimeOut,A
000D F500        R     MOV     nTimeOut+01H,A
000F         ?C0025:
                                           ; SOURCE LINE # 87
000F 209812            JB      RI,?C0026
                                           ; SOURCE LINE # 88
                                           ; SOURCE LINE # 89
0012 0500        R     INC     nTimeOut+01H
0014 E500        R     MOV     A,nTimeOut+01H
0016 7002              JNZ     ?C0089
0018 0500        R     INC     nTimeOut
001A         ?C0089:
                                           ; SOURCE LINE # 90
001A D3                SETB    C
001B 9410              SUBB    A,#010H
001D E500        R     MOV     A,nTimeOut
001F 9427              SUBB    A,#027H
0021 40EC              JC      ?C0025
                                           ; SOURCE LINE # 91
                                           ; SOURCE LINE # 92
0023 22                RET     
                                           ; SOURCE LINE # 93
                                           ; SOURCE LINE # 94
0024         ?C0026:
                                           ; SOURCE LINE # 95
0024 C298              CLR     RI
                                           ; SOURCE LINE # 96
0026 7400        R     MOV     A,#LOW ComBuf
0028 2F                ADD     A,R7
0029 F8                MOV     R0,A
002A A699              MOV     @R0,SBUF
                                           ; SOURCE LINE # 97
C51 COMPILER V7.07   E51PRO                                                                10/28/2003 18:27:17 PAGE 11  

002C 0F                INC     R7
002D 80D5              SJMP    ?C0022
002F         ?C0023:
                                           ; SOURCE LINE # 98
002F D3                SETB    C
                                           ; SOURCE LINE # 99
0030         ?C0028:
0030 22                RET     
             ; FUNCTION WaitData (END)

             ; FUNCTION SendData (BEGIN)
                                           ; SOURCE LINE # 101
                                           ; SOURCE LINE # 102
                                           ; SOURCE LINE # 103
;---- Variable 'n' assigned to Register 'R7' ----
0000 E4                CLR     A
0001 FF                MOV     R7,A
                                           ; SOURCE LINE # 104
0002         ?C0029:
0002 EF                MOV     A,R7
0003 D3                SETB    C
0004 9411              SUBB    A,#011H
0006 5011              JNC     ?C0034
                                           ; SOURCE LINE # 105
                                           ; SOURCE LINE # 106
0008 C299              CLR     TI
                                           ; SOURCE LINE # 107
000A 7400        R     MOV     A,#LOW ComBuf
000C 2F                ADD     A,R7
000D F8                MOV     R0,A
000E E6                MOV     A,@R0
000F F599              MOV     SBUF,A
0011         ?C0032:
                                           ; SOURCE LINE # 108
0011 3099FD            JNB     TI,?C0032
0014         ?C0033:
                                           ; SOURCE LINE # 109
0014 C299              CLR     TI
                                           ; SOURCE LINE # 110
0016 0F                INC     R7
0017 80E9              SJMP    ?C0029
                                           ; SOURCE LINE # 111
0019         ?C0034:
0019 22                RET     
             ; FUNCTION SendData (END)

             ; FUNCTION SendResp (BEGIN)
                                           ; SOURCE LINE # 113
                                           ; SOURCE LINE # 114
                                           ; SOURCE LINE # 115
0000 C299              CLR     TI
                                           ; SOURCE LINE # 116
0002 850099      R     MOV     SBUF,ComBuf
0005         ?C0035:
                                           ; SOURCE LINE # 117
0005 3099FD            JNB     TI,?C0035
0008         ?C0036:
                                           ; SOURCE LINE # 118
0008 C299              CLR     TI
                                           ; SOURCE LINE # 119
000A 22                RET     
             ; FUNCTION SendResp (END)
C51 COMPILER V7.07   E51PRO                                                                10/28/2003 18:27:17 PAGE 12  


             ; FUNCTION SetVpp5V (BEGIN)
                                           ; SOURCE LINE # 121
                                           ; SOURCE LINE # 122
                                           ; SOURCE LINE # 123
0000 C2B4              CLR     P3_4
                                           ; SOURCE LINE # 124
0002 C2B3              CLR     P3_3
                                           ; SOURCE LINE # 125
0004 22                RET     
             ; FUNCTION SetVpp5V (END)

             ; FUNCTION SetVpp0V (BEGIN)
                                           ; SOURCE LINE # 127
                                           ; SOURCE LINE # 128
                                           ; SOURCE LINE # 129
0000 C2B3              CLR     P3_3
                                           ; SOURCE LINE # 130
0002 D2B4              SETB    P3_4
                                           ; SOURCE LINE # 131
0004 22                RET     
             ; FUNCTION SetVpp0V (END)

             ; FUNCTION SetVpp12V (BEGIN)
                                           ; SOURCE LINE # 133
                                           ; SOURCE LINE # 134
                                           ; SOURCE LINE # 135
0000 C2B4              CLR     P3_4
                                           ; SOURCE LINE # 136
0002 D2B3              SETB    P3_3
                                           ; SOURCE LINE # 137
0004 22                RET     
             ; FUNCTION SetVpp12V (END)

             ; FUNCTION RstPro (BEGIN)
                                           ; SOURCE LINE # 139
                                           ; SOURCE LINE # 140
                                           ; SOURCE LINE # 141
0000 AA00        R     MOV     R2,pw+013H
0002 A900        R     MOV     R1,pw+014H
0004 120000      E     LCALL   ?C?ICALL
                                           ; SOURCE LINE # 142
0007 120000      R     LCALL   SendData
                                           ; SOURCE LINE # 143
000A 22                RET     
             ; FUNCTION RstPro (END)

             ; FUNCTION ReadSign (BEGIN)
                                           ; SOURCE LINE # 145
                                           ; SOURCE LINE # 146
                                           ; SOURCE LINE # 147
0000 AA00        R     MOV     R2,pw+04H
0002 A900        R     MOV     R1,pw+05H
0004 120000      E     LCALL   ?C?ICALL
                                           ; SOURCE LINE # 148
0007 120000      R     LCALL   SendData
                                           ; SOURCE LINE # 149
000A 22                RET     
             ; FUNCTION ReadSign (END)

             ; FUNCTION Erase (BEGIN)
                                           ; SOURCE LINE # 151
C51 COMPILER V7.07   E51PRO                                                                10/28/2003 18:27:17 PAGE 13  

                                           ; SOURCE LINE # 152
                                           ; SOURCE LINE # 153
0000 AA00        R     MOV     R2,pw+07H
0002 A900        R     MOV     R1,pw+08H
0004 120000      E     LCALL   ?C?ICALL
                                           ; SOURCE LINE # 154
0007 120000      R     LCALL   SendData
                                           ; SOURCE LINE # 155
000A 22                RET     
             ; FUNCTION Erase (END)

             ; FUNCTION Write (BEGIN)
                                           ; SOURCE LINE # 157
                                           ; SOURCE LINE # 158
                                           ; SOURCE LINE # 160
0000 AA00        R     MOV     R2,pw+01H
0002 A900        R     MOV     R1,pw+02H
0004 120000      E     LCALL   ?C?ICALL
                                           ; SOURCE LINE # 161
0007 120000      R     LCALL   SendData
000A         ?C0044:
                                           ; SOURCE LINE # 162
                                           ; SOURCE LINE # 163
                                           ; SOURCE LINE # 164
000A 120000      R     LCALL   WaitData
000D 5053              JNC     ?C0046
                                           ; SOURCE LINE # 165
                                           ; SOURCE LINE # 166
000F E500        R     MOV     A,ComBuf
0011 6407              XRL     A,#07H
0013 7041              JNZ     ?C0047
                                           ; SOURCE LINE # 167
                                           ; SOURCE LINE # 168
0015 750002      R     MOV     n,#02H
0018         ?C0048:
0018 E500        R     MOV     A,n
001A D3                SETB    C
001B 9411              SUBB    A,#011H
001D 502F              JNC     ?C0049
                                           ; SOURCE LINE # 169
                                           ; SOURCE LINE # 170
001F 7400        R     MOV     A,#LOW ComBuf
0021 2500        R     ADD     A,n
0023 F8                MOV     R0,A
0024 E6                MOV     A,@R0
0025 FF                MOV     R7,A
0026 850082      R     MOV     DPL,pw+0BH
0029 850083      R     MOV     DPH,pw+0AH
002C 120000      E     LCALL   ?C?ICALL2
002F 4011              JC      ?C0051
                                           ; SOURCE LINE # 171
                                           ; SOURCE LINE # 172
0031 AA00        R     MOV     R2,pw+013H
0033 A900        R     MOV     R1,pw+014H
0035 120000      E     LCALL   ?C?ICALL
                                           ; SOURCE LINE # 173
0038 7500FF      R     MOV     ComBuf,#0FFH
                                           ; SOURCE LINE # 174
003B 120000      R     LCALL   SendResp
                                           ; SOURCE LINE # 175
003E 120000      R     LCALL   WaitData
0041 22                RET     
C51 COMPILER V7.07   E51PRO                                                                10/28/2003 18:27:17 PAGE 14  

                                           ; SOURCE LINE # 177
0042         ?C0051:
                                           ; SOURCE LINE # 178
0042 0500        R     INC     nAddress+01H
0044 E500        R     MOV     A,nAddress+01H
0046 7002              JNZ     ?C0090
0048 0500        R     INC     nAddress
004A         ?C0090:
                                           ; SOURCE LINE # 179
004A 0500        R     INC     n
004C 80CA              SJMP    ?C0048
004E         ?C0049:
                                           ; SOURCE LINE # 180
004E 750001      R     MOV     ComBuf,#01H
                                           ; SOURCE LINE # 181
0051 120000      R     LCALL   SendResp
                                           ; SOURCE LINE # 182
0054 80B4              SJMP    ?C0044
0056         ?C0047:
                                           ; SOURCE LINE # 183
0056 E500        R     MOV     A,ComBuf
0058 6010              JZ      ?C0045
                                           ; SOURCE LINE # 184
005A         ?C0054:
                                           ; SOURCE LINE # 186
                                           ; SOURCE LINE # 187
005A AA00        R     MOV     R2,pw+013H
005C A900        R     MOV     R1,pw+014H
005E 120000      E     LCALL   ?C?ICALL
0061 22                RET     
                                           ; SOURCE LINE # 189
                                           ; SOURCE LINE # 190
0062         ?C0046:
                                           ; SOURCE LINE # 192
                                           ; SOURCE LINE # 193
0062 AA00        R     MOV     R2,pw+013H
0064 A900        R     MOV     R1,pw+014H
0066 120000      E     LCALL   ?C?ICALL
0069 22                RET     
                                           ; SOURCE LINE # 195
                                           ; SOURCE LINE # 196
006A         ?C0045:
                                           ; SOURCE LINE # 197
006A AA00        R     MOV     R2,pw+013H
006C A900        R     MOV     R1,pw+014H
006E 120000      E     LCALL   ?C?ICALL
                                           ; SOURCE LINE # 198
0071 7F32              MOV     R7,#032H
0073 7E00              MOV     R6,#00H
0075 120000      R     LCALL   _Delay_ms
                                           ; SOURCE LINE # 199
0078 E4                CLR     A
0079 F500        R     MOV     ComBuf,A
                                           ; SOURCE LINE # 200
007B 120000      R     LCALL   SendData
                                           ; SOURCE LINE # 201
007E         ?C0052:
007E 22                RET     
             ; FUNCTION Write (END)

             ; FUNCTION Read (BEGIN)
                                           ; SOURCE LINE # 203
C51 COMPILER V7.07   E51PRO                                                                10/28/2003 18:27:17 PAGE 15  

                                           ; SOURCE LINE # 204
                                           ; SOURCE LINE # 206
0000 AA00        R     MOV     R2,pw+01H
0002 A900        R     MOV     R1,pw+02H
0004 120000      E     LCALL   ?C?ICALL
                                           ; SOURCE LINE # 207
0007 120000      R     LCALL   SendData
000A         ?C0057:
                                           ; SOURCE LINE # 208
                                           ; SOURCE LINE # 209
                                           ; SOURCE LINE # 210
000A 120000      R     LCALL   WaitResp
000D 5041              JNC     ?C0058
                                           ; SOURCE LINE # 211
                                           ; SOURCE LINE # 212
000F E500        R     MOV     A,ComBuf
0011 603D              JZ      ?C0058
                                           ; SOURCE LINE # 213
                                           ; SOURCE LINE # 214
                                           ; SOURCE LINE # 215
0013         ?C0060:
                                           ; SOURCE LINE # 216
0013 E500        R     MOV     A,ComBuf
0015 B4FF0C            CJNE    A,#0FFH,?C0061
                                           ; SOURCE LINE # 217
                                           ; SOURCE LINE # 218
0018 74F0              MOV     A,#0F0H
001A 2500        R     ADD     A,nAddress+01H
001C F500        R     MOV     nAddress+01H,A
001E 74FF              MOV     A,#0FFH
0020 3500        R     ADDC    A,nAddress
0022 F500        R     MOV     nAddress,A
                                           ; SOURCE LINE # 219
0024         ?C0061:
                                           ; SOURCE LINE # 220
0024 750002      R     MOV     n,#02H
0027         ?C0063:
0027 E500        R     MOV     A,n
0029 D3                SETB    C
002A 9411              SUBB    A,#011H
002C 501A              JNC     ?C0064
                                           ; SOURCE LINE # 221
                                           ; SOURCE LINE # 222
002E AA00        R     MOV     R2,pw+0DH
0030 A900        R     MOV     R1,pw+0EH
0032 120000      E     LCALL   ?C?ICALL
0035 7400        R     MOV     A,#LOW ComBuf
0037 2500        R     ADD     A,n
0039 F8                MOV     R0,A
003A A607              MOV     @R0,AR7
                                           ; SOURCE LINE # 223
003C 0500        R     INC     nAddress+01H
003E E500        R     MOV     A,nAddress+01H
0040 7002              JNZ     ?C0091
0042 0500        R     INC     nAddress
0044         ?C0091:
                                           ; SOURCE LINE # 224
0044 0500        R     INC     n
0046 80DF              SJMP    ?C0063
0048         ?C0064:
                                           ; SOURCE LINE # 225
0048 750006      R     MOV     ComBuf,#06H
C51 COMPILER V7.07   E51PRO                                                                10/28/2003 18:27:17 PAGE 16  

                                           ; SOURCE LINE # 226
004B 120000      R     LCALL   SendData
                                           ; SOURCE LINE # 227
004E 80BA              SJMP    ?C0057
                                           ; SOURCE LINE # 229
                                           ; SOURCE LINE # 231
0050         ?C0058:
                                           ; SOURCE LINE # 232
0050 AA00        R     MOV     R2,pw+013H
0052 A900        R     MOV     R1,pw+014H
0054 120000      E     LCALL   ?C?ICALL
                                           ; SOURCE LINE # 233
0057 E4                CLR     A
0058 F500        R     MOV     ComBuf,A
                                           ; SOURCE LINE # 234
005A 120000      R     LCALL   SendData
                                           ; SOURCE LINE # 235
005D 22                RET     
             ; FUNCTION Read (END)

             ; FUNCTION Lock (BEGIN)
                                           ; SOURCE LINE # 237
                                           ; SOURCE LINE # 238
                                           ; SOURCE LINE # 239
0000 AA00        R     MOV     R2,pw+010H
0002 A900        R     MOV     R1,pw+011H
0004 120000      E     LCALL   ?C?ICALL
                                           ; SOURCE LINE # 240
0007 120000      R     LCALL   SendData
                                           ; SOURCE LINE # 241
000A 22                RET     
             ; FUNCTION Lock (END)

             ; FUNCTION main (BEGIN)
                                           ; SOURCE LINE # 250
                                           ; SOURCE LINE # 251
                                           ; SOURCE LINE # 252
0000 758160            MOV     SP,#060H
                                           ; SOURCE LINE # 253
0003 120000      R     LCALL   SetVpp5V
                                           ; SOURCE LINE # 254
0006 E4                CLR     A
0007 F598              MOV     SCON,A
                                           ; SOURCE LINE # 255
0009 F588              MOV     TCON,A
                                           ; SOURCE LINE # 257
000B F5A8              MOV     IE,A
                                           ; SOURCE LINE # 260
000D 758921            MOV     TMOD,#021H
                                           ; SOURCE LINE # 261
0010 758DFF            MOV     TH1,#0FFH
                                           ; SOURCE LINE # 262
0013 758BFF            MOV     TL1,#0FFH
                                           ; SOURCE LINE # 265
0016 759850            MOV     SCON,#050H
                                           ; SOURCE LINE # 266
0019 D28E              SETB    TR1
                                           ; SOURCE LINE # 267
001B 7FE8              MOV     R7,#0E8H
001D 7E03              MOV     R6,#03H
001F 120000      R     LCALL   _Delay_ms
                                           ; SOURCE LINE # 268
C51 COMPILER V7.07   E51PRO                                                                10/28/2003 18:27:17 PAGE 17  

0022 E4                CLR     A
0023 F500        R     MOV     ComBuf,A
                                           ; SOURCE LINE # 269
0025 120000      R     LCALL   SendData
0028         ?C0069:
                                           ; SOURCE LINE # 270
                                           ; SOURCE LINE # 271
                                           ; SOURCE LINE # 272
0028 120000      R     LCALL   WaitComm
002B 400A              JC      ?C0071
                                           ; SOURCE LINE # 273
                                           ; SOURCE LINE # 274
002D 7FF4              MOV     R7,#0F4H
002F 7E01              MOV     R6,#01H
0031 120000      R     LCALL   _Delay_ms
                                           ; SOURCE LINE # 275
0034 E4                CLR     A
0035 F500        R     MOV     ComBuf,A
                                           ; SOURCE LINE # 276
0037         ?C0071:
                                           ; SOURCE LINE # 277
0037 E500        R     MOV     A,ComBuf+01H
0039 14                DEC     A
003A 600C              JZ      ?C0074
003C 14                DEC     A
003D 600E              JZ      ?C0075
003F 2402              ADD     A,#02H
0041 700F              JNZ     ?C0076
                                           ; SOURCE LINE # 278
                                           ; SOURCE LINE # 279
0043         ?C0073:
                                           ; SOURCE LINE # 280
0043 120000      E     LCALL   PreparePro00
                                           ; SOURCE LINE # 281
0046 8010              SJMP    ?C0072
                                           ; SOURCE LINE # 282
0048         ?C0074:
                                           ; SOURCE LINE # 283
0048 120000      E     LCALL   PreparePro01
                                           ; SOURCE LINE # 284
004B 800B              SJMP    ?C0072
                                           ; SOURCE LINE # 285
004D         ?C0075:
                                           ; SOURCE LINE # 286
004D 120000      E     LCALL   PreparePro02
                                           ; SOURCE LINE # 287
0050 8006              SJMP    ?C0072
                                           ; SOURCE LINE # 292
0052         ?C0076:
                                           ; SOURCE LINE # 293
0052 7500FF      R     MOV     ComBuf,#0FFH
                                           ; SOURCE LINE # 294
0055 7500FF      R     MOV     ComBuf+01H,#0FFH
                                           ; SOURCE LINE # 295
                                           ; SOURCE LINE # 296
0058         ?C0072:
                                           ; SOURCE LINE # 297
0058 E500        R     MOV     A,ComBuf
005A 14                DEC     A
005B 6015              JZ      ?C0079
005D 14                DEC     A
005E 6017              JZ      ?C0080
C51 COMPILER V7.07   E51PRO                                                                10/28/2003 18:27:17 PAGE 18  

0060 14                DEC     A
0061 6019              JZ      ?C0081
0063 14                DEC     A
0064 601B              JZ      ?C0082
0066 14                DEC     A
0067 601D              JZ      ?C0083
0069 2405              ADD     A,#05H
006B 701E              JNZ     ?C0084
                                           ; SOURCE LINE # 298
                                           ; SOURCE LINE # 299
006D         ?C0078:
                                           ; SOURCE LINE # 300
006D 120000      R     LCALL   RstPro
                                           ; SOURCE LINE # 301
0070 80B6              SJMP    ?C0069
                                           ; SOURCE LINE # 302
0072         ?C0079:
                                           ; SOURCE LINE # 303
0072 120000      R     LCALL   ReadSign
                                           ; SOURCE LINE # 304
0075 80B1              SJMP    ?C0069
                                           ; SOURCE LINE # 305
0077         ?C0080:
                                           ; SOURCE LINE # 306
0077 120000      R     LCALL   Erase
                                           ; SOURCE LINE # 307
007A 80AC              SJMP    ?C0069
                                           ; SOURCE LINE # 308
007C         ?C0081:
                                           ; SOURCE LINE # 309
007C 120000      R     LCALL   Write
                                           ; SOURCE LINE # 310
007F 80A7              SJMP    ?C0069
                                           ; SOURCE LINE # 311
0081         ?C0082:
                                           ; SOURCE LINE # 312
0081 120000      R     LCALL   Read
                                           ; SOURCE LINE # 313
0084 80A2              SJMP    ?C0069
                                           ; SOURCE LINE # 314
0086         ?C0083:
                                           ; SOURCE LINE # 315
0086 120000      R     LCALL   Lock
                                           ; SOURCE LINE # 316
0089 809D              SJMP    ?C0069
                                           ; SOURCE LINE # 317
008B         ?C0084:
                                           ; SOURCE LINE # 318
008B 120000      R     LCALL   SendData
                                           ; SOURCE LINE # 319
008E 8098              SJMP    ?C0069
0090 22                RET     
             ; FUNCTION main (END)



MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    668    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     43       2
C51 COMPILER V7.07   E51PRO                                                                10/28/2003 18:27:17 PAGE 19  

   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


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