📄 shizhong1-1.lst
字号:
C51 COMPILER V7.02b SHIZHONG1_1 05/11/2008 12:14:40 PAGE 1
C51 COMPILER V7.02b, COMPILATION OF MODULE SHIZHONG1_1
OBJECT MODULE PLACED IN shizhong1-1.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE shizhong1-1.c BROWSE DEBUG OBJECTEXTEND
stmt level source
1 #include<reg51.h>
2 #define uint unsigned int
3 #define uchar unsigned char
4 unsigned char code table0[]={0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90};//段码表共阳极
5 unsigned char code table2[]={0xFB,0xF7,0xEF,0xDF,0xBF,0x67F};//位码表
6 void chushihua();
7 void display(uchar aa,uchar bb,uchar cc,uchar dd,uchar shi,uchar ge);
8 void delay(uchar z);
9 uchar aa,bb,cc,dd,shi,ge,ss,num,shu,temp;
10 void main()
11 {
12 1 chushihua();
13 1 while(1)
14 1 {
15 2 display(aa,bb,cc,dd,shi,ge);
16 2 }
17 1 }
18 void delay(uchar z)
19 {
20 1 uchar x,y;
21 1 for(x=z;x>0;x--)
22 1 for(y=110;y>0;y--);
23 1 }
24 void chushihua()
25 {
26 1 num=23;
27 1 shu=58;
28 1 temp=0;
29 1 aa=num/10;
30 1 bb=num%10;
31 1 cc=shu/10;
32 1 dd=shu%10;
33 1 shi=temp/10;
34 1 ge=temp%10;
35 1 P2=0xff;
36 1 delay(10);
37 1 TMOD=0X01;//选择T0工作在模式1
38 1 TH0=(65536-46080)/256;
39 1 TL0=(65536-46080)%256;//赋初值
40 1 EA=1;//开总中断
41 1 ET0=1;//开定时器0中断
42 1 TR0=1;//启动定时器0
43 1 }
44 void display(uchar aa,uchar bb,uchar cc,uchar dd,uchar shi,uchar ge)
45 {
46 1 if(ss==20)
47 1 {
48 2 ss=0;
49 2 temp++;
50 2 }
51 1 if(temp==60)
52 1 {
53 2 temp=0;
54 2 shu++;
55 2 }
C51 COMPILER V7.02b SHIZHONG1_1 05/11/2008 12:14:40 PAGE 2
56 1
57 1 shi=temp/10;
58 1 ge=temp%10;
59 1 P2=0xff;
60 1 delay(5);
61 1 P0=table0[shi];
62 1 delay(5);
63 1 P2=0xf7;
64 1 delay(5);
65 1
66 1 P2=0xff;
67 1 delay(5);
68 1 P0=table0[ge];
69 1 delay(5);
70 1 P2=0xfb;
71 1 delay(5);
72 1 if(shu==60)
73 1 {
74 2 shu=0;
75 2 num++;
76 2 }
77 1 cc=shu/10;
78 1 dd=shu%10;
79 1 P2=0xff;
80 1 delay(5);
81 1 P0=table0[cc];
82 1 delay(5);
83 1 P2=0xdf;
84 1 delay(5);
85 1
86 1 P2=0xff;
87 1 delay(5);
88 1 P0=table0[dd];
89 1 delay(5);
90 1 P2=0xef;
91 1 delay(5);
92 1 if(num==24)num=0;
93 1 aa=num/10;
94 1 bb=num%10;
95 1 P2=0xff;
96 1 delay(5);
97 1 P0=table0[aa];
98 1 delay(5);
99 1 P2=0x7f;
100 1 delay(5);
101 1
102 1 P2=0xff;
103 1 delay(5);
104 1 P0=table0[bb];
105 1 delay(5);
106 1 P2=0xbf;
107 1 delay(5);
108 1 }
109 void timer0()interrupt 1
110 {
111 1 TH0=(65536-46080)/256;
112 1 TL0=(65536-46080)%256;//重赋初值
113 1 ss++;
114 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
C51 COMPILER V7.02b SHIZHONG1_1 05/11/2008 12:14:40 PAGE 3
CODE SIZE = 344 ----
CONSTANT SIZE = 16 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 10 6
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 + -