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

📄 sed1335io.lst

📁 320*240点阵液晶(sed1335)驱动程序,keil c调试通过,io连接方式
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V7.50   SED1335IO                                                             11/17/2005 00:02:00 PAGE 1   


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

line level    source

   1          
   2          /******************************************************
   3          sed1335模拟io读写程序(8080模式)
   4          c51 sed1335模拟io读写程序(8080模式)
   5          
   6          
   7          condition:
   8          controller pcb: ACP-LCM-1.53
   9          controller:  sed1335
  10            timing mode:  8080
  11            compiler:  keil c51 
  12          
  13          target: LM32019T display test
  14          
  15          designer: hex
  16          ********************************************************
  17          I/O configure:
  18          1-8.DB0-DB7-----------P2
  19          9.A0------------------P3.5
  20          10.RD-----------------P3.7
  21          11.WR-----------------P3.6
  22          12.CS-----------------P3.3
  23          13.RST----------------P3.4
  24          14.VDD
  25          15.VSS
  26          ********************************************************/
  27          
  28          #include <REG1210.H>
  29          #include "bin.h"
  30          #include "comm.h" 
  31          #include "1210_Key_Disp.h"
  32          
  33          //#include<reg51.h>
  34          #include<stdio.h>
  35          #include<stdlib.h>
  36          #include<string.h>
  37          #include<math.h>
  38          
  39          #define system_set      0x40    //初始化设置
  40          #define sleep_in                0x53    //休闲模式设置
  41          #define disp_on                 0x59    //显示状态设置
  42          #define disp_off                0x58    //显示状态设置
  43          #define scroll                  0x44    //显示域设置
  44          #define scrform                 0x5d    //光标形状设置
  45          #define cgram_adr               0x5c    //CGRAM首址设置
  46          #define csrdir_right    0x4c    //光标移动方向设置
  47          #define csrdir_left     0x4d    //光标移动方向设置
  48          #define csrdir_up               0x4e    //光标移动方向设置
  49          #define csrdir_down     0x4f    //光标移动方向设置
  50          #define hdot_scr                0x5a    //电位移设置
  51          #define ovlay                   0x5b    //显示合成设置
  52          #define csrw                    0x46    //光标指针设置
  53          #define csrr                    0x47    //读取光标指针
  54          #define mwrite                  0x42    //数据写入
  55          #define mread                   0x43    //数据读取
