📄 12864zk.lst
字号:
310 2 Lcd_Write_Dat(*str++);
311 2 i++;
312 2 }
313 1 }
314 /*******************************************
315 * 函数功能 :LCD数据串输出
316 * 入口参数 : (uchar x,uchar y,uchar *str,uchar cnt)
317 * 占用资源 : (void)
318 * 返回参数 : (void)
319 * 说明 : 限制输出字符个数
320 ********************************************/
321 void PrintLimit(uchar x,uchar y,uchar *str,uchar cnt)
322 {
323 1 uchar i=0;
324 1 GotoXY(x,y);
325 1 Lcd_Write_Command(Basic_Instruction_Com);
326 1 while(((*str)!='\0')&&(i<cnt))
327 1 {
328 2 Lcd_Write_Dat(*str++);
329 2 i++;
330 2 }
331 1 }
332 /*******************************************
333 * 函数功能 :LCD初始化
334 * 入口参数 : (void)
335 * 占用资源 : (void)
336 * 返回参数 : (void)
337 * 说明 :
338 ********************************************/
339 void LcdInitial(void)
340 {
341 1 Function_Setting(); //function setting.
342 1 Display_State(); //display state key.
343 1 DisplayClear(); //display clear
344 1 Entry_Mode(); //entry mode set
345 1 }
346 //---------------------------------------
347 #endif
348
349 //---------------------------------------
350 #ifdef Expand_Instruction_Enable
351
352 /************************************以下为扩充指令下的函数命令***********************/
353
354 /*******************************************
355 * 函数功能 :LCD反白选择
356 * 入口参数 : (bit line)
357 * 占用资源 : (void)
358 * 返回参数 : (void)
359 * 说明 :
360 反白选择 0 0 0 0 0 0 0 1 R1 R0
361 选择一、三行同时作反白显示,
362 或者二、四行同时作反白显示
363 line=0,reverse the line 1&3
364 else reverse line2&4
365 ********************************************/
366 void ReverseDisplay(bit line)
367 {
C51 COMPILER V8.02 12864ZK 01/01/2000 10:44:02 PAGE 8
368 1 Lcd_Write_Command(Expand_Instruction_Com);
369 1 line &= 0x01;
370 1 Lcd_Write_Command(0x04|line);
371 1 }
372 /*******************************************
373 * 函数功能 :LCD卷动允许
374 * 入口参数 : (void)
375 * 占用资源 : (void)
376 * 返回参数 : (void)
377 * 说明 :
378 卷动地址或IRAM 地址选择
379 0 0 0 0 0 0 0 0 1 SR
380 SR=1:允许输入垂直卷动地址
381 SR=0:允许输入IRAM 地址
382 ********************************************/
383 #define Roll_Addr_Enable_Com 0x03
384 #define IRAM_Addr_Enable_Com 0x02
385 //---------------------------------------
386 void RollAddrEnable(void)
387 {
388 1 Lcd_Write_Command(Expand_Instruction_Com);
389 1 Lcd_Write_Command(Roll_Addr_Enable_Com);
390 1 }
391 /*******************************************
392 * 函数功能 :LCD设定IRAM地址或卷动地址
393 * 入口参数 : (uchar addr)
394 * 占用资源 : (void)
395 * 返回参数 : (void)
396 * 说明 :
397 设定IRAM地址或卷动地址
398 0 1 AC5 AC4 AC3 AC2 AC1 AC0
399 SR=1:AC5—AC0 为垂直卷动地址
400 SR=0:AC3—AC0 为ICON IRAM 地址
401 ********************************************/
402 void RollAddr(uchar f_addr)
403 {
404 1 Lcd_Write_Command(Expand_Instruction_Com);
405 1 Lcd_Write_Command(0x40|f_addr);
406 1 }
407 /*******************************************
408 * 函数功能 :LCD睡眠模式选择
409 * 入口参数 : (bit sleep)
410 * 占用资源 : (void)
411 * 返回参数 : (void)
412 * 说明 :
413 睡眠模式 0 0 0 0 0 0 1 SL X X
414 SL=1:脱离睡眠模式
415 SL=0:进入睡眠模式
416 ********************************************/
417 void Sleep(bit sleep)
418 {
419 1 Lcd_Write_Command(Expand_Instruction_Com);
420 1 if(sleep)Lcd_Write_Command(0x08);
421 1 else Lcd_Write_Command(0x0c);
422 1 }
423 /*******************************************
424 * 函数功能 :LCD设定绘图RAM 地址
425 * 入口参数 : (uchar addr)
426 * 占用资源 : (void)
427 * 返回参数 : (void)
428 * 说明 :
429 设定绘图RAM 地址
C51 COMPILER V8.02 12864ZK 01/01/2000 10:44:02 PAGE 9
430 0 0 1 AC6 AC5 AC4 AC3 AC2 AC1 AC0
431 设定CGRAM 地址到地址计数器(AC)
432 ********************************************/
433 /*
434 void CGRAMAddr(uchar f_addr)
435 {
436 Lcd_Write_Command(Expand_Instruction_Com);
437 Lcd_Write_Command(0x80|f_addr);
438 }
439 */
440 /*******************************************
441 * 函数功能 :LCD左半屏绘图
442 * 入口参数 : (uchar *p)
443 * 占用资源 : (void)
444 * 返回参数 : (void)
445 * 说明 :
446 //取模方法:从右往左逐行取模.
447 15 ..8..1 15..8.1
448 1 2 3 4
449 ********************************************/
450 void LeftPrintGraph(uchar *p)
451 {
452 1 uchar x,y,z;
453 1 for(z=0;z<9;z+=8)
454 1 for(y=0;y<0x20;y++)
455 1 for(x=0;x<4;x++)
456 1 {
457 2 Lcd_Write_Command(GraphRAM_On_Com);
458 2 Lcd_Write_Command(y+0x80); //Y,行地址
459 2 Lcd_Write_Command(x+0x80+z);
460 2 Lcd_Write_Command(Basic_Instruction_Com);
461 2 Lcd_Write_Dat(*p++);
462 2 Lcd_Write_Dat(*p++);
463 2 }
464 1 }
465 /*******************************************
466 * 函数功能 :LCD右半屏绘图
467 * 入口参数 : (uchar *p)
468 * 占用资源 : (void)
469 * 返回参数 : (void)
470 * 说明 :
471 //取模方法:从右往左逐行取模.
472 15 ..8..1 15..8.1
473 1 2 3 4
474 ********************************************/
475 void RightPrintGraph(uchar *p)
476 {
477 1 uchar x,y,z;
478 1 for(z=0;z<9;z+=8)
479 1 for(y=0;y<0x20;y++)
480 1 for(x=4;x<8;x++)
481 1 {
482 2 Lcd_Write_Command(GraphRAM_On_Com);
483 2 Lcd_Write_Command(y+0x80); //Y,行地址
484 2 Lcd_Write_Command(x+0x80+z);
485 2 Lcd_Write_Command(Basic_Instruction_Com);
486 2 Lcd_Write_Dat(*p++);
487 2 Lcd_Write_Dat(*p++);
488 2 }
489 1 }
490
491 #endif
C51 COMPILER V8.02 12864ZK 01/01/2000 10:44:02 PAGE 10
492 /*******************************************
493 *** The END ***
494 ********************************************/
C51 COMPILATION COMPLETE. 3 WARNING(S), 57 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -