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

📄 main.lst

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


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

line 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          
  54          
  55          
C51 COMPILER V7.08   MAIN                                                                  06/13/2007 16:48:08 PAGE 2   

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

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

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

⌨️ 快捷键说明

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