vf2000.lst

来自「安防产品源程序 包括液晶芯片, c51单片机,通讯等 程序」· LST 代码 · 共 548 行 · 第 1/2 页

LST
548
字号
C51 COMPILER V3.20,  SN-50203013  VF2000                                                   03/14/07  15:02:59  PAGE 1   


DOS C51 COMPILER V3.20, COMPILATION OF MODULE VF2000
OBJECT MODULE PLACED IN VF2000.OBJ
COMPILER INVOKED BY: D:\COMP51\BIN\C51.EXE VF2000.C DB OE SMALL ROM(LARGE) 

stmt level    source

   1          #define uchar unsigned char
   2          #define uint unsigned int
   3          #define ulong unsigned long
   4          #define nop _nop_()
   5          #pragma ROM(LARGE)
   6          #pragma RB(0)
   7          #pragma ot(5,SIZE)
   8          
   9          #include<reg52.h>
  10          #include<pub2000.h>
  11          #include<absacc.h>
  12          #include<intrins.h>
  13          #include <24c256h.h>
  14          #include <pcf8563.h>
  15          
  16          #include <EMrfc.h>
  17          
  18          
  19          uint data RecordNum;
  20          bit CommMark=0;
  21          uint MaxRecordNum;
  22          
  23          void int0Route() interrupt 0 using 1
  24          {
  25   1         CommMark=1;
  26   1         EX0=0;
  27   1      }
  28          
  29          uchar TT1;
  30          void timer0() interrupt 1 using 2 // 50ms interrupt
  31          {				  
  32   1        
  33   1        TH0=0x4c;TL0=0;
  34   1        TT1++;
  35   1      }
  36          
  37          void delayN50ms(uchar t)/*延时n个50ms IDLE模式下*/
  38          {
  39   1         TT1=0;  
  40   1         TH0=0x4c;TL0=0x00; TF0=0; // 50*t ms 
  41   1         TR0=1; ET0=1;
  42   1         while ( TT1<t ) PCON=PCON|0x1; // IDLE MODE
  43   1         ET0=0;
  44   1      }
  45          
  46          void shake()
  47          {
  48   1         Led=0;
  49   1         DS1=0; 
  50   1         delayN50ms(5);
  51   1         DS1=1;
  52   1         Led=1;
  53   1      }
  54          
  55          
C51 COMPILER V3.20,  SN-50203013  VF2000                                                   03/14/07  15:02:59  PAGE 2   

  56          void setAlarm()
  57          {
  58   1         uchar times;
  59   1         uchar hh,mm;
  60   1      
  61   1         /*要求报警时间严格按照时间顺序排列,否则可能无效。不用的报警时间中的小时字节存为0xff*/
  62   1         getClock();
  63   1         for ( times=0;times<14;times++ )
  64   1            {
  65   2            hh=rd24c256(9+times*2); mm=rd24c256(10+times*2);
  66   2            if ( hh!=0xff ) 
  67   2               {
  68   3               if ( ( (hh==Clock.Hour) && (mm>Clock.Min)  ) || (hh>Clock.Hour) )
  69   3                  { setAlarmMMHH(mm,hh); break; }
  70   3               else;   
  71   3               }
  72   2            else if (times!=0 ) 
  73   2               {
  74   3               hh=rd24c256(9); mm=rd24c256(10);
  75   3               setAlarmMMHH(mm,hh); break; 
  76   3               }   
  77   2            else clrAlarm();   
  78   2            }
  79   1      }
  80          
  81          void powerDown()
  82          {
  83   1         setAlarm();
  84   1         Led=1;
  85   1         Power=1;
  86   1         SHD=1;
  87   1         PCON=0X2;
  88   1      }
  89          
  90          void test()/*测试存储器是24c256(=0)还是24c512(=1)*/
  91          {
  92   1         uchar temp1,temp2;
  93   1      
  94   1         temp1=rd24c256(0x7fff);
  95   1         temp2=rd24c256(0xffff);
  96   1         
  97   1         wr24c256(0x7fff,0x55);
  98   1         wr24c256(0xffff,0xaa);
  99   1         
 100   1         if(rd24c256(0x7fff)==0xaa) wr24c256(0x25,0);
 101   1         else wr24c256(0x25,1);
 102   1         
 103   1         wr24c256(0x7fff,temp1);
 104   1         wr24c256(0xffff,temp2);
 105   1      }
 106          
 107          /******************通讯部分***********************/
 108          uchar idata recbuf[16];
 109          uchar data RecLen;
 110          
 111          void comm() interrupt 4 using 3
 112          {
 113   1         ES=0;
 114   1      }
 115          void initComm()
 116             {
 117   1         RecLen=0;
C51 COMPILER V3.20,  SN-50203013  VF2000                                                   03/14/07  15:02:59  PAGE 3   

 118   1         TMOD = 0x21;
 119   1         PCON = PCON|0x80; /*串行口的波特率加倍位*/
 120   1         TH1 = 0xff;       /*11.0592串行口的波特率为57600bps,8BIT*/
 121   1         TL1 = 0xff;
 122   1         SCON = 0x50;
 123   1         TR1 = 1;
 124   1         }
 125             
 126          void sendChar(uchar tt)
 127          {
 128   1         uchar i;
 129   1         
 130   1         REN=0;
 131   1         SBUF=tt; 
 132   1         ES=1;
 133   1         while (!TI) PCON = PCON|0x01; // IDLE MODE 
 134   1         TI=0;
 135   1         for(i=0;i<2;i++);
 136   1         REN=1;
 137   1      }
 138          void sendClock()
 139          {
 140   1         uchar check_byte;
 141   1        
 142   1         getClock();
 143   1        
 144   1         check_byte = Clock.Year; 
 145   1         check_byte +=Clock.MonthCentury;
 146   1         check_byte +=Clock.Day;
 147   1         check_byte +=Clock.Hour;
 148   1         check_byte +=Clock.Min;
 149   1         check_byte +=Clock.Sec;
 150   1         check_byte=0xff-check_byte;
 151   1         
 152   1         sendChar(Clock.Year);
 153   1         sendChar(Clock.MonthCentury);
 154   1         sendChar(Clock.Day);
 155   1         sendChar(Clock.Hour);
 156   1         sendChar(Clock.Min);
 157   1         sendChar(Clock.Sec);
 158   1         sendChar(check_byte);
 159   1      }
 160          
 161          void pcSetClock()
 162          {
 163   1         Led=0;
 164   1         sendChar(0);/*返回确认消息*/
 165   1         
 166   1         Clock.Sec=recbuf[8];
 167   1         Clock.Min=recbuf[7];
 168   1         Clock.Hour=recbuf[6];
 169   1         Clock.Day=recbuf[5];
 170   1         Clock.MonthCentury=recbuf[4];
 171   1         Clock.Year=recbuf[3];
 172   1         setClock();
 173   1         Led=1;
 174   1      }
 175          
 176          void setMID()
 177          {
 178   1         uchar i;
 179   1         
C51 COMPILER V3.20,  SN-50203013  VF2000                                                   03/14/07  15:02:59  PAGE 4   

 180   1         sendChar(0);
 181   1         for(i=0;i<3;i++) wr24c256(0x06+i,recbuf[i+3]);
 182   1      }
 183          
 184          void sendMID()
 185          {
 186   1         uchar j;
 187   1         uchar buf[3];
 188   1      
 189   1         Led=0;
 190   1         for (j=0;j<3;j++) buf[j]=rd24c256(j+0x06);
 191   1        
 192   1         j=buf[0]; j+=buf[1]; j+=buf[2];
 193   1         j=0xff-j;
 194   1         sendChar(buf[0]);
 195   1         sendChar(buf[1]);
 196   1         sendChar(buf[2]);
 197   1         sendChar(j);
 198   1         Led=1;
 199   1      }
 200          
 201          void sendNextRecord()
 202          {
 203   1         uchar j,byte; 
 204   1         uchar check;
 205   1         uint record_num;
 206   1         
 207   1         Led=0;
 208   1         record_num = recbuf[4];
 209   1         record_num *= 0x100;
 210   1         record_num += recbuf[3];
 211   1      
 212   1         record_num--;
 213   1         record_num=RecordAddr+record_num*8;
 214   1      
 215   1         check=0;
 216   1      
 217   1         for ( j=0;j<8;j++ ) 
 218   1            { 
 219   2            byte=rd24c256(record_num+j);
 220   2            sendChar(byte);
 221   2            check+=byte;
 222   2            }  
 223   1      
 224   1         sendChar(0xff-check);
 225   1         Led=1;
 226   1      }
 227          
 228          void sendRecordNum()
 229          {
 230   1         uchar hh,ll;
 231   1           
 232   1         ll=RecordNum%256;
 233   1         hh=RecordNum/256;
 234   1         sendChar(ll); 
 235   1         sendChar(hh);
 236   1         sendChar(0xff-(hh+ll));
 237   1      }
 238          
 239          void resumRecord() /*恢复记录总数*/
 240          {
 241   1         uchar hh,ll;
C51 COMPILER V3.20,  SN-50203013  VF2000                                                   03/14/07  15:02:59  PAGE 5   

 242   1         
 243   1         sendChar(0);
 244   1         
 245   1         hh=rd24c256(0x04);
 246   1         ll=rd24c256(0x05);
 247   1         wr24c256(0x3,hh);
 248   1         wrPCF8563Byte(0xb,ll|0x80);
 249   1      
 250   1         RecordNum=(uint)(hh)*64+ll;
 251   1      }
 252          
 253          void setPara() /*设置参数*/
 254          {
 255   1         uchar i;
 256   1         
 257   1         Led=0;

⌨️ 快捷键说明

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