📄 lcdp.lst
字号:
C51 COMPILER V7.02a LCDP 04/02/2003 01:07:38 PAGE 1
C51 COMPILER V7.02a, COMPILATION OF MODULE LCDP
OBJECT MODULE PLACED IN LCDP.OBJ
COMPILER INVOKED BY: d:\Keil\C51\BIN\C51.EXE LCDP.c DEBUG OBJECTEXTEND TABS(2)
stmt level source
1 /*--------------------------------
2 lcd display 16x2 chinese
3 driver chip st7920
4 2002.12.28
5 ----------------------------*/
6 #include <stdlib.h>
7 #include <ctype.h>
8 #include <intrins.h>
9 #include <AT89X52.H>
10
11 //#include "LCDP.H"
12
13 extern void delay(unsigned int i);
14 //---------------------------
15 //display string
16 static void isBusy(void);
17
18 void text(unsigned char sta,unsigned char *string)
19 {
20 1 if(sta)WC_LCD(sta);
*** WARNING C206 IN LINE 20 OF LCDP.C: 'WC_LCD': missing function-prototype
*** ERROR C267 IN LINE 20 OF LCDP.C: 'WC_LCD': requires ANSI-style prototype
21 1 while(*string)WD_LCD(*string++);
22 1 }
23
24 //-------------------------------
25 //LCD display char,write data to LCD ram
26 void WD_LCD(unsigned char ch)
27 {
28 1 isBusy();
29 1 LCDRS=1;
30 1 LCDRW=0;
31 1 _nop_();
32 1 _nop_();
33 1 P0=ch;
34 1 _nop_();
35 1 _nop_();
36 1 ENABLE=1;
37 1 _nop_();
38 1 _nop_();
39 1 _nop_();
40 1 ENABLE=0;
41 1 _nop_();
42 1 _nop_();
43 1 }
44 //---------------------------------
45 //write lcd controll register
46 void WC_LCD (unsigned char command)
47 {
48 1 isBusy();
49 1 LCDRS=0;
50 1 _nop_();
51 1 LCDRW=0;
52 1 _nop_();
53 1 _nop_();
C51 COMPILER V7.02a LCDP 04/02/2003 01:07:38 PAGE 2
54 1 P0=command;
55 1 _nop_();
56 1 _nop_();
57 1 ENABLE=1;
58 1 _nop_();
59 1 _nop_();
60 1 _nop_();
61 1 ENABLE=0;
62 1 _nop_();
63 1 _nop_();
64 1 }
65 //----------------------------------------------
66 //LCD busy check ,check busy flag,read acc
67 static void isBusy(void)
68 {
69 1 unsigned char data i;
70 1 i=ACC;
71 1 P0=0x0ff;
72 1 _nop_();
73 1 LCDRS=0;
74 1 LCDRW=1;
75 1 _nop_();
76 1 _nop_();
77 1 ENABLE=1;
78 1 _nop_();
79 1 _nop_();
80 1 _nop_();
81 1 do{ ACC=P0; } while(BUSYFLAG);
82 1 _nop_();
83 1 _nop_();
84 1 ENABLE=0;
85 1 _nop_();
86 1 _nop_();
87 1 ACC=i;
88 1 }
89 //------------------------------------------------
90 //init lcd
91
92 void clear(void)
93 {
94 1 WC_LCD(0x18);//base command,8bit
95 1 isBusy();
96 1 LCDRS=0;
97 1 LCDRW=0;
98 1 _nop_();
99 1 _nop_();
100 1 P0=0x1;
101 1 _nop_();
102 1 ENABLE=1;
103 1 delay(4);
104 1 ENABLE=0;
105 1 _nop_();
106 1 _nop_();
107 1 }
108
109
C51 COMPILATION COMPLETE. 1 WARNING(S), 1 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -