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

📄 lcd1602.lst

📁 此程序实现了4个ds18b20温度传感器的单线数据采集
💻 LST
字号:
C51 COMPILER V8.02   LCD1602                                                               05/14/2008 22:24:04 PAGE 1   


C51 COMPILER V8.02, COMPILATION OF MODULE LCD1602
OBJECT MODULE PLACED IN LCD1602.OBJ
COMPILER INVOKED BY: d:\Keil\C51\BIN\C51.EXE LCD1602.c OPTIMIZE(9,SPEED) DEBUG OBJECTEXTEND

line level    source

   1          #include "lcd1602.h"
   2          #include "ds18b20.h"
   3          #include <stdio.h>
   4          
   5          unsigned char temp[5];
   6          extern char xiaoshu_temp[5],zhen_temp[4];
   7          extern bit flag;
   8          extern bit dot_dis;
   9          uchar ds18b20_num1[8]={0xfd,0x00,0x00,0x00,0xb8,0xc5,0x45,0x28};
  10          uchar ds18b20_num2[8]={0x8e,0x00,0x00,0x00,0xb8,0xc5,0x30,0x28};
  11          uchar ds18b20_num3[8]={0xb9,0x00,0x00,0x00,0xb8,0xc5,0x31,0x28};
  12          uchar ds18b20_num4[8]={0xe0,0x00,0x00,0x00,0xb8,0xc5,0x32,0x28};
  13          void delay(unsigned int time)
  14          {
  15   1              unsigned int i,j;
  16   1              for(i=0;i<time;i++)
  17   1                      for(j=0;j<200;j++);
  18   1      }
  19          
  20                  
  21          void main(void)
  22          { 
  23   1              uchar i;
  24   1              uchar *ds18b20_rom;
  25   1              char *str1="1:";
  26   1              char *str2="2:";
  27   1              char *str3="3:";
  28   1              char *str4="4:";
  29   1              serial_set();
  30   1              Lcd_Init();
  31   1              ClrScreen();
  32   1              GotoXY(0,0);
  33   1              
  34   1      
  35   1              dot_dis=1;
  36   1              ds18b20_rom=read_rom();  //读序列号
  37   1              for(i=0;i<8;i++)                 
  38   1              {
  39   2                      ds18b20_num2[i]=*ds18b20_rom;
  40   2                      ds18b20_rom++;
  41   2              }
  42   1              GotoXY(0,1);
  43   1              for(i=0;i<8;i++)                          //显示序列号
  44   1              {
  45   2                      print_char(ds18b20_num2[i]/16);
  46   2                      print_char(ds18b20_num2[i]%16);
  47   2      
  48   2              }
  49   1      
  50   1              /*while(1);*/ 
  51   1              while(1)
  52   1              {       
  53   2                      ds18b20_init();
  54   2                      ds18b20_writecommand(0xcc);
  55   2                      ds18b20_writecommand(0x44);      //转换
C51 COMPILER V8.02   LCD1602                                                               05/14/2008 22:24:04 PAGE 2   

  56   2                      delay(500);
  57   2                      match_rom(ds18b20_num1);          //匹配第一路
  58   2                      ds18b20_writecommand(0xbe);       //读
  59   2                      for(i=0;i<2;i++)
  60   2                      {       
  61   3                              temp[i]=ds18b20_readdata();             
  62   3                      }
  63   2                      temperature_process(temp[0],temp[1]);
  64   2                      Screen_home();
  65   2                      Print(str1);
  66   2                      if(!flag) //正
  67   2                      {
  68   3                              Print(zhen_temp);
  69   3                              if(dot_dis)     
  70   3                              Print(".");
  71   3                              Print(xiaoshu_temp);
  72   3                      }
  73   2                      else   //负
  74   2                      {
  75   3                              Print("-");
  76   3                              Print(zhen_temp);
  77   3                              if(dot_dis)     
  78   3                              Print(".");
  79   3                              Print(xiaoshu_temp);
  80   3      
  81   3                      }
  82   2                      Print("  ");
  83   2                      ds18b20_init();
  84   2      
  85   2                      ds18b20_writecommand(0xcc);
  86   2                      ds18b20_writecommand(0x44);      //转换
  87   2                      delay(500);
  88   2                      match_rom(ds18b20_num2);          //匹配第二路
  89   2                      ds18b20_writecommand(0xbe);       //读
  90   2      
  91   2      
  92   2                      for(i=0;i<2;i++)
  93   2                      {
  94   3              
  95   3                              temp[i]=ds18b20_readdata();
  96   3                      
  97   3                      }
  98   2                      temperature_process(temp[0],temp[1]);
  99   2                      GotoXY(9,0);
 100   2                      Print(str2);
 101   2                      
 102   2                      if(!flag) //正
 103   2                      {
 104   3                              Print(zhen_temp);
 105   3                              if(dot_dis)     
 106   3                              Print(".");
 107   3                              Print(xiaoshu_temp);
 108   3                      }
 109   2                      else   //负
 110   2                      {
 111   3                              Print("-");
 112   3                              Print(zhen_temp);
 113   3                              if(dot_dis)     
 114   3                              Print(".");
 115   3                              Print(xiaoshu_temp);
 116   3      
 117   3                      }
C51 COMPILER V8.02   LCD1602                                                               05/14/2008 22:24:04 PAGE 3   

 118   2                      Print("  ");
 119   2                      ds18b20_init();
 120   2                      ds18b20_writecommand(0xcc);
 121   2                      ds18b20_writecommand(0x44);      //转换
 122   2                      delay(500);
 123   2                      match_rom(ds18b20_num3);          //匹配第三路
 124   2                      ds18b20_writecommand(0xbe);       //读
 125   2      
 126   2      
 127   2                      for(i=0;i<2;i++)
 128   2                      {
 129   3              
 130   3                              temp[i]=ds18b20_readdata();
 131   3                      
 132   3                      }
 133   2                      temperature_process(temp[0],temp[1]);
 134   2                      GotoXY(0,1);
 135   2                      Print(str3);
 136   2              
 137   2                      if(!flag) //正
 138   2                      {
 139   3                              Print(zhen_temp);
 140   3                              if(dot_dis)     
 141   3                              Print(".");
 142   3                              Print(xiaoshu_temp);
 143   3                      }
 144   2                      else   //负
 145   2                      {
 146   3                              Print("-");
 147   3                              Print(zhen_temp);
 148   3                              if(dot_dis)     
 149   3                              Print(".");
 150   3                              Print(xiaoshu_temp);
 151   3      
 152   3                      }
 153   2                      Print("  ");
 154   2                      ds18b20_init();
 155   2      
 156   2                      ds18b20_writecommand(0xcc);
 157   2                      ds18b20_writecommand(0x44);      //转换
 158   2                      delay(500);
 159   2                      match_rom(ds18b20_num4);          //匹配第二路
 160   2                      ds18b20_writecommand(0xbe);       //读
 161   2      
 162   2      
 163   2                      for(i=0;i<2;i++)
 164   2                      {
 165   3              
 166   3                              temp[i]=ds18b20_readdata();
 167   3                      
 168   3                      }
 169   2                      temperature_process(temp[0],temp[1]);
 170   2                      GotoXY(9,1);
 171   2                      Print(str4);    
 172   2                      if(!flag) //正
 173   2                      {
 174   3                              Print(zhen_temp);
 175   3                              if(dot_dis)     
 176   3                              Print(".");
 177   3                              Print(xiaoshu_temp);
 178   3                      }
 179   2                      else   //负
C51 COMPILER V8.02   LCD1602                                                               05/14/2008 22:24:04 PAGE 4   

 180   2                      {
 181   3                              Print("-");
 182   3                              Print(zhen_temp);
 183   3                              if(dot_dis)     
 184   3                              Print(".");
 185   3                              Print(xiaoshu_temp);
 186   3      
 187   3                      }
 188   2                      Print("  ");
 189   2                 //delay(100);
 190   2              }
 191   1              while(1);
 192   1              
 193   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    662    ----
   CONSTANT SIZE    =     19    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     37      13
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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