📄 display_320_240.lst
字号:
C51 COMPILER V7.06 DISPLAY_320_240 02/25/2007 18:14:53 PAGE 1
C51 COMPILER V7.06, COMPILATION OF MODULE DISPLAY_320_240
OBJECT MODULE PLACED IN display_320_240.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE display_320_240.c BROWSE DEBUG OBJECTEXTEND
stmt level source
1 #include <reg52.h>
2 #include <absacc.h>
3 #include "display_fun.h"
4
5
6 #ifndef uchar
7 #define uchar unsigned char
8 #endif
9
10 sbit lcd_a0=P3^7;
11 sbit lcd_cs=P1^3;
12 sbit lcd_rst=P1^4;
13 sbit lcd_wr=P3^6;
14 sbit lcd_rd=P1^2;
15
16 #define AP 0x2a
17 #define LENGTH 0xfa //波形区域宽度250
18 #define WIDTH 0xc8 //波形区域高度200
19
20 uchar code sys[8]={0x30,0x87,0x07,0x27,0x2a,0xef,0x2a,0}; /*P1-P8*/
21 uchar code scr[10]={0,0,0xef,0x00,0x28,0xef,0x00,0x50,0,0}; /*P1-P10*/
22 uchar code arr[8]={0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01};
23
24 /***************************************************************
25 *名称:outcode(uchar code_data)
26 *描述:向液晶屏输出指令代码
27 *参数:指令代码
28 *返回:
29 ****************************************************************/
30 void outcode(uchar code_data)//输出指令代码
31 {
32 1 lcd_cs=0;
33 1 lcd_a0=1;
34 1 lcd_rd=1;lcd_wr=1;
35 1 P0=code_data;
36 1 lcd_wr=0;
37 1 lcd_wr=1;
38 1 lcd_cs=1;
39 1 }
40 /***************************************************************
41 *名称:outdata(uchar data_data)
42 *描述:向液晶屏输出指令参数
43 *参数:指令参数
44 *返回:
45 ****************************************************************/
46 void outdata(uchar data_data)//输出指令参数
47 {
48 1 lcd_cs=0;
49 1 lcd_a0=0;
50 1 lcd_rd=1;
51 1 lcd_wr=1;
52 1 P0=data_data;
53 1 lcd_wr=0;
54 1 lcd_wr=1;
55 1 lcd_cs=1;
C51 COMPILER V7.06 DISPLAY_320_240 02/25/2007 18:14:53 PAGE 2
56 1 }
57 /***************************************************************
58 *名称:uchar indata(void)
59 *描述:从液晶屏输入数据
60 *参数:
61 *返回:输入数据
62 ****************************************************************/
63 uchar indata(void)//输入数据
64 {
65 1 uchar data_data;
66 1 lcd_cs=0;
67 1 lcd_a0=1;
68 1 P0=0xff;
69 1 lcd_wr=1;
70 1 lcd_rd=0;
71 1 data_data=P0;
72 1 lcd_rd=1;
73 1 lcd_cs=1;
74 1 return data_data;
75 1 }
76 /***************************************************************
77 *名称:turnoff(void)
78 *描述:关闭液晶屏
79 *参数:
80 *返回:
81 ****************************************************************/
82 void turnoff(void)
83 {
84 1 outcode(0x58);//off screen
85 1 outdata(0x00);
86 1 }
87 /***************************************************************
88 *名称:turnon(void)
89 *描述:开启液晶屏
90 *参数:
91 *返回:
92 ****************************************************************/
93 void turnon(void)
94 {
95 1 outcode(0x59);//on screen
96 1 outdata(0x55);
97 1 }
98 /***************************************************************
99 *名称:initram(void)
100 *描述:清屏(3层)
101 *参数:
102 *返回:
103 ****************************************************************/
104 void initram(void)
105 {//显示存储器清零
106 1 unsigned int i;
107 1 outcode(0x4c);
108 1 outcode(0x46);
109 1 outdata(0x00);
110 1 outdata(0x00);
111 1 outcode(0x42);//clear screen memory
112 1 for(i=0;i<0x7800;)//24478,32768,0x7800,0x58e5
113 1 {
114 2 outdata(0x00);
115 2 i++;
116 2 }
117 1 }
C51 COMPILER V7.06 DISPLAY_320_240 02/25/2007 18:14:53 PAGE 3
118 /***************************************************************
119 *名称:initram_1(void)
120 *描述:清屏(first1层)
121 *参数:
122 *返回:
123 ****************************************************************/
124 void initram_1(void)
125 {//显示存储器清零
126 1 unsigned int i;
127 1 outcode(0x4c);
128 1 outcode(0x46);
129 1 outdata(0x00);
130 1 outdata(0x00);
131 1 outcode(0x42);//clear screen memory
132 1 for(i=0;i<0x2800;i++)//24478,32768,0x7800,0x58e5
133 1 {
134 2 outdata(0x00);
135 2 }
136 1 }
137 /***************************************************************
138 *名称:init(void)
139 *描述:初始化程序
140 *参数:
141 *返回:
142 ****************************************************************/
143 void init(void)
144 {
145 1 int n;
146 1 outcode(0x40); /*SYSTEM SET 指令代码*/
147 1 for(n=0;n<8;n++)outdata(sys[n]); /*将参数P1-P8 写入*/
148 1 outcode(0x44); /*SCROLL 指令代码*/
149 1 for(n=0;n<10;n++)outdata(scr[n]); /*将参数P1-P10 写入*/
150 1 outcode(0x5a); /*HDOT SCR——P1 清零复位*/
151 1 outdata(0);
152 1 outcode(0x5b); /*OVLAY—*/
153 1 outdata(0x1c);
154 1 }
155 /***************************************************************
156 *名称:WriteD(uchar x,uchar y)
157 *描述:在第一层写一个点
158 *参数:点的坐标位置(x,y)
159 *返回:
160 ****************************************************************/
161 void WriteD(uchar x,uchar y) //write a dot on the 1nd layer
162 {
163 1 unsigned int address;
164 1 uchar addh,addl;
165 1 uchar m=0,n;
166 1 address=0x01f9+x/8+y*AP;
167 1 addh=address>>8;//addh=address/256;
168 1 addl=(uchar)address;//addl=address%256;
169 1 n=x%8;
170 1 outcode(0x46);
171 1 outdata(addl);
172 1 outdata(addh);
173 1 outcode(0x43);
174 1 m=indata();
175 1 m=m|arr[n];
176 1 outcode(0x46);
177 1 outdata(addl);
178 1 outdata(addh);
179 1 outcode(0x42);
C51 COMPILER V7.06 DISPLAY_320_240 02/25/2007 18:14:53 PAGE 4
180 1 outdata(m);
181 1 }
182 /***************************************************************
183 *名称:WriteD2(uchar x,uchar y)
184 *描述:在第二层写一个点
185 *参数:点的坐标位置(x,y)
186 *返回:
187 ****************************************************************/
188 void WriteD2(uchar x,uchar y) //write a dot on the 2nd layer
189 {
190 1 unsigned int address;
191 1 uchar addh,addl;
192 1 uchar m=0,n=0;
193 1 address=0x29f9+x/8+y*AP;
194 1 addh=address>>8;//addh=address/256;
195 1 addl=(uchar)address;//addl=address%256;
196 1 outcode(0x46);
197 1 outdata(addl);
198 1 outdata(addh);
199 1 outcode(0x43);
200 1 m=indata();
201 1 n=x%8;
202 1 m=m|arr[n];
203 1 outcode(0x46);
204 1 outdata(addl);
205 1 outdata(addh);
206 1 outcode(0x42);
207 1 outdata(m);//m
208 1 }
209 /***************************************************************
210 *名称:Hori(uchar y,uchar space)
211 *描述:在第二层画水平网格线
212 *参数:网格的行数、空的点数
213 *返回:
214 ****************************************************************/
215 void Hori(uchar y,uchar space) //画水平网格线
216 {
217 1 uchar i;
218 1 outcode(0x4c);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -