📄 index.lst
字号:
C51 COMPILER V7.06 INDEX 11/16/2007 20:10:34 PAGE 1
C51 COMPILER V7.06, COMPILATION OF MODULE INDEX
OBJECT MODULE PLACED IN index.OBJ
COMPILER INVOKED BY: D:\Keil\C51\BIN\C51.EXE index.c BROWSE DEBUG OBJECTEXTEND
stmt level source
1 /************************************************
2 时钟程序
3 版本:1.0.0
4 版权2007,沈佳华所有
5 ************************************************/
6 #include<reg52.h>
7 #include<intrins.h>
8 #include<UserDefine.h>
9 #include<iic.h>
10
11 #define uchar unsigned char
12 #define uint unsigned int
13
14 uchar N=100,en=0,c=0; //N用来定时计数次数,十次为0.5s,en用来是否开启选中为闪烁,c用来控制对那位进行闪烁
15 uchar Y2=0,Y1=7,M2=1,M1=1,D2=1,D1=0,H2=2,H1=1,MU2=2,MU1=0,S2=0,S1=0,Tem2=1,Tem1=9,W;//年、月、日、时、分、
-秒、温度,星期的几个外部变量
16 uchar temp; //临时变量
17 uchar code TAB[]={0x3f,0x06,0x5b,0x27,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x40,0x00};//分别在数码管上显示0-9和"-
-"负号
18 uchar code set[]={0x00,0x1f,0x00,0x50,0x20,0x15,0x04,0x11,0x07}; //初始化设定时间为2007年11月15日20点50分
-00秒
19 uchar in[7]; //用来接收芯片数据
20 uchar out[7]; //用来设置闹铃数据缓冲
21
22 void Init_Device(void); //初始化单片机和时钟芯片函数
23 void show(void); //显示
24 void Start_ADC0809(void); //启动0809对温度传感器测量
25 uchar transform(uchar); //工程量转换程序
26 void KEY(void); //按键,调时间和设定闹钟
27 void Tcs(void); //将时间信号进行BCD译码
28 void shanshuo(uchar i); //选中为闪烁
29
30 main()
31 {
32 1 Init_Device(); //初始化单片机和时钟芯片函数
33 1
34 1 while(1)
35 1 {
36 2 KEY();
37 2 }
38 1 }
39
40 void XINT0() interrupt 0 //时钟芯片中断,最高
41 {
42 1 read_N_byte(0x01,0x02,7,in); //9--接收N个字节 CS_I2C为读寻址字节
43 1 Tcs(); //将时间信号进行BCD译码
44 1 }
45
46
47 void TT0() interrupt 1 using 1 //定时器0中断
48 {
49 1 TR0=0;
50 1 show(); //显示
51 1 if(--N==0)
52 1 {
C51 COMPILER V7.06 INDEX 11/16/2007 20:10:34 PAGE 2
53 2 Start_ADC0809(); //启动0809,对温度传感器测量
54 2 shanshuo(en); //对选中为进行闪烁
55 2 N=100;
56 2 }
57 1 TH0=0xEC; //定时5ms
58 1 TL0=0x77;
59 1 TR0=1;
60 1 }
61
62 void TADC() interrupt 2 //温度传感器ADC转换完成中断,最低
63 {
64 1 ADC_EN=1; //打开输出使能
65 1 _nop_();
66 1 temp=P1; //将转换数码取到零时变量中
67 1 _nop_();
68 1 ADC_EN=0; //关闭输出使能
69 1 temp=transform(temp); //工程量转换程序
70 1 Tem2=temp;
71 1 Tem2=Tem2>>4; //将temp的高4位给了Tem2
72 1 //Tem2=Tem2&0x0f;
73 1 Tem1=temp&0x0f; //将temp的低4位给了Tem1
74 1 }
75
76
77
78
79 void shanshuo(uchar i) //选中为闪烁
80 {
81 1 uchar a1,a2,a3=1;
82 1 if(i!=0)
83 1 {
84 2 switch(c)
85 2 {
86 3 case 0:
87 3 {
88 4 a1=Y1;
89 4 a2=Y2;
90 4 if(a3==1)
91 4 {
92 5 Y1=11;
93 5 Y2=11;
94 5 }
95 4 else
96 4 {
97 5 Y1=a1;
98 5 Y2=a2;
99 5 }
100 4 }
101 3 case 1:
102 3 {
103 4 a1=M1;
104 4 a2=M2;
105 4 if(a3==1)
106 4 {
107 5 M1=11;
108 5 M2=11;
109 5 }
110 4 else
111 4 {
112 5 M1=a1;
113 5 M2=a2;
114 5 }
C51 COMPILER V7.06 INDEX 11/16/2007 20:10:34 PAGE 3
115 4 }
116 3 case 2:
117 3 {
118 4 a1=D1;
119 4 a2=D2;
120 4 if(a3==1)
121 4 {
122 5 D1=11;
123 5 D2=11;
124 5 }
125 4 else
126 4 {
127 5 D1=a1;
128 5 D2=a2;
129 5 }
130 4 }
131 3 case 3:
132 3 {
133 4 a1=H1;
134 4 a2=H2;
135 4 if(a3==1)
136 4 {
137 5 H1=11;
138 5 H2=11;
139 5 }
140 4 else
141 4 {
142 5 H1=a1;
143 5 H2=a2;
144 5 }
145 4 }
146 3 case 4:
147 3 {
148 4 a1=MU1;
149 4 a2=MU2;
150 4 if(a3==1)
151 4 {
152 5 MU1=11;
153 5 MU2=11;
154 5 }
155 4 else
156 4 {
157 5 MU1=a1;
158 5 MU2=a2;
159 5 }
160 4 }
161 3 case 5:
162 3 {
163 4 a1=S1;
164 4 a2=S2;
165 4 if(a3==1)
166 4 {
167 5 S1=11;
168 5 S2=11;
169 5 }
170 4 else
171 4 {
172 5 S1=a1;
173 5 S2=a2;
174 5 }
175 4 }
176 3 case 6:
C51 COMPILER V7.06 INDEX 11/16/2007 20:10:34 PAGE 4
177 3 {
178 4 a1=W;
179 4 if(a3==1)
180 4 {
181 5 W=11;
182 5 }
183 4 else
184 4 {
185 5 W=a1;
186 5 }
187 4 }
188 3 }
189 2 a3=!a3;
190 2 }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -