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

📄 main.lst

📁 自己写的测试程序,调试已通过,可以直接使用, 而且有的还有详细的注释.红外测试软件
💻 LST
📖 第 1 页 / 共 5 页
字号:
C51 COMPILER V7.06   MAIN                                                                  03/26/2008 16:30:50 PAGE 1   


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

stmt level    source

   1          //     24C64数据存放
   2          //00 page DS18B20的序列号
   3          //01 page 
   4          //       00     01      02          03          04          05         06
   5          //  序列号个数 下限   上限    下限负号  上限负号 本机编号   显示模式 
   6          
   7          /**************** RS485 ***************************************/
   8          //        00           奇           偶
   9          //    本机编号     传感器编号      温度/FE
  10          //发送:AA + LINE + C2 + CHECK + 55
  11          //接收:04 + C2 + 采集器号+奇+偶+''''''''''+传感器总数+SMOKE+03
  12          /******************************************************************/
  13          
  14          #include<w78e58b.h>
  15          #include<intrins.h>
  16          #include<function_and_library.h>
  17          #include<ch451_key.h>   
  18          #include<math.h>  
  19            
  20          void send(unsigned char  m);
  21          void start(void);
  22          void delay_start(int i);
  23          void lcd_screen_blank(void);
  24          void display_set(void);
  25          void found_new(void);
  26          void error(void);
  27           bit finding(void);
  28          void display_temp(unsigned i,unsigned char j,short int temp);
  29          void display_temp_6(unsigned i,unsigned char j,short int temp);
  30          void display_temp_single(unsigned i,unsigned char j,short int temp);
  31          void delay_1s(unsigned int hhhh);
  32          void initialization();
  33          void ch451_init(void);
  34          void ch451_write(unsigned short int command);
  35          static bit key_flag;
  36          void key_delay(int);
  37          void key(void);
  38          void off(void);
  39          void myselfe_number(void);
  40          void myselfe_number_1(void);
  41          void memery_error(void);
  42          short int match_ds2438(unsigned char iic_read[]);
  43          void setup_succeed(void); 
  44          void move_number(unsigned char num1);
  45          
  46          bit write_ds2438_flag;
  47          bit up_temp;
  48          bit down_temp;
  49          bit flag_exit;
  50          bit flag_exit_ok;
  51          
  52           static unsigned int ok_n_times;
  53           unsigned short int s;
  54           bit s_flag;
  55          
C51 COMPILER V7.06   MAIN                                                                  03/26/2008 16:30:50 PAGE 2   

  56          
  57          
  58          
  59          
  60          /**************  main function   ********************************************/
  61            void main(void) 
  62          {
  63   1        bit fff;
  64   1         unsigned char i,z,j,or,tt_t;
  65   1        short int temp,tt;
  66   1        bit display_mode_flag;
  67   1        bit display_mode_flag_single;
  68   1        bit first_clear;
  69   1         key_flag=0;
  70   1        or=0; 
  71   1        up_temp=0;
  72   1        down_temp=0;
  73   1        write_ds2438_flag=0;  
  74   1        display_mode_flag=0;                
  75   1        call=1;
  76   1        flag_exit=0;
  77   1        flag_exit_ok=0;
  78   1        led_rs485=0;
  79   1        led=0;
  80   1        first_clear=0;
  81   1       s=0;s_flag=0;
  82   1                                //  iic_read[0]=20;iic_read[6]=6;
  83   1                             //  write_iic_data(1,&iic_read,0,8);delay_iic();
  84   1                                                        //     total=iic_read[0];
  85   1                               //     read_iic_data(2,&iic_read,24,8);delay_iic();
  86   1                     
  87   1        
  88   1           initialization();     
  89   1                                                      
  90   1                                                         
  91   1           EX1=1;              // out interrupt 
  92   1           ES=0;                   //串口中断
  93   1      
  94   1               PX1=0;              // 优先级
  95   1               IT1=1;              // 边沿触发(下降沿有效)
  96   1           
  97   1            read_iic_data(1,&iic_read,0,8);delay_iic();  
  98   1                if(iic_read[6]==8){display_mode_flag=1;}   // choice   0 for 8
  99   1                    else display_mode_flag=0;       
 100   1                      if(iic_read[6]==1&iic_read[0]<=6){display_mode_flag_single=1;}
 101   1                 else display_mode_flag_single=0;
 102   1      while(1)
 103   1            {            ES=0;         
 104   2                    fff=finding();if(fff){found_new();display_set();}
 105   2                         ES=0; 
 106   2                  // if(key_flag!=0){ES=0;key();ES=0; if(display_mode_flag_single){first_clear=0;}}             
             -                              // key 
 107   2                   ds18b20_start();ds2438_start();
 108   2                 ES=0;
 109   2             read_iic_data(1,&iic_read,0,8);     // driver number
 110   2             z=iic_read[0];
 111   2                 t_buf[0]=iic_read[5];//本机编号  RS485
 112   2             sensor_total=iic_read[0];//传感器总数  RS485
 113   2                ES=0;
 114   2                        
 115   2                if(display_mode_flag)  // 8/1
 116   2                           {
C51 COMPILER V7.06   MAIN                                                                  03/26/2008 16:30:50 PAGE 3   

 117   3                           if(z%8==0){or=1;}else or=0;   
 118   3                       for(j=0;j<=z/8-or;j++)
 119   3                             {          led=0;                                                     //  ES=0;  
 120   4                              delay_1s(10000);                                ES=0;  // led free off 
 121   4                              clear_lcd_screen();                       
 122   4                          if(key_flag!=0){key();if(display_mode_flag_single){first_clear=0;}s=0;}               
             -                             //key 
 123   4                              for(i=1;i<=8;i++)
 124   4                                {            
 125   5                                  read_iic_data(0,&iic_read,j*64+(i-1)*8,8);
 126   5                                  temp=0xffff;
 127   5                                        if(iic_read[0]==0x28){led=1;temp=match_temperature(&iic_read); 
 128   6                                                                        if( temp>s+4&temp!=0xffff)
 129   6                                                                                         {s=temp+4;tt=temp*0.0625;tt_t=0xff;tt_t&=tt;
 130   7                                                                                  
 131   7                                                                       send(1);
 132   7                                                                                               send(tt_t);
 133   7                                                                             
 134   7                                                                                          s_flag=1;}}
 135   5                                    if(iic_read[0]==0x26&s_flag==1){led=1;temp=match_ds2438(&iic_read);}              /
             -/      temp=0x00f8;                                                   
 136   5                              display_temp(j,i,temp); 
 137   5                                                            led=0;    
 138   5                              if(z<=j*8+i){break;}
 139   5                             }                                              ES=0;   
 140   4                        }
 141   3                   } 
 142   2                 else                      // 6/1
 143   2                           {
 144   3                    if(z%6==0){or=1;}else or=0;    
 145   3                       for(j=0;j<=z/6-or;j++)
 146   3                             {                                                 
 147   4                              delay_1s(10000);                            ES=0;
 148   4                              
 149   4                             if(!display_mode_flag_single){ first_clear=0;  }  // 本机编号 }                
 150   4                          if(key_flag!=0){key();if(display_mode_flag_single){first_clear=0;}s=0;}               
             -                             //key 
 151   4                              for(i=1;i<=6;i++)
 152   4                                { 
 153   5                                               myselfe_number_1();         
 154   5                                  read_iic_data(0,&iic_read,j*48+(i-1)*8,8);                                 
 155   5                                  temp=0xffff;
 156   5                                        if(iic_read[0]==0x28){led=1;temp=match_temperature(&iic_read); 
 157   6                                                                        if( temp>s+4&temp!=0xffff)
 158   6                                                                                         {s=temp+4;tt=temp*0.0625;tt_t=0xff;tt_t&=tt;
 159   7                                                                                  
 160   7                                                                       send(1);
 161   7                                                                                               send(tt_t);
 162   7                                                                             
 163   7                                                                                          s_flag=1;}}
 164   5                                    if(iic_read[0]==0x26/*&s_flag==1*/){led=1;temp=match_ds2438(&iic_read);}           
             -                                                                                     
 165   5                                                            
 166   5                                                        if(!first_clear){clear_lcd_screen();first_clear=1; myselfe_number_1();  } // 本机编号 }
 167   5                            if(display_mode_flag_single)
 168   5                                                     display_temp_single(j,i,temp); 
 169   5                            else  display_temp_6(j,i,temp); 
 170   5                              
 171   5                                                                              led=0;                                      
 172   5                              if(z<=j*6+i){break;}                                     
 173   5                             }                                          ES=0; 
 174   4                        }
C51 COMPILER V7.06   MAIN                                                                  03/26/2008 16:30:50 PAGE 4   

 175   3                   } 
 176   2             call=1;  
 177   2             }
 178   1       }
 179          
 180          
 181                   
 182          
 183          
 184          
 185          /**************** start display ****************************************/
 186          void start(void)
 187          { 
 188   1       unsigned char o1,o2;
 189   1      
 190   1       delay_time(2);
 191   1        initialization_led_screen();
 192   1        write_byte(0,0,0,&number[19]);             //write input a byte blank;
 193   1        write_word(0,0,8,&chinese[0]);             //write input a word "韦"
 194   1        write_word(0,0,24,&chinese[1]);            //write input a word "安"
 195   1        write_word(0,0,40,&chinese[2]);            //write input a word "博"
 196   1        write_word(0,0,56,&chinese[3]);            //write input a word "电"
 197   1        write_word(1,0,8,&chinese[4]);             //write input a word "力"
 198   1        write_word(1,0,24,&chinese[5]);            //write input a word "科"
 199   1        write_word(1,0,40,&chinese[6]);            //write input a word "技"
 200   1        write_byte(1,0,56,&number[19]);            //write input a byte blank
 201   1        
 202   1        write_byte(0,2,0,&number[19]);             //write input a byte blank;
 203   1        write_byte(0,2,8,&number[19]);             //write input a byte blank;
 204   1        write_word(0,2,16,&chinese[7]);            //write input a word "温"
 205   1        write_word(0,2,32,&chinese[8]);            //write input a word "度" 
 206   1        write_word(0,2,48,&chinese[9]);            //write input a word "巡" 
 207   1        write_word(1,2,0, &chinese[10]);           //write input a word "测"
 208   1        write_word(1,2,16,&chinese[11]);           //write input a word "系"
 209   1        write_word(1,2,32,&chinese[12]);           //write input a word "统"
 210   1        write_byte(0,2,0,&number[19]);             //write input a byte blank;
 211   1        write_byte(0,2,0,&number[19]);             //write input a byte blank;
 212   1      
 213   1        write_byte(0,4,0,&number[19]);             //write input a byte blank;
 214   1        write_byte(0,4,8,&number[19]);             //write input a byte blank;
 215   1        write_byte(0,4,16,&number[19]);            //write input a byte blank;
 216   1        write_word(0,4,24,&chinese[13]);           //write input a word "终"
 217   1        write_word(0,4,40,&chinese[14]);           //write input a word "端" 
 218   1        write_word(0,4,56,&chinese[15]);           //write input a word "采" 
 219   1        write_word(1,4,8, &chinese[16]);           //write input a word "集"
 220   1        write_word(1,4,24,&chinese[17]);           //write input a word "器"
 221   1        write_byte(1,4,40,&number[19]);            //write input a byte blank;
 222   1        write_byte(1,4,48,&number[19]);            //write input a byte blank;
 223   1        write_byte(1,4,56,&number[19]);            //write input a byte blank;
 224   1      
 225   1        write_byte(0,6,0,&number[19]);            //write input a byte blank;
 226   1        write_word(0,6,8,&chinese[18]);            //write input a word "本"
 227   1        write_word(0,6,24,&chinese[19]);           //write input a word "机"
 228   1        write_word(0,6,40,&chinese[20]);           //write input a word "编"
 229   1        write_word(0,6,56,&chinese[21]);           //write input a word "号"
 230   1        write_byte(1,6,8,&number[22]);             //write input a byte ":"

⌨️ 快捷键说明

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