📄 main7.lst
字号:
C51 COMPILER V7.06 MAIN7 05/20/2008 21:43:26 PAGE 1
C51 COMPILER V7.06, COMPILATION OF MODULE MAIN7
OBJECT MODULE PLACED IN main7.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE main7.c ROM(SMALL) BROWSE DEBUG OBJECTEXTEND
stmt level source
1 #include<reg51.h>
2 #include<intrins.h>
3 #define uchar unsigned char
4 #define uint unsigned int
5 #define staticdis 0x01
6 #define up 0x02
7 #define left 0x03
8
9 typedef struct typFNT_GB16 // 汉字字模显示数据结构
10 {
11 char Index[2];
12 char Msk[32];
13 };
14 struct typFNT_GB16 code GB_16[] = { // 显示为16*16
15 "中",0x01,0x00,0x01,0x00,0x21,0x08,0x3F,0xFC,0x21,0x08,0x21,0x08,0x21,0x08,0x21,0x08,0x21,0x08,0x3F,0xF8,0
-x21,0x08,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,
16 "文",0x02,0x00,0x01,0x00,0x01,0x00,0xFF,0xFE,0x08,0x20,0x08,0x20,0x08,0x20,0x04,0x40,0x04,0x40,0x02,0x80,0
-x01,0x00,0x02,0x80,0x04,0x60,0x18,0x1E,0xE0,0x08,0x00,0x00,
17 "测",0x40,0x02,0x27,0xC2,0x24,0x42,0x84,0x52,0x45,0x52,0x55,0x52,0x15,0x52,0x25,0x52,0x25,0x52,0x25,0x52,0
-xC5,0x52,0x41,0x02,0x42,0x82,0x42,0x42,0x44,0x4A,0x48,0x04,
18 "试",0x00,0x20,0x40,0x28,0x20,0x24,0x30,0x24,0x27,0xFE,0x00,0x20,0xE0,0x20,0x27,0xE0,0x21,0x20,0x21,0x10,0
-x21,0x10,0x21,0x0A,0x29,0xCA,0x36,0x06,0x20,0x02,0x00,0x00,
19 "衡",0x22,0x00,0x33,0xDE,0x44,0x40,0x58,0x80,0x97,0xC0,0x25,0x5E,0x67,0xC4,0xA5,0x44,0x27,0xC4,0x21,0x04,0
-x2F,0xE4,0x21,0x04,0x22,0x84,0x24,0x54,0x28,0x28,0x20,0x00,
20 "阳",0x00,0x00,0x7D,0xFC,0x45,0x04,0x49,0x04,0x49,0x04,0x51,0x04,0x49,0xFC,0x45,0x04,0x45,0x04,0x45,0x04,0
-x69,0x04,0x51,0x04,0x41,0xFC,0x41,0x04,0x40,0x00,0x40,0x00,
21 "师",0x08,0x00,0x0B,0xFE,0x48,0x20,0x48,0x20,0x4B,0xFE,0x4A,0x22,0x4A,0x22,0x4A,0x22,0x4A,0x22,0x52,0x22,0
-x52,0x2A,0x12,0x24,0x20,0x20,0x40,0x20,0x80,0x20,0x00,0x20,
22 "范",0x04,0x20,0x04,0x20,0xFF,0xFE,0x04,0x60,0x40,0x00,0x31,0xF8,0x91,0x08,0x61,0x08,0x49,0x08,0x09,0x38,0
-x11,0x10,0xE1,0x00,0x21,0x04,0x21,0x04,0x20,0xFC,0x20,0x00,
23 "学",0x01,0x08,0x10,0x8C,0x0C,0xC8,0x08,0x90,0x7F,0xFE,0x40,0x04,0x8F,0xE8,0x00,0x40,0x00,0x80,0x7F,0xFE,0
-x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x02,0x80,0x01,0x00,
24 "院",0x00,0x80,0xF8,0x40,0x8F,0xFE,0x94,0x04,0xA0,0x00,0xA3,0xF8,0x90,0x00,0x88,0x00,0x8F,0xFE,0xA9,0x20,0
-x91,0x20,0x81,0x20,0x82,0x22,0x82,0x22,0x84,0x22,0x88,0x1E,
25 "物",0x10,0x80,0x10,0x80,0x50,0x80,0x51,0xFC,0x7D,0x54,0x52,0x54,0x94,0x94,0x14,0x94,0x19,0x24,0x32,0x24,0
-xD4,0x44,0x10,0x84,0x11,0x04,0x12,0x04,0x14,0x28,0x00,0x10,
26 "理",0x00,0x00,0x03,0xFC,0xFA,0x44,0x22,0x44,0x23,0xFC,0x22,0x44,0xFA,0x44,0x23,0xFC,0x22,0x44,0x20,0x40,0
-x23,0xFC,0x38,0x40,0xC0,0x40,0x00,0x40,0x0F,0xFE,0x00,0x00,
27 "与",0x00,0x00,0x08,0x00,0x08,0x04,0x0F,0xFE,0x08,0x00,0x08,0x00,0x0F,0xFC,0x00,0x04,0x00,0x04,0x00,0x24,0
-x7F,0xF4,0x00,0x04,0x00,0x04,0x00,0x48,0x00,0x30,0x00,0x00,
28 "电",0x01,0x00,0x01,0x00,0x01,0x00,0x3F,0xF8,0x21,0x08,0x21,0x08,0x3F,0xF8,0x21,0x08,0x21,0x08,0x21,0x08,0
-x3F,0xF8,0x21,0x08,0x01,0x02,0x01,0x02,0x00,0xFE,0x00,0x00,
29 "子",0x00,0x00,0x3F,0xF0,0x00,0x20,0x00,0x40,0x00,0x80,0x01,0x00,0x01,0x00,0x01,0x04,0xFF,0xFE,0x01,0x00,0
-x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x05,0x00,0x02,0x00,
30 "信",0x08,0x80,0x0C,0x60,0x18,0x40,0x17,0xFE,0x30,0x00,0x33,0xF8,0x50,0x00,0x93,0xF8,0x10,0x00,0x13,0xF8,0
-x12,0x08,0x12,0x08,0x12,0x08,0x13,0xF8,0x12,0x08,0x00,0x00,
31 "息",0x01,0x00,0x02,0x00,0x1F,0xF0,0x10,0x10,0x1F,0xF0,0x10,0x10,0x1F,0xF0,0x10,0x10,0x1F,0xF0,0x00,0x00,0
-x09,0x00,0x28,0x84,0x28,0x92,0x68,0x12,0x07,0xF0,0x00,0x00,
32 "科",0x06,0x08,0x78,0x88,0x08,0x48,0x08,0x48,0xFE,0x08,0x18,0x88,0x1C,0x48,0x2A,0x48,0x28,0x0E,0x48,0x78,0
-x8B,0x88,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,
33 "学",0x01,0x08,0x10,0x8C,0x0C,0xC8,0x08,0x90,0x7F,0xFE,0x40,0x04,0x8F,0xE8,0x00,0x40,0x00,0x80,0x7F,0xFE,0
-x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x02,0x80,0x01,0x00,
34 "系",0x00,0x7C,0x3F,0x80,0x02,0x20,0x04,0x20,0x08,0x40,0x1F,0x80,0x03,0x20,0x0C,0x10,0x3F,0xF8,0x10,0x8C,0
-x04,0xA0,0x08,0x90,0x10,0x88,0x20,0x84,0x42,0x84,0x01,0x00,
35 };
C51 COMPILER V7.06 MAIN7 05/20/2008 21:43:26 PAGE 2
36 uchar code str1[]={"衡阳师范学院"};
37 uchar code str2[]={"衡阳师范学院物理与电子信息科学系"};
38 void timerinit(void);
39 void sioinit(void);
40 void initial(void);
41 void clrscree(void);
42 void clrindex(void);
43 void senddata(uchar i);
44 void row_dis(void);
45 void full_index(uchar *prt,uchar st_buf,uchar en_buf);
46 void l_databuf(uchar i);
47 void full_databuf(uchar effict);
48 void display(uchar *a,uchar effict,char st_space,char shfitspeed,int sta_time);
49 void timeIRQ(void);
50 void delay_s(uint k);
51 uchar str_longth(uchar *a);
52
53 uchar databuf[18];
54 uchar *dataindex[12];
55 uchar cbuf_flag,fullindex_flag,fulldata_flag;
56 uchar row_count,shift_count,shift_add,disen;
57 uchar *indexprt;
58 uint time_count,shfitspeed;
59 uchar st_space,en_space;
60
61 main()
62 {
63 1 initial();
64 1 while(1)
65 1 {
66 2 display(str1,staticdis,0,0,1000);
67 2 display(str2,up,10,100,0);
68 2 }
69 1 }
70
71
72
73 void timerinit(void)//3ms timer
74 {
75 1 TMOD=0x01;
76 1 TH0=(65535-600)/256;
77 1 TL0=(65535-600)%256;
78 1 IE=0x82;
79 1 }
80 void sioinit(void)// 方式0
81 {
82 1 SCON=0x00;
83 1 TI=0;
84 1 }
85 void initial(void)
86 {
87 1 timerinit();
88 1 sioinit();
89 1 fulldata_flag=1;
90 1 fullindex_flag=1;
91 1 time_count=0;
92 1 TR0=1;
93 1 }
94
95 /*********application function*******
96 静态显示、左移、右移
97 ************************************/
C51 COMPILER V7.06 MAIN7 05/20/2008 21:43:26 PAGE 3
98 void senddata(uchar j) //sio 口发送数据
99 {
100 1 j=~j;
101 1 SBUF=j;
102 1 while(TI==0);
103 1 TI=0;
104 1 }
105 void row_dis(void) //p1.0-a,p1.1-b,p1.2-c,p1.3-d st-p1.4 p1.5-en
106 {
107 1 uchar i=0,j=0,k;
108 1 for(i=0;i<16;i++)
109 1 {
110 2 j=databuf[15-i];
111 2 senddata(j);
112 2 }
113 1 k=~row_count&0x0f;
114 1 P1=k+0x20+0x10;
115 1 _nop_();
116 1 _nop_();
117 1 P1=k+0x20;
118 1 // P1=row_count+0x10;
119 1 // P1=row_count;
120 1 fulldata_flag=1;
121 1 row_count++;
122 1 if(row_count==16)row_count=0;
123 1 }
124 //*************************databuf 更新
125 void clrscree(void)
126 {
127 1 int i;
128 1 for(i=0;i<18;i+=2)
129 1 {
130 2 databuf[i]=0;
131 2 databuf[i+1]=0;
132 2 }
133 1 }
134 void clrindex(void)
135 {
136 1 int i;
137 1 for(i=0;i<12;i++)
138 1 {
139 2 dataindex[i]=0;
140 2 }
141 1 }
142 void full_databuf(uchar effict)
143 {
144 1 uchar i;
145 1 uchar *ptr;
146 1 clrscree();
147 1 if(effict==staticdis||effict==left)
148 1 {
149 2 for(i=0;i<18;i+=2)
150 2 {
151 3 ptr=dataindex[i/2];
152 3 if(ptr==0)continue;
153 3 databuf[i]=*(ptr+row_count*2);
154 3 databuf[i+1]=*(ptr+row_count*2+1);
155 3 }
156 2 if(effict==left)
157 2 {
158 3 l_databuf(shift_add);
159 3 }
C51 COMPILER V7.06 MAIN7 05/20/2008 21:43:26 PAGE 4
160 2 }
161 1 else if(effict==up)
162 1 {
163 2 for(i=0;i<18;i+=2)
164 2 {
165 3 ptr=dataindex[i/2];
166 3 if(ptr==0)continue;
167 3 if((shift_add+row_count)>15)
168 3 {
169 4 databuf[i]=*(ptr+134+(shift_add+row_count-15)*2);
170 4 databuf[i+1]=*(ptr+134+(shift_add+row_count-15)*2+1);
171 4 }
172 3 else
173 3 {
174 4 databuf[i]=*(ptr+(shift_add+row_count)*2);
175 4 databuf[i+1]=*(ptr+(shift_add+row_count)*2+1);
176 4 }
177 3 }
178 2 }
179 1 }
180 void l_databuf(uchar i)//左移时数据BUF处理
181 {
182 1 uchar h;
183 1 int j,k;
184 1 if(i>=8)
185 1 {
186 2 for(h=0;h<17;h++)
187 2 databuf[h]=databuf[h+1];
188 2 i-=8;
189 2 }
190 1 for(h=0;h<16;h++)
191 1 {
192 2 j=databuf[h];
193 2 k=databuf[h+1];
194 2 j=j<<i;
195 2 k=k>>(8-i);
196 2 databuf[h]=j|k;
197 2 }
198 1 }
199
200 void full_index(uchar *prt,uchar st_index,uchar en_index)
201 {
202 1 uchar str1,str2;
203 1 uchar *prt2;
204 1 int i,j;
205 1 clrindex();
206 1 for(i=st_index;i<en_index;i++,prt=prt+2)
207 1 {
208 2 str1=*prt;
209 2 str2=*(prt+1);
210 2 if(str1=='\0')
211 2 {
212 3 disen=1;
213 3 break;
214 3 }
215 2 for(j=0;j<sizeof(GB_16)/sizeof(GB_16[0]);j++)
216 2 {
217 3 if(str1 == GB_16[j].Index[0]&&str2 == GB_16[j].Index[1])
218 3 break;
219 3 }
220 2 prt2=GB_16[j].Msk;
221 2 dataindex[i]=prt2;
C51 COMPILER V7.06 MAIN7 05/20/2008 21:43:26 PAGE 5
222 2 }
223 1 }
224 void timeIRQ(void) interrupt 1
225 {
226 1 TH0=(65535-600)/256;
227 1 TL0=(65535-600)%256;
228 1 time_count++;
229 1 if(fulldata_flag!=1)
230 1 {
231 2 row_dis();
232 2 shift_count--;
233 2 if(shift_count==0)
234 2 {
235 3 shift_count=shfitspeed;
236 3 shift_add++;
237 3 if(shift_add==16)
238 3 {
239 4 shift_add=0;
240 4 fullindex_flag=1;
241 4 }
242 3 }
243 2 }
244 1 }
245
246 void display(uchar *a,uchar effict,char st_space,char shfitspeed,int sta_time)//effict 显示效果 space 显
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -