📄 jisuanqi1.lst
字号:
C51 COMPILER V8.02 JISUANQI1 06/23/2010 15:02:49 PAGE 1
C51 COMPILER V8.02, COMPILATION OF MODULE JISUANQI1
OBJECT MODULE PLACED IN jisuanqi1.OBJ
COMPILER INVOKED BY: D:\处理软件\keil\C51\BIN\C51.EXE jisuanqi1.c BROWSE DEBUG OBJECTEXTEND
line level source
1 /******************************************************************
2 “天祥电子” 倾情奉献
3 www.txmcu.com
4 www.txmcu.cn
5 *******************************************************************
6
7 程序功能:按下键盘矩阵后,在六个数码管上依次显示所按下的键所代表的数字。
8 按复位键可以清空显示为0
9 ******************************************************************/
10 #include<reg51.h>
11
12 #define uchar unsigned char
13
14 uchar a0=16,b0=16,c0=16,d0=16,e0=16,f0=16,wei,temp,key,i,j,k;
15 uchar jia,jian,cheng,chu,dengyu,jia0,jian0,cheng0,chu0,qingling;
16 uchar s0,s1,s2,s3,s4,s5; //参加运算的各个位
17 unsigned long qian,hou;//定义参于运算的第一个数和第二个数。
18 sbit dula=P2^6;
19 sbit wela=P2^7;
20 sbit beep=P2^3;
21
22 unsigned char code table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,
23 0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71,0x00};
24
25 void delay(uchar i)
26 {
27 1 for(j=i;j>0;j--)
28 1 for(k=125;k>0;k--);
29 1 }
30 void display(uchar a,uchar b,uchar c,uchar d,uchar e,uchar f)
31 {
32 1 dula=0;
33 1 P0=table[a];
34 1 dula=1;
35 1 dula=0;
36 1
37 1 wela=0;
38 1 P0=0xfe;
39 1 wela=1;
40 1 wela=0;
41 1 delay(5);
42 1
43 1 P0=table[b];
44 1 dula=1;
45 1 dula=0;
46 1
47 1 P0=0xfd;
48 1 wela=1;
49 1 wela=0;
50 1 delay(5);
51 1
52 1 P0=table[c];
53 1 dula=1;
54 1 dula=0;
55 1
C51 COMPILER V8.02 JISUANQI1 06/23/2010 15:02:49 PAGE 2
56 1 P0=0xfb;
57 1 wela=1;
58 1 wela=0;
59 1 delay(5);
60 1
61 1 P0=table[d];
62 1 dula=1;
63 1 dula=0;
64 1
65 1 P0=0xf7;
66 1 wela=1;
67 1 wela=0;
68 1 delay(5);
69 1
70 1 P0=table[e];
71 1 dula=1;
72 1 dula=0;
73 1
74 1 P0=0xef;
75 1 wela=1;
76 1 wela=0;
77 1 delay(5);
78 1
79 1 P0=table[f];
80 1 dula=1;
81 1 dula=0;
82 1
83 1 P0=0xdf;
84 1 wela=1;
85 1 wela=0;
86 1 delay(5);
87 1 }
88
89 void keyscan()
90 {
91 1 {
92 2 P3=0xfe;
93 2 temp=P3;
94 2 temp=temp&0xf0;
95 2 if(temp!=0xf0)
96 2 {
97 3 delay(10);
98 3 if(temp!=0xf0)
99 3 {
100 4 temp=P3;
101 4 switch(temp)
102 4 {
103 5 case 0xee:
104 5 key=0;
105 5 wei++;
106 5 break;
107 5
108 5 case 0xde:
109 5 key=1;
110 5 wei++;
111 5 break;
112 5
113 5 case 0xbe:
114 5 key=2;
115 5 wei++;
116 5 break;
117 5
C51 COMPILER V8.02 JISUANQI1 06/23/2010 15:02:49 PAGE 3
118 5 case 0x7e:
119 5 key=3;
120 5 wei++;
121 5 break;
122 5 }
123 4 while(temp!=0xf0)
124 4 {
125 5 temp=P3;
126 5 temp=temp&0xf0;
127 5 beep=0;
128 5 }
129 4 beep=1;
130 4 }
131 3 }
132 2 P3=0xfd;
133 2 temp=P3;
134 2 temp=temp&0xf0;
135 2 if(temp!=0xf0)
136 2 {
137 3 delay(10);
138 3 if(temp!=0xf0)
139 3 {
140 4 temp=P3;
141 4 switch(temp)
142 4 {
143 5 case 0xed:
144 5 key=4;
145 5 wei++;
146 5 break;
147 5
148 5 case 0xdd:
149 5 key=5;
150 5 wei++;
151 5 break;
152 5
153 5 case 0xbd:
154 5 key=6;
155 5 wei++;
156 5 break;
157 5
158 5 case 0x7d:
159 5 key=7;
160 5 wei++;
161 5 break;
162 5 }
163 4 while(temp!=0xf0)
164 4 {
165 5 temp=P3;
166 5 temp=temp&0xf0;
167 5 beep=0;
168 5 }
169 4 beep=1;
170 4 }
171 3 }
172 2 P3=0xfb;
173 2 temp=P3;
174 2 temp=temp&0xf0;
175 2 if(temp!=0xf0)
176 2 {
177 3 delay(10);
178 3 if(temp!=0xf0)
179 3 {
C51 COMPILER V8.02 JISUANQI1 06/23/2010 15:02:49 PAGE 4
180 4 temp=P3;
181 4 switch(temp)
182 4 {
183 5 case 0xeb:
184 5 key=8;
185 5 wei++;
186 5 break;
187 5
188 5 case 0xdb:
189 5 key=9;
190 5 wei++;
191 5 break;
192 5
193 5 case 0xbb:
194 5 qingling=1;
195 5 //key=10;
196 5 //wei++;
197 5 break;
198 5
199 5 case 0x7b:
200 5 dengyu=1;
201 5 //key=11;
202 5 //wei++;
203 5 break;
204 5 }
205 4 while(temp!=0xf0)
206 4 {
207 5 temp=P3;
208 5 temp=temp&0xf0;
209 5 beep=0;
210 5 }
211 4 beep=1;
212 4 }
213 3 }
214 2 P3=0xf7;
215 2 temp=P3;
216 2 temp=temp&0xf0;
217 2 if(temp!=0xf0)
218 2 {
219 3 delay(10);
220 3 if(temp!=0xf0)
221 3 {
222 4 temp=P3;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -