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

📄 main.lst

📁 单片机51
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V8.02   MAIN                                                                  05/12/2008 12:39:48 PAGE 1   


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

line level    source

   1          /********************2008年单片机课程设计之病房呼叫系统*********************/
   2          /***************************自动化05陈海涛***************************/
   3          /********************8051和12864液晶接口电路********************
   4          
   5          8051            LCD
   6          
   7          数据口:
   8          P0.0            DB0
   9          P0.1            DB1     
  10          P0.2                    DB2       
  11          P0.3                    DB3       
  12          P0.4                    DB4     
  13          P0.5                    DB5     
  14          P0.6                    DB6     
  15          P0.7                    DB7
  16          控制字:     
  17          P2.4                    CSA      //低电平有效
  18          P2.3                    CSB      //低电平有效 
  19          P2.2                    RS(DI)   //H:Data , L:Instruction
  20          P2.1                    RW       //H:Read , L:Write
  21          P2.0                    E        //高电平有效 
  22          ****************************************************************/
  23          
  24          
  25          #include<reg51.h>
  26          
  27          #define uchar unsigned char 
  28          #define uint unsigned int
  29          
  30          sbit cs1=P2^3;
  31          sbit cs2=P2^4;
  32          sbit di=P2^2;
  33          sbit rw=P2^1;
  34          sbit e=P2^0;
  35          sbit d1=P1^0;
  36          sbit d2=P1^1;
  37          sbit d3=P1^2;
  38          sbit d4=P1^3;
  39          sbit d5=P1^4;
  40          sbit d6=P1^5;
  41          sbit buzzer=P3^7;
  42          /*********************全局变量定义********************/
  43          uchar room[6]={0,0,0,0,0,0};
  44          uchar bed[6]={0,0,0,0,0,0};
  45          uchar receivedata;
  46          uchar Btime;
  47          uchar Btime1;
  48          /**********************************字符取模********************************************/
  49          /*--  文字:  房  --*/
  50          /*--  Times New Roman12;  此字体下对应的点阵为:宽x高=16x16   --*/
  51          uchar code fang[32]={0x00,0x00,0xFC,0x94,0x94,0x94,0x94,0x95,0xB6,0xD4,0x94,0x94,0x94,0x9C,0x80,0x00,
  52                                                                  0x40,0x30,0x0F,0x80,0x40,0x30,0x0F,0x04,0x04,0x44,0x84,0x44,0x3C,0x00,0x00,0x00};
  53          /*--  文字:  间  --*/
  54          /*--  Times New Roman12;  此字体下对应的点阵为:宽x高=16x16   --*/
  55          uchar code jian[32]={0x00,0xF8,0x01,0x06,0x00,0xF0,0x92,0x92,0x92,0x92,0xF2,0x02,0x02,0xFE,0x00,0x00,
C51 COMPILER V8.02   MAIN                                                                  05/12/2008 12:39:48 PAGE 2   

  56                                                                  0x00,0xFF,0x00,0x00,0x00,0x07,0x04,0x04,0x04,0x04,0x07,0x40,0x80,0x7F,0x00,0x00};
  57          /*--  文字:  床  --*/
  58          /*--  Times New Roman12;  此字体下对应的点阵为:宽x高=16x16   --*/
  59          uchar code chuang[32]={0x00,0x00,0xFC,0x44,0x44,0x44,0x44,0xC5,0xFE,0x44,0x44,0x44,0x44,0x44,0x04,0x00,
  60                                                                  0x80,0x60,0x1F,0x40,0x20,0x18,0x06,0x01,0xFF,0x01,0x02,0x04,0x08,0x30,0x10,0x00};
  61          /*--  文字:  号  --*/
  62          /*--  Times New Roman12;  此字体下对应的点阵为:宽x高=16x16   --*/
  63          uchar code hao[32]={0x40,0x40,0x40,0x5F,0xD1,0x51,0x51,0x51,0x51,0x51,0x51,0x5F,0x40,0x40,0x40,0x00,
  64                                                                  0x00,0x00,0x00,0x02,0x07,0x02,0x02,0x22,0x42,0x82,0x42,0x3E,0x00,0x00,0x00,0x00};
  65          /*--0--9数字--*/
  66          /*--  Times New Roman12;  此字体下对应的点阵为:宽x高=8x16   --*/
  67          uchar code shu[10][16]={{0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00},
  68                                                                          {0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00},
  69                                                                          {0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00},
  70                                                                          {0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00},
  71                                                                          {0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00},
  72                                                                          {0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00},
  73                                                                          {0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00},
  74                                                                          {0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00},
  75                                                                          {0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00},
  76                                                                          {0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00}};
  77          
  78          /**********************延时函数************************/
  79          void delay(uint num)
  80          {
  81   1              while(num--) ;
  82   1      }
  83          /*************************写LCD函数********************************/
  84          void lw(uchar x,uchar y,uchar dd) 
  85          {
  86   1                      if (x<64) 
  87   1                      {
  88   2                              cs1=cs2=0;
  89   2                              di=rw=0;cs1=1;cs2=0;P0=0xb8|y;e=1;delay(2);e=0;delay(2);
  90   2                              di=rw=0;cs1=1;cs2=0;P0=0x40|x;e=1;delay(2);e=0;delay(2);
  91   2                              di=1;rw=0;cs1=1;cs2=0;P0=dd;e=1;delay(2);e=0;delay(2);  
  92   2                              
  93   2                      }
  94   1                      else 
  95   1                      {
  96   2                              cs1=cs2=0;x=x-64;
  97   2                              di=rw=0;cs1=0;cs2=1;P0=0xb8|y;e=1;delay(2);e=0;delay(2);                        
  98   2                              di=rw=0;cs1=0;cs2=1;P0=0x40|x;e=1;delay(2);e=0;delay(2);
  99   2                              di=1;rw=0;cs1=0;cs2=1;P0=dd;e=1;delay(2);e=0;delay(2);
 100   2                              cs1=cs2=1;
 101   2                      }
 102   1      }
 103          
 104          /************************LCD初始化*************************/
 105          void lcd_init(void) {
 106   1              uchar x,y;      
 107   1              e=di=rw=0;
 108   1              cs1=cs2=1;
 109   1              cs1=0;cs2=1;
 110   1              di=rw=0;P0=0x3f;e=1;delay(2);e=0;delay(2);
 111   1              cs1=0;cs2=1;
 112   1              di=rw=0;P0=0xc0;e=1;delay(2);e=0;delay(2);
 113   1              cs1=cs2=0;
 114   1      
 115   1              cs1=1;cs2=0;
 116   1              di=rw=0;P0=0x3f;e=1;delay(2);e=0;delay(2);
 117   1              cs1=1;cs2=0;
C51 COMPILER V8.02   MAIN                                                                  05/12/2008 12:39:48 PAGE 3   

 118   1              di=rw=0;P0=0xc0;e=1;delay(2);e=0;delay(2);
 119   1              cs1=cs2=0;
 120   1      
 121   1            for (y=0;y<8;y++) {
 122   2                      for (x=0;x<128;x++) lw(x,y,0); 
 123   2              }
 124   1      }
 125          
 126          
 127          /***************写16*16分辨率汉字************/
 128          void write_chinese(x,y,array)
 129          uchar x,y;
 130          uchar array[];
 131          {
 132   1              uchar j,dd;                     
 133   1              for(j=0;j<32;j++)
 134   1              {
 135   2                      dd=array[j];
 136   2                      if(j<16) lw(x+j,y,dd);
 137   2                       else  lw(x+j-16,y+1,dd);
 138   2              }       
 139   1      }
 140          /***************写8*16分辨率字母,数字**********/
 141          void write_english(x,y,array)
 142          uchar x,y;
 143          uchar array[];
 144          {
 145   1              uchar j,dd;                     

⌨️ 快捷键说明

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