📄 retime.lst
字号:
C51 COMPILER V7.08 RETIME 05/10/2007 18:29:50 PAGE 1
C51 COMPILER V7.08, COMPILATION OF MODULE RETIME
OBJECT MODULE PLACED IN retime.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE retime.c BROWSE DEBUG OBJECTEXTEND
line level source
1 /***************************************
2 名称:倒计时牌
3 作者:董佩钦
4 修改时间:2007.4.20
5 功能:普通的倒计时
6 ***************************************/
7 #include<reg51.h>
8 #include<absacc.h>
9 #include<intrins.h>
10
11 #include "delay.h"
12
13 #define clock_segment XBYTE[0xBFFF] //时钟段码地址
14 #define clock_sel XBYTE[0x7FFF] //时钟位码地址
15 #define year_segment XBYTE[0xEFFF] //日历段码地址
16 #define year_sel XBYTE[0xDFFF] //日历位码地址
17 #define retime_segment XBYTE[0xFBFF]//倒计时段码地址
18 #define retime_sel XBYTE[0xF7FF] //倒计时位码地址
19
20 unsigned char time_num=0;//定时一秒次数
21 unsigned char shi_num=24;//小时位计数
22 unsigned char miao_ge=0; //秒个位
23 unsigned char miao_shi=0;//秒十位
24 unsigned char fen_ge=0;//分个位
25 unsigned char fen_shi=0;//分十位
26 unsigned char shi_ge=0;//时个位
27 unsigned char shi_shi=0;//时十位
28 unsigned char year_thousand=2;
29 unsigned char year_hundred=0;
30 unsigned char year_decade=0;
31 unsigned char year_unit=7;
32 unsigned char month_decade=0;
33 unsigned char month_unit=1;
34 unsigned char day_decade=0;
35 unsigned char day_unit=1;
36 unsigned char retime_unit=0;
37 unsigned char retime_decade=0;
38 unsigned char retime_hundred=0;
39 unsigned char retime_thousand=0;
40
41 unsigned char year_thoustore; //保存年千位数据
42 unsigned char year_hundstore; //保存年百位数据
43 unsigned char year_decastore; //保存年十位数据
44 unsigned char year_unitstore; //保存年个位数据
45 unsigned char month_unitstore;//保存月个位数据
46 unsigned char month_decastore;//保存月十位数据
47 unsigned char day_unitstore; //保存日个位数据
48 unsigned char day_decastore; //保存日十位数据
49 unsigned char year_unitstore2;//保存年各位数据
50 unsigned char year_decastore2;//年位组合子程序用来保护数据用
51 unsigned char year_hundstore2;
52 unsigned char year_thoustore2;
53 unsigned char retime_ustore; //保存倒计时各位数据
54 unsigned char retime_dstore;
55 unsigned char retime_hstore;
C51 COMPILER V7.08 RETIME 05/10/2007 18:29:50 PAGE 2
56 unsigned char retime_tstore;
57
58 unsigned char day_numj=31; //奇数月31天
59 unsigned char day_numo=30; //偶数月30天
60 unsigned char day_numooo=30;
61 unsigned char day_numoo;
62 unsigned char month_num=12;
63 unsigned int year_jointed; //年各位组合在一起,以便进行闰年判断
64 unsigned int year_help1;
65 unsigned int year_help2;
66
67 unsigned char xiaoshi_ge;//闪烁时存小时个位
68 unsigned char xiaoshi_shi;//闪烁时存小时十位
69 unsigned char fenzhong_ge;//闪烁时存分钟个位
70 unsigned char fenzhong_shi;//闪烁时存分钟十位
71
72 unsigned char cort=0;//判断第几次按下确认键
73
74 sbit key_sure=P1^0;//调时或确认键
75 sbit key_inc=P1^1;//调时加键
76 sbit key_dec=P1^2;//调时减键
77
78 bit first_sure=0; //第一次按下确认键
79 bit second_sure=0;//第二次按下确认键
80 bit third_sure=0; //第三次按下确认键
81 bit fourth_sure=0;//第四次按下确认键
82 bit fifth_sure=0; //第五次按下确认键
83 bit sixth_sure=0; //第六次按下确认键
84 bit seventh_sure=0;//第七次按下确认键
85
86
87 unsigned code table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x00};//段码表
88
89 /************函数声明*************/
90 void shannum_jian(void);
91 void inc_key(void);
92 void dec_key(void);
93 void dis_dingshi(void);
94 void hour_shanshuo(void);
95 void min_shanshuo(void);
96 void kbscan(void);
97 void display(void);
98 void year_joint(void);
99 unsigned char judgement_leap(void);
100 void retime_flash(void);
101
102 /********************************
103
104 显示子程序
105
106 *********************************/
107 void display(void)
108 {
109 1 clock_segment=table[miao_ge]; //送秒个位段位码
110 1 clock_sel=0xdf;
111 1 delay(3);
112 1 clock_segment=table[miao_shi]; //送秒十位段位码
113 1 clock_sel=0xef;
114 1 delay(3);
115 1 clock_segment=table[fen_ge]|0x80; //送分个位段位码
116 1 clock_sel=0xf7;
117 1 delay(3);
C51 COMPILER V7.08 RETIME 05/10/2007 18:29:50 PAGE 3
118 1 clock_segment=table[fen_shi]; //送分十位段位码
119 1 clock_sel=0xfb;
120 1 delay(3);
121 1 clock_segment=table[shi_ge]|0x80; //送时个位段位码
122 1 clock_sel=0xfd;
123 1 delay(3);
124 1 clock_segment=table[shi_shi]; //送时十位段位码
125 1 clock_sel=0xfe;
126 1 delay(3);
127 1 year_segment=table[day_unit]; //送日个位段位码
128 1 year_sel=0x7f;
129 1 delay(3);
130 1 year_segment=table[day_decade]; //送日十位段位码
131 1 year_sel=0xbf;
132 1 delay(3);
133 1 year_segment=table[month_unit]|0x80; //送月个位段位码
134 1 year_sel=0xdf;
135 1 delay(3);
136 1 year_segment=table[month_decade]; //送月十位段位码
137 1 year_sel=0xef;
138 1 delay(3);
139 1 year_segment=table[year_unit]|0x80; //送年个位段位码
140 1 year_sel=0xf7;
141 1 delay(3);
142 1 year_segment=table[year_decade]; //送年十位段位码
143 1 year_sel=0xfb;
144 1 delay(3);
145 1 year_segment=table[year_hundred]; //送年百位段位码
146 1 year_sel=0xfd;
147 1 delay(3);
148 1 year_segment=table[year_thousand]; //送年千位段位码
149 1 year_sel=0xfe;
150 1 delay(3);
151 1 retime_segment=table[retime_unit]; //送倒计时个位段位码
152 1 retime_sel=0xf7;
153 1 delay(3);
154 1 retime_segment=table[retime_decade]; //送倒计时十位段位码
155 1 retime_sel=0xfb;
156 1 delay(3);
157 1 retime_segment=table[retime_hundred];//送倒计时百位段位码
158 1 retime_sel=0xfd;
159 1 delay(3);
160 1 retime_segment=table[retime_thousand];//送倒计时千位段位码
161 1 retime_sel=0xfe;
162 1 delay(3);
163 1
164 1 }
165 /**********************************
166
167 判断闰年子程序
168
169 ***********************************/
170 unsigned char judgement_leap(void)
171 {
172 1 year_joint(); //调用年各位组合子程序
173 1 if((year_jointed%4==0&&year_jointed%100!=0)||(year_jointed%100==0&&year_jointed%400==0))return(29); //是
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -