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

📄 lcd.lst

📁 基于F020单片机的简易音频信号分析仪的实现keil程序(C实现)。2007年9月全国大学生电子设计竞赛题目(获得省2等奖)所有要求功能都实现。希望对感兴趣的朋友有帮助!
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V7.06   LCD                                                                   09/06/2007 21:49:07 PAGE 1   


C51 COMPILER V7.06, COMPILATION OF MODULE LCD
OBJECT MODULE PLACED IN LCD.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE LCD.C LARGE OPTIMIZE(0,SPEED) BROWSE DEBUG OBJECTEXTEND

stmt level    source

   1          #define   LCD_GLOBALS
   2          #include "includes.h"
   3          
   4          #define uchar unsigned char 
   5          #define uint unsigned int 
   6          
   7          
   8          typedef struct typFNT_GB16                 // 汉字字模数据结构
   9          {
  10                 signed char Index[2];               // 汉字内码索引
  11                 char  Msk[32];                       // 点阵码数据
  12          };
  13          
  14          /*      以下几个程序是液晶状态字判断程序*/
  15          //#pragma disable    //关中断
  16          uchar lcd_busy(void)
  17          {
  18   1              uchar dat;
  19   1      //      P7 = 0xff;
  20   1              dat=lcd_control;
  21   1              return(dat);
  22   1      }
  23          
  24          //#pragma disable
  25          /*read-write instruct or data states*/
  26          void lcd_st01(void)
  27          {
  28   1              while((lcd_busy()&3)!=3){;}
  29   1      }
  30          
  31          
  32          //#pragma disable
  33          /*data auto-write state*/
  34          void lcd_st3(void)
  35          {
  36   1              while ((lcd_busy()&8)!=8){;}
  37   1      }
  38          
  39          //#pragma disable
  40          /*write lcd control instruct*/
  41          void lcd_ctrl(uchar dat)
  42          {
  43   1              lcd_st01();
  44   1              lcd_control=dat;
  45   1      }
  46          
  47          //#pragma disable
  48          /*write lcd data */
  49          void lcd_write(uchar dat)
  50          {
  51   1              lcd_st01();
  52   1              lcd_data=dat;
  53   1      }
  54          
  55          //#pragma disable
C51 COMPILER V7.06   LCD                                                                   09/06/2007 21:49:07 PAGE 2   

  56          /*auto write*/
  57          void lcd_autowrite(uchar dat)
  58          {
  59   1              lcd_st3();
  60   1              lcd_data=dat;
  61   1      }
  62          
  63          /*      液晶初始化程序  */
  64          //#pragma disable
  65          /*lcd initial*/
  66          void lcd_initial()
  67          {
  68   1       /*text start address */
  69   1              lcd_write(0x00);lcd_write(0x10);lcd_ctrl(0x40);//1000H
  70   1       /*set text zone width */
  71   1              lcd_write(0x10);lcd_write(0x00);lcd_ctrl(0x41);//0000H
  72   1       /*graph start address */
  73   1              lcd_write(0x00);lcd_write(0x00);lcd_ctrl(0x42);//
  74   1       /*set graph zone width*/
  75   1              lcd_write(0x10);lcd_write(0x00);lcd_ctrl(0x43);
  76   1       /*cgrom 00h~7fh,cgram 80h~ffh ,logical or */
  77   1              lcd_ctrl(0x80);
  78   1       /*open text,graph and close cursor */
  79   1              lcd_ctrl(0x9c);
  80   1       /*cursor shape :8*8 */
  81   1          lcd_ctrl(0xa0);
  82   1       /*cursor position*/
  83   1       lcd_write(0x0f);lcd_write(0x09);lcd_ctrl(0x21);
  84   1      }
  85          
  86          /*      清空T6963控制器内存,共8K*/
  87          void lcd_clear_ram()
  88          {
  89   1              uint i;
  90   1              lcd_write(0x00);lcd_write(0x00);lcd_ctrl(0x24);
  91   1              lcd_ctrl(0xb0);
  92   1              for(i=0;i<8192;i++)
  93   1              {
  94   2                      lcd_autowrite(0x00);
  95   2              }
  96   1              lcd_ctrl(0xb2);
  97   1      }
  98          
  99          void lcd_clear(uchar x,uchar y,uchar m ,uchar n ){   //任意长度的清屏函数
 100   1                                                           //x,y分别是128,64内对应的地址
 101   1                                                                                                               //m,n分别是所要清的内容的长和宽
 102   1              uint i,j;
 103   1              for(i=0;i<n;i++)
 104   1                for(j=0;j<m;j++){
 105   2                        showdot0(x+j,y-i);             
 106   2                }
 107   1      }
 108          
 109          
 110          /*      以下是图形显示子程序    */
 111          
 112          /*set graph x and y */
 113          /* 0------------->x */
 114          /* |                */
 115          /* |                */
 116          /* |                */
 117          /*\|/               */
C51 COMPILER V7.06   LCD                                                                   09/06/2007 21:49:07 PAGE 3   

 118          /* y                */
 119          /*      如果是采用清华蓬远T240128图形点阵液晶   */
 120          /*      下面这个函数lcd_set_graph()中第二条语句*/
 121          /*      y应该乘以30(240/30)其他型号依此类推*/
 122          void lcd_set_graph(uint x,uint y)           //将图形在屏幕上的图形地址转化为内存里的地址
 123          {
 124   1              uint xy;
 125   1              xy=y*16+x;lcd_write(xy&0xff);
 126   1              xy=xy/256;//must use 256,not 0xff
 127   1              lcd_write(xy);lcd_ctrl(0x24);
 128   1      }
 129          
 130          
 131          
 132          /* display 8 dots*/
 133          void lcd_disp8(uchar dat)       //在一个地址__8位里打点,dat是几就打对应位子的点
 134          {       lcd_write(dat);
 135   1              lcd_ctrl(0xc0);
 136   1      }
 137          
 138          void showdot(unsigned int x,unsigned int y){      //在任意位置显示一个点
 139   1           lcd_set_graph(x/8,63-y);
 140   1           lcd_ctrl(7-x%8+0xf8);
 141   1      }
 142          
 143          void showdot0(unsigned int x,unsigned int y){      //在任意一个点处显示一点空白
 144   1           lcd_set_graph(x/8,63-y);
 145   1           lcd_ctrl(7-x%8+0xf0);
 146   1      }
 147          
 148          
 149          
 150          /*      显示16x8图形点阵的子程序*/ 
 151          /*      字符库为asc[]*/
 152          
 153          void lcd_disp1608(uint x,uint y,uchar n)       //在某一位置处显示显示一个字符 n表该字符在数组中的序号
 154          {                                              //显示字符,上下间间隔1,左右间间隔1
 155   1              uchar i;  uint j;
 156   1              for(i=0;i<16;i++)
 157   1              {
 158   2                      lcd_set_graph(x,y+i);
 159   2                      j=n*16+i;
 160   2                      lcd_disp8(asc8[j]);
 161   2              }
 162   1      }
 163          
 164          /**************************************************************************/
 165          /*      显示8*8的ASC字母                                                  */
 166          /**************************************************************************/
 167          void  lcd_disp88( uchar x, uchar y, char* s, uchar xor )//横向,纵向按字节
 168          {
 169   1        uchar name, i;                                      //要想能滑动显示最好用些种方法显示字符或字符串
 170   1        uint start;
 171   1        while ( *s )
 172   1        {
 173   2          name = * s;
 174   2          start = ( name - 32 )* 8;
 175   2          for ( i = 0; i < 8; i++ )
 176   2          {
 177   3            lcd_set_graph( x, y + i );
 178   3            if ( xor == 0 )
 179   3            {
C51 COMPILER V7.06   LCD                                                                   09/06/2007 21:49:07 PAGE 4   

 180   4              lcd_disp8( nAsciiDot[start + i] );
 181   4            }
 182   3            if ( xor == 1 )
 183   3            {
 184   4              lcd_disp8( 255-nAsciiDot[start + i] );
 185   4            }
 186   3          }
 187   2          s += 1;
 188   2          x += 1;
 189   2          if ( x >= 16 )
 190   2          { x=0;
 191   3            y += 8;
 192   3          }
 193   2        }
 194   1      }
 195          
 196          
 197          
 198          /*      显示16x16图形点阵的子程序*/ 

⌨️ 快捷键说明

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