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

📄 main.lst

📁 是单片机上液晶显示程序:带中文字库的LM3033:控制器是ST7920
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V8.02   MAIN                                                                  03/31/2009 11:48:53 PAGE 1   


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

line level    source

   1          #include<AT89X51.H>
   2          #include "INTRINS.H"
   3          
   4          #define  LCD_BUS  P0
   5          sbit RS= P2^5;
   6          sbit RW=P2^6;
   7          sbit E =P2^7;
   8          // sbit pcb=P1^3;
   9           // sbit RS= P1^0;
  10           //sbit RW=P1^1;
  11           //sbit E =P1^2;
  12          
  13          //extern  unsigned char code str[14][3];//={":0",":1",":2",":3",":4",":5",":6",":7",":8",":9"};
  14          
  15          
  16           
  17          
  18          
  19              ////////////////////////////////////
  20          
  21           ////////////////////////////////////
  22             
  23              void delay(unsigned int t) ;             //延时t倍///
  24          
  25              unsigned char  check_bf(unsigned char Address_AC);   //LCD标志位查询//
  26              void  write_data(unsigned char dispdata);    //写数据//
  27              void write_comand(unsigned char cmdcode);    //写命令//
  28               
  29              void lcd_init();                           ///LCD初始化//
  30              void stringdisp (unsigned char  code *str,unsigned char adress); //显示字符串//
  31          
  32                  void   data_disp(unsigned int disp_data,unsigned char adress);       //数字显示
  33                   void disp_graph();                                                 //总界面:教室灯控系统
  34                   void disp_graph_password();                //密码输入登录界面
  35                   void disp_graph_set();                                     //系统设置总界面
  36          /////////////////////////////////////////////////////
  37          
  38              unsigned char  code str[]="  教室灯控系统  ";         //登陆总界面
  39              unsigned char  code str1[]="  ●登陆界面  →";
  40          //      unsigned char  code str2[]="  ●设置界面  →";
  41          
  42             unsigned char  code str_password1[]="请输入登录密码:";        //输入密码界面
  43             unsigned char  code str_password2[]="  ******  ";
  44             unsigned char  code str_password3[]="   1 2 3 4 5 6  ";
  45             unsigned char  code str_password4[]="     6 7 8 9    ";
  46          
  47             unsigned char  code str_set1[]="设置选项:    ";       //设置总界面
  48             unsigned char  code str_set2[]="●密码设置    →";
  49             unsigned char  code str_set3[]="●系统时间设置→";
  50             unsigned char  code str_set4[]="●定时时间设置→";
  51          
  52             unsigned char code str3[]="1234567891234567";
  53          
  54          // unsigned char  code str12[14][3]={"1 ","2 ","3 ","4 ","5 ","6 ","7 ","8 ","9 ","10","11","12","13","14"
             -,};
C51 COMPILER V8.02   MAIN                                                                  03/31/2009 11:48:53 PAGE 2   

  55          
  56          //////////////////////////////////////////////////////////////////
  57           void main()
  58           {
  59   1         unsigned char m;
  60   1        
  61   1        //init591();
  62   1       // pcb=1;
  63   1        lcd_init();
  64   1        LCD_BUS=0X00;
  65   1       //disp_graph();                          //登陆总界面
  66   1        disp_graph_password();
  67   1        // disp_graph_set();
  68   1      
  69   1      
  70   1        //stringdisp(&str3,0x80);   ///////显示开机画面//////
  71   1      
  72   1        //write_comand(0x85);
  73   1       // stringdisp("1",0x88);
  74   1        // data_disp(198,0x98);       //数字显示
  75   1      
  76   1      
  77   1      
  78   1      
  79   1       /* m=check_bf();               //测试LCD屏状态查询中AC的返回值是否正确
  80   1        delay(10);
  81   1        if(m=0x87)
  82   1        {
  83   1      // write_comand(0x30);
  84   1       write_comand(0x88);
  85   1       write_data('1'); }
  86   1       else
  87   1        {
  88   1       //write_comand(0x30);
  89   1       write_comand(0x88);
  90   1       write_data('0'); 
  91   1          }    */
  92   1      
  93   1       delay(100);
  94   1         }