C51 COMPILER V7.50   SED1335IO                                                             11/17/2005 00:02:00 PAGE 2   

  56          
  57          
  58          
  59          sbit write=P3^6;                //写数据或命令信号
  60          sbit read=P3^7;                 //读数据或命令信号
  61          sbit cs=P3^5;                   //片选 low
  62          sbit a0=P3^4;                   //数据或命令的选择信号
  63          sbit rst=P3^3;                  //复位信号 low
  64          
  65          #define databus                 P0              //数据总线
  66          sbit key=P1^0;
  67          
  68          
  69          /*
  70          unsigned char code system_set_ini[8]={
  71                                                                                          0x34,
  72                                                                                          0x87,
  73                                                                                          0x07,
  74                                                                                          0x27,
  75                                                                                          0x4a,
  76                                                                                          0xf0,
  77                                                                                          0x28,
  78                                                                                          0x00
  79                                                                                  };
  80          */
  81          /*
  82          P1      0  0  B  1      W/S  M2  M1  M0
  83          B:调整负向显示字符时的屏面边界,
  84                          通常B=1
  85                          B=0:画面首行为边界;B=1:无边界。
  86          W/S:驱动器系统配置。
  87                  W/S=0   为单屏结构LCD的驱动系统;
  88                  W/S=1   为双屏结构LCD的驱动系统。
  89          M2: 选择外部字符发生器的字符点阵格式;
  90                  M2=0:  8×8点阵字体
  91                  M2=1:  8×16点阵字体
  92          M1: 选择外部发生器CGRAM的字符代码范围:
  93                  M1=0:  选择80H-9FH范围字符代码;
  94                  M1=1:  选择80H-9FH和E0H-FFH两个范围的字符代码。
  95          M0: 内、外字符发生器的选择
  96                  M0=0    为内部字符发生器有效;
  97                  M0=1    为外部字符发生器有效,此时内部字符发生器被屏蔽,字符代码全部供给外部字符发生器使用。
  98          
  99          P1=B0011_0100
 100          
 101          P2      WF    0    0    0    0   fill  FX fill
 102          WF:选择驱动器的交流驱动器的波形,通常WF=1
 103          FX:显示字符的宽度,FX=字符高+字间距,FX=0-7H
 104          
 105          P3          0    0    0    0   fill   FY  fill fill
 106          FY:显示字符的高度,FY=字符高+行间距,FY=0-FH
 107          
 108          P4      fill fill fill  C/R  fill fill fill fill
 109          C/R:   设置有效显示窗口的长度。C/R表示在LCD上有效显示的字符数。
 110                  比如:LCD一行能显示30个字符,C/R设置为30,则一行全显示满了;
 111                  若C/R设置为25,则LCD一行左起显示25个字符而后5个字符位置为空白。C/R取值在00H-EFH。
 112          
 113          P5     fill fill fill   TC/R  fill fill fill fill 
 114          TC/R:将晶振频率fosc转换成LCD工作频率的时间常数,TC/R由公式:
 115                   fosc≥TC/R×9×L/F×FR
 116                   TC/R≥C/R+4
 117                  联合求解。一般情况下的简便计算,以C/R+4的值设置即可。其中L/F为扫描点行数,FR为LCD驱动频率,
C51 COMPILER V7.50   SED1335IO                                                             11/17/2005 00:02:00 PAGE 3   

 118                  通常FR=70Hz
 119          P6      fill fill fill  L/F fill fill fill fill 
 120          L/F:LCD的点行数,取值在00H-FFH范围内。
 121          P7      fill fill fill  APL  fill fill fill fill 
 122          P8      fill fill fill  APH  fill fill fill fill 
 123          AP:    显示屏一行所占显示缓冲区的字节数,AP为双字节参数:APH高8位,APL低8位。通常取:AP=C/R+1
 124          */
 125          unsigned char code system_set_ini[8]={
 126                                                                                          B0011_0100,
 127                                                                                          B1000_0111,
 128                                                                                          0x07,
 129                                                                                          0x27,
 130                                                                                          0x4a,
 131                                                                                          0xf0,
 132                                                                                          0x28,
 133                                                                                          0x00,
 134                                                                                  };
 135          
 136          unsigned char code scroll_ini1[6]={0x00,0x00,0xef,0x60,0x09,0xf0};
 137          unsigned char code scroll_ini2[6]={0xb0,0x04,0x1e,0x60,0x09,0xf0};
 138          unsigned char code scrform_ini[2]={0x07,0x86};
 139          unsigned char code hdot_scr_ini[2]={0x00,0x0b};
 140          unsigned char code ovlay_ini[1]={0x01};
 141          unsigned char code disp_on_ini[1]={0x16};
 142          unsigned char code disp_off_ini[1]={0x00};
 143          unsigned char code cur_set_ini[2]={0x28,0x00};
 144          unsigned char code cur_set_ini1[2]={0x00,0x00};
 145          unsigned char code cur_set_ini2[2]={0xb8,0x04};
 146          unsigned char code cur_set_ini3[2]={0x60,0x09};
 147          
 148          
 149          unsigned char code word1[]={0x41,0x4e,0x44,0x4f,0x52,0x49,0x4e,0x20,0x4f,0x50,0x54,0x4f,0x45,0x4c,0x45,0x4
             -3,
 150                                                                  0x20,0x54,0x45,0x43,0x48,0x4e,0x4f,0x4c,0x4f,0x47,0x59,0x20,0x4c,0x54,0x44,0xa5,0x43,0x4f};
 151          unsigned char code word2[8]={0x20,0x41,0x4e,0x44,0x4f,0x52,0x49,0x4e};
 152          unsigned char code word3[]={0x00};
 153          unsigned char code send[32]={0x21,0x31, 0x41,0x51,0x61,0x71,0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0
             -x39};
 154          unsigned char code null[1]={0x00};
 155          unsigned char code block_cur_set[2]={0x60,0x09};
 156          unsigned char code an[32]={0x02,0x01,0x3F,0x20,0x44,0x06,0x04,0xFF,0x08,0x08,0x08,0x06,0x01,0x06,0x18,0xE0
             -,
 157                                                                  0x00,0x00,0xFE,0x04,0x08,0x00,0x00,0xFE,0x20,0x20,0x40,0x80,0x00,0xC0,0x38,0x10};
 158          
 159          
 160          unsigned char code hex1[1]={0xaa};
 161          unsigned char code hex2[1]={0x55};
 162          unsigned char code fill[1]={0XFF};
 163          unsigned char code kright[1]={0X01};
 164          unsigned char code kleft[1]={0x80};
 165          unsigned char code hex3[1]={0x20};
 166          
 167          
 168          
 169          unsigned char code an1[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x07,
 170          0x3F,0x7C,0x30,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
 171          0x05,0x05,0x03,0x27,0x7F,0x7F,0xFF,0xF6,0xE6,0xCE,0x0D,0x3F,0xFC,0xB8,0x7F,0x7F,
 172          0x27,0x0F,0x1F,0x7C,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xF8,0xFC,
 173          0x9C,0x3C,0x38,0x60,0xC0,0x60,0x30,0xFF,0xFF,0xE0,0xE0,0xC0,0xC0,0xF0,0xFC,0x1E,
 174          0x0F,0x07,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 175          0x00,0x00,0x00,0x00,0xC0,0xE0,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 176          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};//安
C51 COMPILER V7.50   SED1335IO                                                             11/17/2005 00:02:00 PAGE 4   

 177          
 178          unsigned char code de[]={0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x01,0x07,0x08,0x08,0x0C,0x0D,0x0F,0x0F,0x0E,
 179          0x0F,0x0F,0x07,0x07,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 180          0x00,0xC0,0xE1,0xE1,0xE2,0x82,0x34,0xFD,0xBF,0xBF,0x7D,0xFD,0xDF,0xDA,0x9B,0xBB,
 181          0xF9,0xF1,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xB0,0xB0,0xB0,
 182          0x70,0x60,0x60,0xFC,0xFF,0xE3,0x83,0x03,0xC3,0xE3,0xE7,0x47,0x06,0x8E,0xFE,0xFC,
 183          0x78,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 184          0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 185          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};//的
 186          
 187          unsigned char code li[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x07,0x08,0x00,0x01,0x03,0x3F,0x1F,0x0E,
 188          0x00,0x01,0x03,0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 189          0x0C,0x1E,0x3E,0xF8,0xEC,0x9E,0x3E,0x78,0xF8,0xF8,0xB9,0x3B,0x7E,0xFC,0xF8,0xF0,
 190          0xF0,0x30,0x30,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x0E,0x16,
 191          0x16,0x96,0xE6,0xE6,0xE6,0xE4,0xE4,0xE4,0xC4,0x44,0x44,0x04,0x04,0x06,0xC6,0x7E,
 192          0x3E,0x1E,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 193          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 194          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};//利
 195          
 196          unsigned char code guang[];
 197          unsigned char code dian[];
 198          unsigned char code ke[];
 199          unsigned char code ji[];
 200          unsigned char code ando[];
 201          unsigned char code tu1[];
 202          unsigned char code tu2[];
 203          unsigned char code box[];
 204          
 205          /*
 206          void delay(int t)
 207          {
 208                  int i=0;
 209                  for(i=0;i<t;i++);
 210          }
 211          */
 212          
 213          void long_delay(int t)
 214          {
 215   1              int i=0;
 216   1              int n;
 217   1              for(i=0;i<t;i++)
 218   1              {
 219   2                      for(n=0;n<1000;n++);
 220   2              }
 221   1      }
 222          
 223          void sed1335_write(char commandcode, unsigned char code *parameter,int n)
 224          {
 225   1              int i=0;
 226   1              
 227   1              a0=1;
 228   1              read=1;
 229   1              databus=commandcode;
 230   1              write=0;
 231   1              write=1;
 232   1              
 233   1              for(i=0;i<n;i++)
 234   1              {
 235   2                      a0=0;
 236   2                      read=1;
 237   2                      databus=parameter[i];
 238   2                      write=0;
C51 COMPILER V7.50   SED1335IO                                                             11/17/2005 00:02:00 PAGE 5   

 239   2                      write=1;
 240   2              }
 241   1      }
 242          
 243          //在图形层写一个汉字//
 244          void sed1335_write1(char commandcode,char low,int high)
 245          {

⌨️ 快捷键说明

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