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

📄 66666666.lst

📁 液晶MGLS2401128TA的控制程序
💻 LST
字号:
C51 COMPILER V7.08   66666666                                                              08/09/2005 11:55:37 PAGE 1   


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

line level    source

   1          #include <AT89X51.H>
   2          sbit CS=P0^2;
   3          sbit WRITE=P3^6;
   4          sbit READ=P3^7;
   5          sbit CD=P0^3;
   6          sbit LED=P3^4;
   7          unsigned char x,y;
   8           char psin[18]={0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0};
   9          
  10          void check(void);
  11          void w_data(unsigned char d);
  12          void w_command(unsigned char d);
  13          void draw(x,y);
  14          //发送数据
  15          void w_data(unsigned char d)
  16          {CS=0;
  17   1      
  18   1      check();
  19   1      
  20   1      CD=0;P0=d;WRITE=0;WRITE=1;
  21   1      
  22   1      CS=1;
  23   1      
  24   1      }
  25          
  26          //发送命令
  27          
  28          void w_command(unsigned char d)
  29          
  30          {CS=0;
  31   1      check();
  32   1      CD=1;P0=d;WRITE=0;WRITE=1;
  33   1      CS=1;
  34   1      }
  35          
  36          //查状态
  37          
  38          void check(void)
  39          {unsigned char M;
  40   1      
  41   1      do{P0=0xff;
  42   2      
  43   2      CD=1;READ=0;
  44   2      
  45   2      M=P0;
  46   2      
  47   2      READ=1;
  48   2      
  49   2      }
  50   1      while((M&0x03)<0x03);
  51   1      
  52   1      }
  53          
  54          //画点
  55          
C51 COMPILER V7.08   66666666                                                              08/09/2005 11:55:37 PAGE 2   

  56          void draw(x,y)
  57          
  58          {unsigned int m;
  59   1      
  60   1      unsigned char n,t;
  61   1      
  62   1      n=0x12;
  63   1      
  64   1      t=0x34;
  65   1      
  66   1      m=(y&0x7f)*0x20;
  67   1      
  68   1      n=x/8;
  69   1      
  70   1      t=m-(m/0x100)*0x100+n;
  71   1      w_data(t);
  72   1      t=m/0x100+0x08;
  73   1      w_data(t);
  74   1      w_command(0x24);
  75   1      
  76   1      if(y>=0x80) n=0xf8;
  77   1      
  78   1      else n=0xf0;
  79   1      t=x%8;
  80   1      t=(~t)&0x07;
  81   1      t=n|t;
  82   1      w_command(t);
  83   1      }
  84          
  85          
  86          void init(void)
  87          {
  88   1      w_data(0x00);
  89   1      w_data(0x00);
  90   1      w_command(0x40);
  91   1      
  92   1      w_data(0x20);
  93   1      w_data(0x00);
  94   1      w_command(0x41);
  95   1      
  96   1      w_data(0x00);
  97   1      w_data(0x08);
  98   1      w_command(0x42);
  99   1      
 100   1      w_data(0x20);
 101   1      w_data(0x00);
 102   1      w_command(0x43);
 103   1      
 104   1      w_command(0xa7);
 105   1      w_command(0x80);
 106   1      w_command(0x9c);
 107   1      }
 108          void clear(void)
 109          {unsigned int i;
 110   1      
 111   1      w_data(0x00);
 112   1      w_data(0x00);
 113   1      w_command(0x24);
 114   1      
 115   1      w_command(0xb0);
 116   1      for(i=0;i<128;i++)
 117   1      {check();
C51 COMPILER V7.08   66666666                                                              08/09/2005 11:55:37 PAGE 3   

 118   2      w_data(0x0f);
 119   2      }
 120   1      w_command(0xb2);
 121   1      
 122   1      }
 123          void main(void)
 124          {LED=0;
 125   1      init();
 126   1      clear();
 127   1      for(x=0;x<18;x++)
 128   1      {
 129   2      y=psin[x];
 130   2      y=y|0x80;
 131   2      draw(x,y);
 132   2      }
 133   1      LED=1;
 134   1      while(1){}
 135   1      
 136   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    355    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     20      12
   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 + -