*** WARNING C280 IN LINE 59 OF MAIN.C: 'm': unreferenced local variable
  95          
  96          /**********************************************************************
  97          函数原型: void  delay(unsigned int t)   
  98          入口参数:
  99                             t  :  延时程序t倍的100us
 100          出口参数:   无
 101          返 回 值:  无      
 102          说    明: LCD液晶延时子程序t倍100us
 103          **********************************************************************/ 
 104          ///////////////////延时程序/////////////////////////////////////
 105          
 106            void  delay(unsigned int t)          //延时程序t倍100us
 107            {
 108   1          unsigned char j;
 109   1          unsigned int  i;
 110   1          for(i=0;i<t;i++)
 111   1          for(j=0;j<29;j++);
 112   1      
 113   1      }
 114          /***********************************************************************
 115          函数原型:check_bf(unsigned char Address_AC)
C51 COMPILER V8.02   MAIN                                                                  03/31/2009 11:48:53 PAGE 3   

 116          入口参数:无      
 117          出口参数:无
 118                    
 119          返回值: 
 120                Address_AC:当前状态的地址(一个无符号字符)
 121          功能说明:LCD液晶的状态BF查询和DDRAM的地址查询
 122          ************************************************************************/
 123          ////////////////////////////查询BF///////////////////////////////////////
 124          
 125          unsigned char check_bf(unsigned char Address_AC)
 126            {
 127   1         unsigned char  BF;         ////忙标志位,BF是某字节的一位,是D7位,如果为1,则忙//////
 128   1         LCD_BUS=0x00 ;
 129   1         do
 130   1          {
 131   2               RS=0;
 132   2           RW=1;
 133   2           E=1;
 134   2           BF=LCD_BUS;              /////此处BF定义不是一个位,而是一个字节,不过在处理中代表标志位bf///
 135   2           _nop_();
 136   2           E=0;
 137   2               Address_AC=BF;
 138   2           BF=BF&0x80;               ////取出BF////
 139   2           }while( BF!=0x00 ) ;                 //////判断是否忙?///////
 140   1               Address_AC=Address_AC&0x7f;  ///读出DDRAM的地址指针AC的值
 141   1           delay(5) ;
 142   1               return(Address_AC);
 143   1        }    
 144          /**********************************************************************
 145          函数原型:write_comand(unsigned char cmdcode)
 146          入口参数:
 147                             cmdcode  :  命令字 (0x01:清屏)
 148          出口参数:   无
 149          返 回 值:  无      
 150          说    明: 对lcd写命令字
 151          **********************************************************************/ 
 152          /////////////////////////写命令子程序//////////////////////////////////
 153          
 154           void write_comand(unsigned char cmdcode)
 155           {
 156   1         check_bf();
*** WARNING C209 IN LINE 156 OF MAIN.C: '_check_bf': too few actual parameters
 157   1         RS=0;
 158   1         RW=0;
 159   1         E=1;
 160   1         LCD_BUS=cmdcode;
 161   1         _nop_();
 162   1         E=0;
 163   1         delay(5) ;
 164   1       }
 165          /***********************************************************************
 166          函数原型:write_data(unsigned char dispdata)
 167          入口参数:
 168                    dispdata:写入lcd要显示内容
 169          出口参数:无
 170          返回值:  无
 171          功能说明:LCD液晶的数据写入指令
 172          ************************************************************************/
 173          //////////////////////////写数据子程序///////////////////////////////////
 174          
 175          void  write_data(unsigned char dispdata)
 176            {
C51 COMPILER V8.02   MAIN                                                                  03/31/2009 11:48:53 PAGE 4   

 177   1         check_bf();
*** WARNING C209 IN LINE 177 OF MAIN.C: '_check_bf': too few actual parameters
 178   1         RS=1;
 179   1         RW=0;
 180   1         E=1;
 181   1         LCD_BUS=dispdata;
 182   1         _nop_();
 183   1         E=0;
 184   1         }
 185          /******************************************************************
 186           函数:lcd_init()
 187          入口参数:无
 188          出口参数:无
 189          返回值:无
 190          功能说明:LCD液晶的初始化
 191          ********************************************************************/
 192           /////////////////////////液晶初始化////////////////////////////////
 193          void  lcd_init()

⌨️ 快捷键说明

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