📄 glcd.lst
字号:
194 1 GLCD_ClearScreen(); // 清屏
195 1 }
196
197 ///////////////////////////////////////////////////////////////////////////////
198 // 显示定长字符串
199 ///////////////////////////////////////////////////////////////////////////////
200 void dprintf(char *fmt,uchar uLen)
201 {
202 1 idata char c1,c2; // 汉字占两个ASC字符
203 1 idata uchar i=0,j,k; // 计数器
204 1 idata uchar pos; // 显示位置
205 1
206 1 while(i<uLen)
207 1 {
208 2 if(u8CursorX <64){pos=LEFT;cs=1;}
209 2 else if((u8CursorX >63)&&(u8CursorX <128)){pos=RIGHT;cs=2;}
210 2 c1 = fmt[i];
211 2 c2 = fmt[i+1];
212 2 if(c1 >= 0)
213 2 { // ASCII
214 3 LcdInstructionWrite (X_ADRESS + (u8CursorY/ 8),pos);
215 3 LcdInstructionWrite (Y_ADRESS + u8CursorX - (cs-1)*64,pos);
216 3 for (k=0;k<8;k++)
217 3 {
218 4 if(reverse)LcdDataWrite(~ASC_MSK[(c1-0x1f)*ASC_CHR_HEIGHT+k],pos);
219 4 else
220 4 LcdDataWrite(ASC_MSK[(c1-0x1f)*ASC_CHR_HEIGHT+k],pos);
221 4 }
222 3
223 3 LcdInstructionWrite(X_ADRESS + (u8CursorY/ 8)+1,pos);
224 3 LcdInstructionWrite (Y_ADRESS + u8CursorX - (cs-1)*64,pos);
225 3 for(k=8;k<16;k++)
226 3 {
227 4 if(reverse)LcdDataWrite(~ASC_MSK[(c1-0x1f)*ASC_CHR_HEIGHT+k],pos);
228 4 else
229 4 LcdDataWrite(ASC_MSK[(c1-0x1f)*ASC_CHR_HEIGHT+k],pos);
230 4 }
231 3 u8CursorX +=8;
232 3 }
233 2 else
234 2 {
235 3 // 中文
236 3 for(j=0;j<sizeof(GB_16)/sizeof(GB_16[0]);j++)
237 3 {
238 4 if(c1 == GB_16[j].Index[0] && c2 == GB_16[j].Index[1])
239 4 break;
240 4 }
241 3 LcdInstructionWrite(X_ADRESS + (u8CursorY/ 8),pos);
C51 COMPILER V7.07 GLCD 09/14/2005 15:20:56 PAGE 5
242 3 LcdInstructionWrite(Y_ADRESS + u8CursorX - (cs-1)*64,pos);
243 3 for (k=0;k<8;k++)
244 3 {
245 4 if(reverse)LcdDataWrite(~GB_16[j].Msk[k],pos);
246 4 else
247 4 LcdDataWrite(GB_16[j].Msk[k],pos);
248 4 }
249 3 u8CursorX +=8;
250 3 if(u8CursorX <64){pos=LEFT;cs=1;}
251 3 else if((u8CursorX >63)&&(u8CursorX <128)){pos=RIGHT;cs=2;}
252 3 LcdInstructionWrite(X_ADRESS + (u8CursorY/ 8),pos);
253 3 LcdInstructionWrite(Y_ADRESS + u8CursorX - (cs-1)*64,pos);
254 3 for (k=8;k<16;k++)
255 3 {
256 4 if(reverse)LcdDataWrite(~GB_16[j].Msk[k],pos);
257 4 else
258 4 LcdDataWrite(GB_16[j].Msk[k],pos);
259 4 }
260 3 u8CursorX -=8;
261 3 if(u8CursorX <64){pos=LEFT;cs=1;}
262 3 else if((u8CursorX >63)&&(u8CursorX <128)){pos=RIGHT;cs=2;}
263 3 LcdInstructionWrite(X_ADRESS + (u8CursorY/8)+1,pos);
264 3 LcdInstructionWrite(Y_ADRESS + u8CursorX - (cs-1)*64,pos);
265 3 for (k=16;k<24;k++)
266 3 {
267 4 if(reverse)LcdDataWrite(~GB_16[j].Msk[k],pos);
268 4 else
269 4 LcdDataWrite(GB_16[j].Msk[k],pos);
270 4 }
271 3 u8CursorX +=8;
272 3 if(u8CursorX <64){pos=LEFT;cs=1;}
273 3 else if((u8CursorX >63)&&(u8CursorX <128)){pos=RIGHT;cs=2;}
274 3 LcdInstructionWrite(X_ADRESS + (u8CursorY/ 8)+1,pos);
275 3 LcdInstructionWrite(Y_ADRESS + u8CursorX - (cs-1)*64,pos);
276 3 for (k=24;k<32;k++)
277 3 {
278 4 if(reverse)LcdDataWrite(~GB_16[j].Msk[k],pos);
279 4 else
280 4 LcdDataWrite(GB_16[j].Msk[k],pos);
281 4 }
282 3 u8CursorX +=8;
283 3 i++;
284 3 }
285 2 i++;
286 2 }
287 1 }
288
289 ///////////////////////////////////////////////////////////////////////////////
290 // 显示大字体
291 ///////////////////////////////////////////////////////////////////////////////
292 void LcdPutDigit (uchar u8Char)
293 {
294 1 idata uchar c1; // 显示字符
295 1 idata uchar k;
296 1 idata uchar pos; // 显示位置
297 1
298 1 c1=u8Char;
299 1 if(u8CursorX <64){pos=LEFT;cs=1;}
300 1 else if((u8CursorX >63)&&(u8CursorX <128)){pos=RIGHT;cs=2;}
301 1 LcdInstructionWrite(X_ADRESS + (u8CursorY/ 8),pos);
302 1 LcdInstructionWrite(Y_ADRESS + u8CursorX - (cs-1)*64,pos);
303 1 LcdDataWrite(0x00,pos);
C51 COMPILER V7.07 GLCD 09/14/2005 15:20:56 PAGE 6
304 1 for (k=0;k<7;k++)
305 1 {
306 2 LcdDataWrite(clock_digit[(c1-0x30)*56+k],pos);
307 2 }
308 1 u8CursorX +=8;
309 1 if(u8CursorX <64){pos=LEFT;cs=1;}
310 1 else if((u8CursorX >63)&&(u8CursorX <128)){pos=RIGHT;cs=2;}
311 1 LcdInstructionWrite(X_ADRESS + (u8CursorY/ 8),pos);
312 1 LcdInstructionWrite(Y_ADRESS + u8CursorX - (cs-1)*64,pos);
313 1 for (k=7;k<14;k++)
314 1 {
315 2 LcdDataWrite(clock_digit[(c1-0x30)*56+k],pos);
316 2 }
317 1 LcdDataWrite(0x00,pos);
318 1 u8CursorX -=8;
319 1 if(u8CursorX <64){pos=LEFT;cs=1;}
320 1 else if((u8CursorX >63)&&(u8CursorX <128)){pos=RIGHT;cs=2;}
321 1 LcdInstructionWrite(X_ADRESS + (u8CursorY/8)+1,pos);
322 1 LcdInstructionWrite(Y_ADRESS + u8CursorX - (cs-1)*64,pos);
323 1 LcdDataWrite(0x00,pos);
324 1 for (k=14;k<21;k++)
325 1 {
326 2 LcdDataWrite(clock_digit[(c1-0x30)*56+k],pos);
327 2 }
328 1 u8CursorX +=8;
329 1 if(u8CursorX <64){pos=LEFT;cs=1;}
330 1 else if((u8CursorX >63)&&(u8CursorX <128)){pos=RIGHT;cs=2;}
331 1 LcdInstructionWrite(X_ADRESS + (u8CursorY/ 8)+1,pos);
332 1 LcdInstructionWrite(Y_ADRESS + u8CursorX - (cs-1)*64,pos);
333 1 for (k=21;k<28;k++)
334 1 {
335 2 LcdDataWrite(clock_digit[(c1-0x30)*56+k],pos);
336 2 }
337 1 LcdDataWrite(0x00,pos);
338 1 u8CursorX -=8;
339 1 if(u8CursorX <64){pos=LEFT;cs=1;}
340 1 else if((u8CursorX >63)&&(u8CursorX <128)){pos=RIGHT;cs=2;}
341 1 LcdInstructionWrite(X_ADRESS + (u8CursorY/8)+2,pos);
342 1 LcdInstructionWrite(Y_ADRESS + u8CursorX - (cs-1)*64,pos);
343 1 LcdDataWrite(0x00,pos);
344 1 for (k=28;k<35;k++)
345 1 {
346 2 LcdDataWrite(clock_digit[(c1-0x30)*56+k],pos);
347 2 }
348 1 u8CursorX +=8;
349 1 if(u8CursorX <64){pos=LEFT;cs=1;}
350 1 else if((u8CursorX >63)&&(u8CursorX <128)){pos=RIGHT;cs=2;}
351 1 LcdInstructionWrite(X_ADRESS + (u8CursorY/ 8)+2,pos);
352 1 LcdInstructionWrite(Y_ADRESS + u8CursorX - (cs-1)*64,pos);
353 1 for (k=35;k<42;k++)
354 1 {
355 2 LcdDataWrite(clock_digit[(c1-0x30)*56+k],pos);
356 2 }
357 1 LcdDataWrite(0x00,pos);
358 1 u8CursorX -=8;
359 1 if(u8CursorX <64){pos=LEFT;cs=1;}
360 1 else if((u8CursorX >63)&&(u8CursorX <128)){pos=RIGHT;cs=2;}
361 1 LcdInstructionWrite(X_ADRESS + (u8CursorY/8)+3,pos);
362 1 LcdInstructionWrite(Y_ADRESS + u8CursorX - (cs-1)*64,pos);
363 1 LcdDataWrite(0x00,pos);
364 1 for (k=42;k<49;k++)
365 1 {
C51 COMPILER V7.07 GLCD 09/14/2005 15:20:56 PAGE 7
366 2 LcdDataWrite(clock_digit[(c1-0x30)*56+k],pos);
367 2 }
368 1 u8CursorX +=8;
369 1 if(u8CursorX <64){pos=LEFT;cs=1;}
370 1 else if((u8CursorX >63)&&(u8CursorX <128)){pos=RIGHT;cs=2;}
371 1 LcdInstructionWrite(X_ADRESS + (u8CursorY/ 8)+3,pos);
372 1 LcdInstructionWrite(Y_ADRESS + u8CursorX - (cs-1)*64,pos);
373 1 for (k=49;k<56;k++)
374 1 {
375 2 LcdDataWrite(clock_digit[(c1-0x30)*56+k],pos);
376 2 }
377 1 LcdDataWrite(0x00,pos);
378 1 }
379
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 1822 ----
CONSTANT SIZE = 6164 ----
XDATA SIZE = ---- 4
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- 12
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 + -