📄 dian.lst
字号:
C51 COMPILER V7.06 DIAN 10/20/2008 10:56:41 PAGE 1
C51 COMPILER V7.06, COMPILATION OF MODULE DIAN
OBJECT MODULE PLACED IN dian.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE dian.c BROWSE DEBUG OBJECTEXTEND
stmt level source
1 /*
2 ________________________________________________________________________
3 这个是在别人的基础上改的,别人只给出了左右移的程序,其他是
4 自己写的,共六种显示模式,按了键立即改变模式(实时性,呵呵)
5 程序有许不足(最突出的是时间没设置好),感觉时间不好设置.
6 希望大家提出宝贵的意见,大家共同交流.
7
8 */
9 #include<at89x51.h>
10 #define uchar unsigned char
11 #define uint unsigned int
12 uchar speed=15;
13 sbit ST=P3^5;
14 sbit SH=P3^6;
15 sbit DATA=P3^7;
16 sbit EN=P2^4;
17 sbit K1=P1^0;
18 sbit K2=P1^1;
19 sbit K3=P1^2;
20 sbit K4=P1^3;
21 sbit K5=P1^4;
22 sbit K6=P1^5;
23 bit LeftFlag;
24 bit RightFlag;
25 bit UpFlag;
26 bit DownFlag;
27 bit ZJ1Flag;
28 bit ZJ2Flag=1; //开始显示模式6
29 void delay(uchar ms)
30 {
31 1 uchar y;
32 1 for(;ms>0;ms--)
33 1 for(y=120;y>0;y--);
34 1 }
35 uchar code hanzi[][32]={
36 /*宜 CB4FA */
37 {0x01,0x00,0x00,0x80,0x3F,0xFE,0x20,0x04,0x40,0x08,0x0F,0xE0,0x08,0x20,0x08,0x20,
38 0x0F,0xE0,0x08,0x20,0x08,0x20,0x0F,0xE0,0x08,0x20,0x08,0x20,0x7F,0xFE,0x00,0x00,},
39
40 /*春 CB4BA */
41 {0x01,0x00,0x01,0x00,0x3F,0xFC,0x01,0x00,0x1F,0xF8,0x02,0x00,0xFF,0xFE,0x04,0x20,
42 0x08,0x18,0x3F,0xEE,0xC8,0x24,0x0F,0xE0,0x08,0x20,0x08,0x20,0x0F,0xE0,0x00,0x00,},
43
44 /*学 CD1A7 */
45 {0x01,0x08,0x10,0x8C,0x0C,0xC8,0x08,0x90,0x7F,0xFE,0x40,0x04,0x8F,0xE8,0x00,0x40,
46 0x00,0x80,0x7F,0xFE,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x02,0x80,0x01,0x00,},
47
48 /*院 CD4BA */
49 {0x00,0x80,0xF8,0x40,0x8F,0xFE,0x94,0x04,0xA0,0x00,0xA3,0xF8,0x90,0x00,0x88,0x00,
50 0x8F,0xFE,0xA9,0x20,0x91,0x20,0x81,0x20,0x82,0x22,0x82,0x22,0x84,0x22,0x88,0x1E,},
51
52 /*欢 CBBB6 */
53 {0x00,0x80,0x00,0x80,0xFC,0x80,0x05,0xFE,0x85,0x04,0x4A,0x48,0x28,0x40,0x10,0x40,
54 0x18,0x40,0x18,0x60,0x24,0xA0,0x24,0x90,0x41,0x18,0x86,0x0E,0x38,0x04,0x00,0x00,},
55
C51 COMPILER V7.06 DIAN 10/20/2008 10:56:41 PAGE 2
56 /*迎 CD3AD */
57 {0x40,0x00,0x21,0x80,0x36,0x7C,0x24,0x44,0x04,0x44,0x04,0x44,0xE4,0x44,0x24,0x44,
58 0x25,0x44,0x26,0x54,0x24,0x48,0x20,0x40,0x20,0x40,0x50,0x00,0x8F,0xFE,0x00,0x00,},
59
60 /*您 CC4FA */
61 {0x08,0x00,0x09,0x00,0x11,0xFE,0x12,0x04,0x34,0x40,0x32,0x50,0x52,0x48,0x94,0x44,
62 0x11,0x44,0x10,0x80,0x00,0x00,0x29,0x04,0x28,0x92,0x68,0x12,0x07,0xF0,0x00,0x00},
63 //"!"
64 {0x00,0x00,0x01,0x80,0x03,0xC0,0x03,0xC0,0x03,0xC0,0x03,0xC0,0x03,0xC0,0x01,0x80,
65 0x01,0x80,0x01,0x80,0x00,0x00,0x01,0x80,0x03,0xC0,0x01,0x80,0x00,0x00,0x00,0x00},
66
67 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
68 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
69
70 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,}
71
72 };
73 void SendByte(uchar a)
74 {
75 1 uchar byte,i;
76 1 byte=~a;
77 1 for(i=0;i<8;i++)
78 1 {
79 2 SH=0;
80 2 if(byte&0X80)
81 2 DATA=1;
82 2 else
83 2 DATA=0;
84 2 SH=1;
85 2 byte<<=1;
86 2 }
87 1 }
88 void LeftDisplay(void) //左移,半个字一移
89 {
90 1 uchar i,j,scan,k;
91 1 for(i=0;i<6;i++) //hanzi中10个字,因一下显示四个字,所以j最大为j=10-4=6;
92 1 {
93 2 if(LeftFlag==1) //使之按了其他的键立即退出,转到其他模式
94 2 {
95 3 for(k=0;k<speed;k++) //移动速度
96 3 {
97 4 scan=0; //154译码
98 4 if(LeftFlag==1) //这里同样做处理
99 4 {
100 5 for(j=0;j<31;j+=2)
101 5 {
102 6 ST=0;
103 6 SendByte(hanzi[i+3][j+1]);
104 6 SendByte(hanzi[i+3][j]);
105 6 SendByte(hanzi[i+2][j+1]);
106 6 SendByte(hanzi[i+2][j]);
107 6 SendByte(hanzi[i+1][j+1]);
108 6 SendByte(hanzi[i+1][j]);
109 6 SendByte(hanzi[i][j+1]);
110 6 SendByte(hanzi[i][j]);
111 6 ST=1; //一个上升沿送数据
112 6 EN=0;
113 6 P2=scan;
114 6 delay(5);
115 6 EN=1;
116 6 scan++;
117 6 }
C51 COMPILER V7.06 DIAN 10/20/2008 10:56:41 PAGE 3
118 5 }
119 4 else
120 4 break;
121 4 }
122 3 for(k=0;k<speed;k++)
123 3 {
124 4 scan=0;
125 4 if(LeftFlag==1)
126 4 {
127 5 for(j=0;j<31;j+=2)
128 5 {
129 6 ST=0;
130 6 SendByte(hanzi[i+4][j]); //另外半个字,注意这里,下面同理
131 6 SendByte(hanzi[i+3][j+1]);
132 6 SendByte(hanzi[i+3][j]);
133 6 SendByte(hanzi[i+2][j+1]);
134 6 SendByte(hanzi[i+2][j]);
135 6 SendByte(hanzi[i+1][j+1]);
136 6 SendByte(hanzi[i+1][j]);
137 6 SendByte(hanzi[i][j+1]);
138 6 ST=1;
139 6 EN=0;
140 6 P2=scan;
141 6 delay(5);
142 6 EN=1;
143 6 scan++;
144 6 }
145 5 }
146 4 else
147 4 break;
148 4 }
149 3 }
150 2 else
151 2 break;
152 2 }
153 1 }
154 void RightDisplay(void) //右移
155 {
156 1 uchar i,j,k,scan;
157 1 for(i=0;i<6;i++) //字加一
158 1 {
159 2 if(RightFlag==1)
160 2 {
161 3 for(k=0;k<speed;k++)
162 3 {
163 4 scan=0;
164 4 if(RightFlag==1)
165 4 {
166 5 for(j=0;j<31;j+=2)
167 5 {
168 6 ST=0;
169 6 SendByte(hanzi[i][j+1]);
170 6 SendByte(hanzi[i][j]);
171 6 SendByte(hanzi[i+1][j+1]);
172 6 SendByte(hanzi[i+1][j]);
173 6 SendByte(hanzi[i+2][j+1]);
174 6 SendByte(hanzi[i+2][j]);
175 6 SendByte(hanzi[i+3][j+1]);
176 6 SendByte(hanzi[i+3][j]);
177 6 ST=1;
178 6 EN=0;
179 6 P2=scan;
C51 COMPILER V7.06 DIAN 10/20/2008 10:56:41 PAGE 4
180 6 delay(5);
181 6 EN=1;
182 6 scan++;
183 6 }
184 5 }
185 4 else
186 4 break;
187 4 }
188 3 for(k=0;k<speed;k++)
189 3 {
190 4 scan=0;
191 4 if(RightFlag==1)
192 4 {
193 5 for(j=0;j<31;j+=2)
194 5 {
195 6 ST=0;
196 6 SendByte(hanzi[i][j]);
197 6 SendByte(hanzi[i+1][j+1]);
198 6 SendByte(hanzi[i+1][j]);
199 6 SendByte(hanzi[i+2][j+1]);
200 6 SendByte(hanzi[i+2][j]);
201 6 SendByte(hanzi[i+3][j+1]);
202 6 SendByte(hanzi[i+3][j]);
203 6 SendByte(hanzi[i+4][j+1]);
204 6 ST=1;
205 6 EN=0;
206 6 P2=scan;
207 6 delay(5);
208 6 EN=1;
209 6 scan++;
210 6 }
211 5 }
212 4 else
213 4 break;
214 4 }
215 3 }
216 2 else
217 2 break;
218 2 }
219 1 }
220 void UpDisplay(void) //上移
221 {
222 1 uchar i,j,k,scan;
223 1 char temp=0;
224 1 for(i=0;i<6;)
225 1 {
226 2 if(UpFlag==1)
227 2 {
228 3 for(k=0;k<speed;k++)
229 3 {
230 4 scan=15-temp; //译码从最底下开始
231 4 if(UpFlag==1)
232 4 {
233 5 for(j=0;j<2*temp+1;j+=2)
234 5 {
235 6 ST=0;
236 6 SendByte(hanzi[i+3][j+1]);
237 6 SendByte(hanzi[i+3][j]);
238 6 SendByte(hanzi[i+2][j+1]);
239 6 SendByte(hanzi[i+2][j]);
240 6 SendByte(hanzi[i+1][j+1]);
241 6 SendByte(hanzi[i+1][j]);
C51 COMPILER V7.06 DIAN 10/20/2008 10:56:41 PAGE 5
242 6 SendByte(hanzi[i][j+1]);
243 6 SendByte(hanzi[i][j]);
244 6 ST=1;
245 6 EN=0;
246 6 P2=scan;
247 6 delay(5);
248 6 EN=1;
249 6 scan++;
250 6 }
251 5 }
252 4 else
253 4 break;
254 4 }
255 3 temp++; //控制译码的
256 3 if(temp==16)
257 3 {
258 4 temp=0; //temp复位
259 4 i+=4; //显示下四个字
260 4 }
261 3 }
262 2 else
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -