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

📄 vf3000em.lst

📁 安防产品源程序 包括液晶芯片, c51单片机,通讯等 程序
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V3.20,  SN-50203013  VF3000EM                                                 10/27/06  09:17:20  PAGE 1   


DOS C51 COMPILER V3.20, COMPILATION OF MODULE VF3000EM
OBJECT MODULE PLACED IN VF3000EM.OBJ
COMPILER INVOKED BY: F:\COMP51\BIN\C51.EXE VF3000EM.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          
   6          #pragma ROM(LARGE)
   7          #pragma RB(0)
   8          #pragma ot(5,SIZE)
   9          
  10          #include<reg52.h>
  11          #include<pub.h>
  12          #include<absacc.h>
  13          #include<intrins.h>
  14          #include <24c256h.h>
  15          #include <pcf8563.h>
  16          
  17          #include <EMrfc.h>
  18          
  19          
  20          uint data RecordNum;
  21          bit CommMark=0;
  22          uint MaxRecordNum;
  23          //bit E2promType=0;/*256则为0,512则为1*/
  24          bit shakeflag;
  25          bit alarmflag;
  26          uchar WorkTime;
  27          
  28          void int0Route() interrupt 0 using 1
  29          {
  30   1         CommMark=1;
  31   1         EX0=0;
  32   1      }
  33          
  34          void music()
  35          {
  36   1         uint i;
  37   1         
  38   1         for ( i=0;i<139*4;i++ )
  39   1            {
  40   2            Bell=1; TR0=0;TF0=0;TH0=0xff;TL0=0x91;TR0=1;
  41   2            while ( !TF0 ); TF0=0;
  42   2            Bell=0; TR0=0;TF0=0;TH0=0xff;TL0=0x91;TR0=1;
  43   2            while ( !TF0 ); TF0=0;
  44   2            }
  45   1         Bell = 1;   
  46   1      }
  47          
  48          /* 延时n个uS  */
  49          void delayNus(uint nus) 
  50          {
  51   1         TR0=0;/*先停止计数*/
  52   1         nus = 0xffff- nus;
  53   1         TF0=0; TL0=(uchar)nus; TH0=nus/0x100;
  54   1         TR0=1;
  55   1         while( !TF0 );
C51 COMPILER V3.20,  SN-50203013  VF3000EM                                                 10/27/06  09:17:20  PAGE 2   

  56   1         TF0=0;
  57   1      }
  58          
  59          
  60          void delayN10ms(uchar t)
  61          {
  62   1         uchar i;
  63   1         for(i=0;i<t;i++) delayNus(10000);
  64   1      }
  65          
  66          void powerDown()
  67          {
  68   1         Shake=1;
  69   1         SHD=1;
  70   1         PCON=0X2;
  71   1      }
  72          
  73          void test()/*测试存储器是24c256(=0)还是24c512(=1)*/
  74          {
  75   1         uchar temp1,temp2;
  76   1      
  77   1         temp1=rd24c256(0x7fff);
  78   1         temp2=rd24c256(0xffff);
  79   1         
  80   1         wr24c256(0x7fff,0x55);
  81   1         wr24c256(0xffff,0xaa);
  82   1         
  83   1         if(rd24c256(0x7fff)==0xaa) wr24c256(0x25,0);
  84   1         else wr24c256(0x25,1);
  85   1      }
  86          /******************通讯部分***********************/
  87          uchar idata recbuf[16];
  88          uchar data RecLen;
  89          
  90          void initComm()
  91             {
  92   1         RecLen=0;
  93   1         TMOD = 0x21;
  94   1         PCON = PCON|0x80; /*串行口的波特率加倍位*/
  95   1         TH1 = 0xff;       /*11.0592串行口的波特率为57600bps,8BIT*/
  96   1         TL1 = 0xff;
  97   1         
  98   1      /*   PCON = 0x80;   /*波特率加倍位*/
  99   1       //  TH1 = 0xfd;    /*串行口的波特率加倍后为19200,8BIT*/
 100   1      //   TL1 = 0xfd;
 101   1         SCON = 0x50;
 102   1         TR1 = 1;
 103   1        // REN = 1;
 104   1        // RI = 0;TI = 0;
 105   1         }
 106             
 107          void sendChar(uchar tt)
 108          {
 109   1         uchar i;
 110   1         REN=0;
 111   1         SBUF=tt; while (!TI); TI=0;
 112   1         for(i=0;i<2;i++);
 113   1         REN=1;
 114   1      }
 115          void sendClock()
 116          {
 117   1         uchar check_byte;
C51 COMPILER V3.20,  SN-50203013  VF3000EM                                                 10/27/06  09:17:20  PAGE 3   

 118   1        
 119   1         getClock();
 120   1        
 121   1         check_byte = Clock.Year; 
 122   1         check_byte +=Clock.MonthCentury;
 123   1         check_byte +=Clock.Day;
 124   1         check_byte +=Clock.Hour;
 125   1         check_byte +=Clock.Min;
 126   1         check_byte +=Clock.Sec;
 127   1         check_byte=0xff-check_byte;
 128   1         
 129   1         sendChar(Clock.Year);
 130   1         sendChar(Clock.MonthCentury);
 131   1         sendChar(Clock.Day);
 132   1         sendChar(Clock.Hour);
 133   1         sendChar(Clock.Min);
 134   1         sendChar(Clock.Sec);
 135   1         sendChar(check_byte);
 136   1      }
 137          
 138          void pcSetClock()
 139          {
 140   1         sendChar(0);/*返回确认消息*/
 141   1         
 142   1         Clock.Sec=recbuf[8];
 143   1         Clock.Min=recbuf[7];
 144   1         Clock.Hour=recbuf[6];
 145   1         Clock.Day=recbuf[5];
 146   1         Clock.MonthCentury=recbuf[4];
 147   1         Clock.Year=recbuf[3];
 148   1         setClock();
 149   1         music(); 
 150   1      }
 151          
 152          void setMID()
 153          {
 154   1         uchar i;
 155   1         sendChar(0);
 156   1         
 157   1         for(i=0;i<3;i++) wr24c256(0x06+i,recbuf[i+3]);
 158   1         music();
 159   1      }
 160          
 161          void sendMID()/*0x06~0x08存机器号*/
 162          {
 163   1         uchar j;
 164   1         uchar buf[3];
 165   1      
 166   1         for (j=0;j<3;j++) buf[j]=rd24c256(j+0x06);
 167   1        
 168   1         j=buf[0]; j+=buf[1]; j+=buf[2];
 169   1         j=0xff-j;
 170   1         sendChar(buf[0]);
 171   1         sendChar(buf[1]);
 172   1         sendChar(buf[2]);
 173   1         sendChar(j);
 174   1      }
 175          
 176          void sendNextRecord()
 177          {
 178   1         uchar j,byte; 
 179   1         uchar check;
C51 COMPILER V3.20,  SN-50203013  VF3000EM                                                 10/27/06  09:17:20  PAGE 4   

 180   1         uint record_num;
 181   1         
 182   1         record_num = recbuf[4];
 183   1         record_num *= 0x100;
 184   1         record_num += recbuf[3];
 185   1      
 186   1         record_num--;
 187   1         record_num=RecordAddr+record_num*8;
 188   1      
 189   1         check=0;
 190   1      
 191   1         for ( j=0;j<8;j++ ) 
 192   1            { 
 193   2            byte=rd24c256(record_num+j);
 194   2            sendChar(byte);
 195   2            check+=byte;
 196   2            }  
 197   1      
 198   1         sendChar(0xff-check);
 199   1      }
 200          
 201          void sendRecordNum()
 202          {
 203   1         uchar hh,ll;
 204   1           
 205   1         ll=RecordNum%256;
 206   1         hh=RecordNum/256;
 207   1         sendChar(ll); 
 208   1         sendChar(hh);
 209   1         sendChar(0xff-(hh+ll));
 210   1      }
 211          
 212          void resumRecord() /*恢复记录总数 0x04~0x05存备份的记录总数*/
 213          {
 214   1         uchar hh,ll;
 215   1         
 216   1         sendChar(0);
 217   1         
 218   1         hh=rd24c256(0x04);
 219   1         ll=rd24c256(0x05);
 220   1         wr24c256(0x3,hh);
 221   1         wrPCF8563Byte(0xb,ll|0x80);
 222   1      
 223   1         RecordNum=hh*64+ll;
 224   1         music();
 225   1      }
 226          
 227          void setPara() /*设置参数*/
 228          {
 229   1         uchar i;
 230   1         sendChar(0);
 231   1         
 232   1         i=recbuf[4]; 
 233   1         
 234   1         if (recbuf[3]==2)      /* 设置通讯时间 */
 235   1            {
 236   2            if (i==0) powerDown();
 237   2            else; 
 238   2            } 
 239   1         else if(recbuf[3]==3)

⌨️ 快捷键说明

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