📄 disp.lst
字号:
C51 COMPILER V6.12 DISP 06/06/2004 10:26:11 PAGE 1
C51 COMPILER V6.12, COMPILATION OF MODULE DISP
OBJECT MODULE PLACED IN .\disp.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE .\disp.c LARGE DEBUG OBJECTEXTEND
stmt level source
1 //disp.c
2 //#include <reg52.h>
3 #include "common.h"
4 #include "disp.h"
5
6 sbit RS = P3^3;
7 sbit DISPE = P3^4;
8
9 void initcom()
10 {
11 1 TMOD = 0x20;
12 1 TH1 =0xfd;
13 1 TL1 = 0xfd;
14 1 TCON = 0x40;
15 1 SCON = 0x50;
16 1 PCON = 0;
17 1 TR1= 1;
18 1 // IE = 0x90;
19 1 loadmsg("ok!\r\b",5);
20 1 }
21 void loadmsg(uchar *msg,uchar len)
22 {
23 1 uchar i;
24 1 for(i = 0;i<len;i++)
25 1 {
26 2 if(*msg=='\0')
27 2 break;
28 2 SBUF = *msg;
29 2 while(TI==0);TI=0;
30 2 msg++;
31 2 }
32 1 }
33
34 /*输入并显示字符dispd*/
35 void writedispdata(uchar dispd)
36 {
37 1 RS = 1;
38 1 DISPE = 1;
39 1 LCDADD = dispd;
40 1 delay(1);
41 1 DISPE = 0;
42 1 delay(200);
43 1 }
44 //
45 /*输入初始化命令字dispc*/
46 void writedispcmd(uchar dispc)
47 {
48 1 RS = 0;
49 1 DISPE = 1;
50 1 LCDADD = dispc;
51 1 delay(1);
52 1 DISPE = 0;
53 1 delay(200);
54 1 }
55 //
C51 COMPILER V6.12 DISP 06/06/2004 10:26:11 PAGE 2
56 /*初始化lcd*/
57 void initlcd(void)
58 {
59 1 writedispcmd(0x01);
60 1 writedispcmd(0x38);
61 1 writedispcmd(0x06);
62 1 writedispcmd(0x0e);
63 1 writedispcmd(0x01);
64 1 }
65 void dispinfo(uchar line,uchar * ch)
66 {
67 1 if(line == 1)
68 1 {
69 2 writedispcmd(0x80);
70 2 while(*ch != '\0')
71 2 {
72 3 writedispdata(*ch);
73 3 ch++;
74 3 }
75 2 }
76 1 else if(line == 2){
77 2 writedispcmd(0xc0);
78 2 while(*ch != '\0')
79 2 {
80 3 writedispdata(*ch);
81 3 ch++;
82 3 }
83 2 }
84 1 else{
85 2 while(*ch != '\0')
86 2 {
87 3 writedispdata(*ch);
88 3 ch++;
89 3 }
90 2 }
91 1 }
92 void disphex(uchar hex)
93 {
94 1 uchar i;
95 1 i = hex>>4;
96 1 i &= 0x0f;
97 1 if(i<10)
98 1 writedispdata(0x30|i);
99 1 else
100 1 writedispdata(0x37+i);
101 1 i = hex&0x0f;
102 1 if(i<10)
103 1 writedispdata(0x30|i);
104 1 else
105 1 writedispdata(0x37+i);
106 1 }
107 htoc(uchar h,uchar * chh,uchar *chl)
108 {
109 1 if((h>>4)<=0x09)
110 1 *chh = 0x30|(h>>4);
111 1 else
112 1 *chh = 0x37+(h>>4);
113 1 h &= 0x0f;
114 1 if(h<=0x09)
115 1 *chl= 0x30|h;
116 1 else
117 1 *chl = 0x37+h;
C51 COMPILER V6.12 DISP 06/06/2004 10:26:11 PAGE 3
118 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 432 ----
CONSTANT SIZE = 6 ----
XDATA SIZE = ---- 16
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
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 + -