📄 jiaotongnew.lst
字号:
C51 COMPILER V8.02 JIAOTONGNEW 08/12/2008 11:23:05 PAGE 1
C51 COMPILER V8.02, COMPILATION OF MODULE JIAOTONGNEW
OBJECT MODULE PLACED IN jiaotongnew.OBJ
COMPILER INVOKED BY: E:\design tools\keilc\C51\BIN\C51.EXE jiaotongnew.c BROWSE DEBUG OBJECTEXTEND
line level source
1 #include <reg51.h>
2 #include <stdio.h>
3 #define uchar unsigned char
4 #define uint unsigned int
5 sbit key1=P3^2;
6 sbit key2=P3^3;
7 sbit key3=P1^7;
8 sbit zshi=P3^6;
9 sbit zge=P3^7;
10 sbit cshi=P3^4;
11 sbit cge=P3^5;
12
13 uchar h,count,num,dat,flag,dat1,num1,key1num,temp,keyc,keyz;
14 uint r=0;
15 uint s;
16 uchar code dis[]={
17
18 0Xc0,/*0*/
19 0Xf9,/*1*/
20 0Xa4,/*2*/
21 0Xb0,/*3*/
22 0X99,/*4*/
23 0X92,/*5*/
24 0X82,/*6*/
25 0Xf8,/*7*/
26 0X80,/*8*/
27 0X90,/*9*/
28 0Xff,/*NULL*/
29 };
30
31
32 void delay(uint c)
33 {
34 1 uint i,j;
35 1 for(i=0;i<c;i++)
36 1 for(j=0;j<100;j++);
37 1
38 1 }
39
40 void init()
41 {
42 1 TMOD=0x01;//设置定时器0为工作方式1
43 1 TH0=(65536-10000)/256;
44 1 TL0=(65536-10000)%256;
45 1 TH1=(65536-20000)/256;
46 1 TL1=(65536-20000)%256;
47 1 EA=1;//开总中断
48 1 ET0=1;//开定时器0中断
49 1 ET1=1;
50 1 TR0=1;//启动定时器0
51 1 TR1=1;
52 1 num=46;
53 1 num1=46;
54 1 P3=0xff;
55 1 P1=0xff;
C51 COMPILER V8.02 JIAOTONGNEW 08/12/2008 11:23:05 PAGE 2
56 1 // P0=0xeb;
57 1 }
58 void display(uchar dat_z,uchar dat_c) //送显示
59 {
60 1 if(dat_z>=23&&dat_z<=56)
61 1 {
62 2 if(dat_z>26&&dat_z<=56)
63 2 {
64 3 P0=0xeb;
65 3 // P3=0x00;
66 3 P1=0xff;
67 3 zshi=1;
68 3 P1=dis[(dat_z-23)/10];
69 3 delay(1);
70 3 zshi=0;
71 3 P1=0xff;
72 3 zge=1;
73 3 P1=dis[(dat_z-23)%10];
74 3 delay(1);
75 3 zge=0;
76 3 P2=0xff;
77 3 cshi=1;
78 3 P2=dis[(dat_c-26)/10];
79 3 delay(1);
80 3
81 3
82 3 cshi=0;
83 3 P2=0xff;
84 3 cge=1;
85 3 P2=dis[(dat_c-26)%10];
86 3 delay(1);
87 3
88 3 }
89 2 if(dat_z>=23&&dat_z<=26)
90 2 {
91 3 // P0=0x00;
92 3 P0=0xe2;
93 3 cge=0;
94 3 P1=0xff;
95 3 zshi=1;
96 3 P1=dis[(dat_z-23)%10];
97 3 delay(1);
98 3
99 3 zshi=0;
100 3 P2=0xff;
101 3 cshi=1;
102 3 P2=dis[(dat_c-23)%10];
103 3 delay(1);
104 3 cshi=0;
105 3 }
106 2 }
107 1 if(dat_z<23)
108 1 {
109 2 if(dat_z>3&&dat_z<23)
110 2 {
111 3 P0=0xdd;//红灯
112 3 P1=0xff;
113 3 zshi=1;
114 3 P1=dis[(dat_z)/10];
115 3 delay(1);
116 3 zshi=0;
117 3 P1=0xff;
C51 COMPILER V8.02 JIAOTONGNEW 08/12/2008 11:23:05 PAGE 3
118 3 zge=1;
119 3 P1=dis[(dat_z)%10];
120 3 delay(1);
121 3 zge=0;
122 3 P2=0xff;
123 3 cshi=1;
124 3 P2=dis[(dat_c-3)/10];
125 3 delay(1);
126 3
127 3
128 3 cshi=0;
129 3 P2=0xff;
130 3 cge=1;
131 3 P2=dis[(dat_c-3)%10];
132 3 delay(1);
133 3 }
134 2 if(dat_z<=3)
135 2 {
136 3
137 3 P0=0xd4;
138 3 cge=0;
139 3 P1=0xff;
140 3 cge=1;
141 3 P1=dis[(dat_z)%10];
142 3 delay(1);
143 3
144 3 zge=0;
145 3 P2=0xff;
146 3 zge=1;
147 3 P2=dis[(dat_c)%10];
148 3 delay(1);
149 3
150 3 }
151 2 }
152 1
153 1
154 1 }
155 void displayantz(uchar dat_z)
156 {
157 1 if(dat_z>=23&&dat_z<=56)
158 1 {
159 2 if(dat_z>26&&dat_z<=56)
160 2 {
161 3 // P0=0xeb;
162 3 // P3=0x00;
163 3 P1=0xff;
164 3 zshi=1;
165 3 P1=dis[(dat_z-23)/10];
166 3 delay(1);
167 3 zshi=0;
168 3 P1=0xff;
169 3 zge=1;
170 3 P1=dis[(dat_z-23)%10];
171 3 delay(1);
172 3 zge=0;
173 3 }
174 2 }
175 1
176 1 if(dat_z<23)
177 1 {
178 2 if(dat_z>3&&dat_z<23)
179 2 {
C51 COMPILER V8.02 JIAOTONGNEW 08/12/2008 11:23:05 PAGE 4
180 3 P1=0xff;
181 3 zshi=1;
182 3 P1=dis[(dat_z)/10];
183 3 delay(1);
184 3 zshi=0;
185 3 P1=0xff;
186 3 zge=1;
187 3 P1=dis[(dat_z)%10];
188 3 delay(1);
189 3 zge=0;
190 3 }
191 2 if(dat_z<=3)
192 2 {
193 3
194 3 P0=0xd4;
195 3 cge=0;
196 3 P1=0xff;
197 3 cge=1;
198 3 P1=dis[(dat_z)%10];
199 3 delay(1);
200 3
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -