📄 lcd.lst
字号:
C51 COMPILER V8.09 LCD 07/03/2008 12:47:18 PAGE 1
C51 COMPILER V8.09, COMPILATION OF MODULE LCD
OBJECT MODULE PLACED IN lcd.OBJ
COMPILER INVOKED BY: d:\Keil\C51\BIN\C51.EXE lcd.c BROWSE DEBUG OBJECTEXTEND
line level source
1 #include<reg51.h>
2 #include"intrins.h"
3 #define uchar unsigned char
4 #define uint unsigned int
5 #define nop _nop_()
6 #define cycle 4000
7 #define cycle1 400
8
9 #define db0_db7 P1
10 static const uchar code table[]={'v','o','l','t','a','g','e','='};
11 static const uchar code str[]={" *zhou xiao*"};
12
13 uint data volt[6]={0x30,'.',0x30,0x30,0x30,0x30};
14 uchar xdata cs0809 _at_ 0xfeff;
15
16 sbit RS=P2^1;
17 sbit RW=P2^2;
18 sbit E=P2^3;
19 uint counti;
20 void init();
21 void write(uchar tempdata);
22 void writeddr(uchar tempdata);
23 void checkbusy();
24 void delay(uint n);
25 void display();
26 void displaya();
27 void main(void)
28 {
29 1 init();
30 1 displaya();
31 1 TMOD=0x11;
32 1 TH0=(65536-cycle)/256;
33 1 TL0=(65536-cycle)%256;
34 1 TH1=(65536-cycle1)/256;
35 1 TL1=(65536-cycle1)%256;
36 1 TCON=0x55;
37 1 IE=0x8a;
38 1 IP=0x04;
39 1 counti=0;
40 1 while(1);
41 1 display();
42 1
43 1 }
44
45 void display()
46 { uint a;
47 1 write(0x8a);//显示位置
48 1 for(a=0;a<6;a++)
49 1 writeddr(volt[a]);
50 1 }
51 void displaya()
52 {
53 1 uint b;
54 1 //write(0x01);
55 1 //write(0x06);
C51 COMPILER V8.09 LCD 07/03/2008 12:47:18 PAGE 2
56 1 //write(0x80);
57 1 for(b=0;b<8;b++)
58 1 writeddr(table[b]);
59 1 display();
60 1 }
61
62 void delay(uint n)
63 {uint i;
64 1 for(i=0;i<n;i++)
65 1 {i=i;}
66 1 }
67 void init()
68 {delay(500);
69 1 write(0x38);//显示模式5*7
70 1 write(0x01);//光标复位
71 1 write(0x06);//光标右移
72 1 write(0x0C);
73 1 }
74
75 void write(uchar tempdata)
76 {checkbusy();
77 1 db0_db7=tempdata;
78 1 E=1;
79 1 nop;
80 1 E=0;
81 1 nop;
82 1
83 1 }
84 void writeddr(uchar tempdata)
85 {
86 1 checkbusy();
87 1 RS=1;
88 1 E=1;
89 1 db0_db7=tempdata;
90 1
91 1
92 1 nop;
93 1 E=0;
94 1 nop;
95 1 }
96 void checkbusy()
97 {
98 1 uchar temp;
99 1 RS=0;
100 1 RW=1;
101 1 do
102 1 {db0_db7=0xff;
103 2 E=1;
104 2 delay(50);
105 2 nop;
106 2 temp=db0_db7;
107 2 E=0;
108 2 }while((temp&0x80)==0x80);
109 1 RW=0;
110 1 }
111 void service_int0() interrupt 1 using 2
112 {
113 1 static uchar s_counter;
114 1 if(++s_counter>=7)
115 1 {
116 2 if(counti<=11)
117 2 {write(0xc0+counti);
C51 COMPILER V8.09 LCD 07/03/2008 12:47:18 PAGE 3
118 3 writeddr(str[counti]);
119 3 counti++;
120 3 }
121 2 else if(counti>11&&counti<28)
122 2 {write(0xc0+counti-16);
123 3 writeddr(0);
124 3 counti++;
125 3 }
126 2 else
127 2 {counti=0;
128 3 write(0xC0);
129 3 }
130 2 }
131 1 TH0=(65536-cycle)/256;
132 1 TL0=(65536-cycle)%256;
133 1 }
134 void service_int1() interrupt 3 using 3
135 {uint vod;
136 1 P2=0xFE;
137 1 P3=0xbf;
138 1 P0=0;
139 1 P3=0xff;
140 1 //cs0809=0;
141 1 IT1=1;
142 1 EX1=1;
143 1 //delay(200);
144 1 //vod=cs0809;
145 1 //vod*=196;
146 1 //volt[5]=((char)(vod%10)+0x30);
147 1 //volt[4]=((char)(vod%100)/10+0x30);
148 1 //volt[3]=((char)(vod%1000)/100+0x30);
149 1 //volt[2]=((char)((vod%10000)/1000)+0x30);
150 1 //volt[0]=((char)(vod/10000)+0x30);
151 1 //display();
152 1 TH1=(65536-cycle1)/256;
153 1 TL1=(65536-cycle1)%256;
154 1 }
*** WARNING C280 IN LINE 135 OF LCD.C: 'vod': unreferenced local variable
155 void service_int2() interrupt 2
156 {uint vod;
157 1 P2=0xFE;
158 1 P3=0x7f;
159 1 P0=0xff;
160 1 vod=P0;
161 1 P3=0xff;
162 1 //vod=cs0809;
163 1 vod*=196;
164 1 volt[0]=((vod/10000)+0x30);
165 1 volt[2]=(((vod%10000)/1000)+0x30);
166 1 volt[3]=((vod%1000)/100+0x30);
167 1 volt[4]=((vod%100)/10+0x30);
168 1 volt[5]=((vod%10)+0x30);
169 1 display();
170 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 599 ----
CONSTANT SIZE = 21 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 15 8
C51 COMPILER V8.09 LCD 07/03/2008 12:47:18 PAGE 4
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 1 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -