152 lines
4.4 KiB
Plaintext
152 lines
4.4 KiB
Plaintext
C51 COMPILER V9.59.0.0 CLOCK 05/23/2018 00:05:56 PAGE 1
|
||
|
||
|
||
C51 COMPILER V9.59.0.0, COMPILATION OF MODULE CLOCK
|
||
OBJECT MODULE PLACED IN .\Objects\clock.obj
|
||
COMPILER INVOKED BY: C:\Keil_v5\C51\BIN\C51.EXE clock.c OPTIMIZE(8,SPEED) BROWSE DEBUG OBJECTEXTEND PRINT(.\Listings\clo
|
||
-ck.lst) TABS(2) OBJECT(.\Objects\clock.obj)
|
||
|
||
line level source
|
||
|
||
1 #include <AT89X51.H>
|
||
2 #define uint unsigned int
|
||
3 #define uchar unsigned char
|
||
4 sbit led1=P1^0;
|
||
5 sbit k1=P1^1;
|
||
6 sbit k2=P1^2;
|
||
7 sbit k3=P1^3;
|
||
8 sbit k4=P1^4;
|
||
9 sbit k5=P1^5;
|
||
10
|
||
11 void xiaoai();
|
||
12 uchar code duan[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e};
|
||
13 uchar code wei[]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe};
|
||
14 uint miao,fen,xiaoshi,ge,shi,bai,qian,wan,shiwan,t;
|
||
15
|
||
16 void times(uint z)
|
||
17 {
|
||
18 1 uint i,j;
|
||
19 1 for(i=0; i<z; i++)
|
||
20 1 for(j=0; j<121; j++);
|
||
21 1 }
|
||
22
|
||
23 void xiaoai()
|
||
24 {
|
||
25 1 ge=miao%10;
|
||
26 1 shi=miao/10;
|
||
27 1 bai=fen%10;
|
||
28 1 qian=fen/10;
|
||
29 1 wan=xiaoshi%10;
|
||
30 1 shiwan=xiaoshi/10;
|
||
31 1
|
||
32 1 P0=duan[ge];
|
||
33 1 P2=wei[7];
|
||
34 1 times(1);
|
||
35 1 P2=0xff;
|
||
36 1
|
||
37 1 P0=duan[shi];
|
||
38 1 P2=wei[6];
|
||
39 1 times(1);
|
||
40 1 P2=0xff;
|
||
41 1
|
||
42 1 P0=duan[bai];
|
||
43 1 P2=wei[5];
|
||
44 1 times(1);
|
||
45 1 P2=0xff;
|
||
46 1
|
||
47 1 P0=duan[qian];
|
||
48 1 P2=wei[4];
|
||
49 1 times(1);
|
||
50 1 P2=0xff;
|
||
51 1
|
||
52 1 P0=duan[wan];
|
||
53 1 P2=wei[3];
|
||
54 1 times(1);
|
||
C51 COMPILER V9.59.0.0 CLOCK 05/23/2018 00:05:56 PAGE 2
|
||
|
||
55 1 P2=0xff;
|
||
56 1
|
||
57 1 P0=duan[shiwan];
|
||
58 1 P2=wei[2];
|
||
59 1 times(1);
|
||
60 1 P2=0xff;
|
||
61 1 }
|
||
62
|
||
63 void main()
|
||
64 {
|
||
65 1 EA=1;
|
||
66 1 TMOD=0x01;
|
||
67 1 ET0=1;
|
||
68 1 TH0=(65535-50000)/256;
|
||
69 1 TL0=(65535-50000)%256;
|
||
70 1
|
||
71 1 while(1)
|
||
72 1 {
|
||
73 2 xiaoai();
|
||
74 2
|
||
75 2 if(k1==0)
|
||
76 2 TR0=1;
|
||
77 2 else if(k2==0)
|
||
78 2 TR0=0;
|
||
79 2 else if(k3==0) {
|
||
80 3 miao=0;
|
||
81 3 fen=0;
|
||
82 3 xiaoshi=0;
|
||
83 3 }
|
||
84 2 else if(TR0==0&&k4==0)
|
||
85 2 {
|
||
86 3 fen=fen+1;
|
||
87 3 while(!k4) {
|
||
88 4 xiaoai();
|
||
89 4 }
|
||
90 3 }
|
||
91 2 else if(TR0==0&&k5==0) {
|
||
92 3 xiaoshi=xiaoshi+1;
|
||
93 3 while(!k5) {
|
||
94 4 xiaoai();
|
||
95 4 }
|
||
96 3 }
|
||
97 2
|
||
98 2
|
||
99 2 if(t==20){
|
||
100 3 t=0;
|
||
101 3 miao=miao+1;
|
||
102 3 }
|
||
103 2 else if(miao==60) {
|
||
104 3 miao=0;
|
||
105 3 fen=fen+1;
|
||
106 3 }
|
||
107 2 else if(fen==60) {
|
||
108 3 fen=0;
|
||
109 3 xiaoshi=xiaoshi+1;
|
||
110 3 }
|
||
111 2 else if(xiaoshi==24)
|
||
112 2 xiaoshi=0;
|
||
113 2
|
||
114 2 xiaoai();
|
||
115 2 }
|
||
116 1 }
|
||
C51 COMPILER V9.59.0.0 CLOCK 05/23/2018 00:05:56 PAGE 3
|
||
|
||
117
|
||
118 void int0() interrupt 1
|
||
119 {
|
||
120 1 t++;
|
||
121 1 TH0=(65535-50000)/256;
|
||
122 1 TL0=(65535-50000)%256;
|
||
123 1 }
|
||
|
||
|
||
MODULE INFORMATION: STATIC OVERLAYABLE
|
||
CODE SIZE = 480 ----
|
||
CONSTANT SIZE = 24 ----
|
||
XDATA SIZE = ---- ----
|
||
PDATA SIZE = ---- ----
|
||
DATA SIZE = 20 ----
|
||
IDATA SIZE = ---- ----
|
||
BIT SIZE = ---- ----
|
||
END OF MODULE INFORMATION.
|
||
|
||
|
||
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
|