📄 fmfb5sx3-stc11.lst
字号:
C51 COMPILER V7.50 FMFB5SX3_STC11 04/10/2009 11:12:16 PAGE 1
C51 COMPILER V7.50, COMPILATION OF MODULE FMFB5SX3_STC11
OBJECT MODULE PLACED IN FMFB5SX3-STC11.OBJ
COMPILER INVOKED BY: d:\Keil\C51\BIN\C51.EXE FMFB5SX3-STC11.C BROWSE DEBUG OBJECTEXTEND
line level source
1 #include <reg52.h>
2 #include <intrins.h>
3 #include <eeprom.h>
4 #include <delay.h>
5 #include <dog.h>
6
7 #define uchar unsigned char
8 #define uint unsigned int
9
10 uchar code num[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};//此数组为 !!! 0~9,不显示 !!!
11 uchar code numge[]={0xbf,0x86,0xdb,0xcf,0xe6,0xed,0xfd,0x87,0xff,0xef};// 带.数字1~9
12 uchar code numbai[]={0x00,0x06};
13 uchar code wei[]={0x8f,0x4f,0x2f,0x1f};//bai,shi,ge,xsh
14
15 uchar updata[]={0,5,5,0}; //EEPROM shuzu
16 uint out[]={0,0,0,0}; //output shuzu
17
18 uchar bai,shi,ge,xsh;
19
20 sbit b0=P1^7; //output 位定义
21 sbit b1=P1^6;
22 sbit b2=P1^5;
23 sbit b3=P2^7;
24 sbit b4=P2^6;
25 sbit b5=P2^5;
26 sbit b6=P2^4;
27 sbit b7=P2^3;
28 sbit b8=P2^2;
29 sbit b9=P2^1;
30 sbit b10=P2^0;
31
32 sbit key_up=P0^0;
33 sbit key_down=P0^1;
34 sbit key_remember=P0^2;
35
36 void display()
37 {
38 1 P0=wei[0];
39 1 P3=numbai[bai];
40 1 Delay_MS (1);
41 1 WDT_CONTR=0x3c; //喂狗
42 1 P0=wei[1];
43 1 P3=num[shi];
44 1 Delay_MS (1);
45 1
46 1 P0=wei[2];
47 1 P3=numge[ge];
48 1 Delay_MS (1);
49 1 WDT_CONTR=0x3c; //喂狗
50 1 P0=wei[3];
51 1 P3=num[xsh];
52 1 Delay_MS (1);
53 1 }
54
55 /*
C51 COMPILER V7.50 FMFB5SX3_STC11 04/10/2009 11:12:16 PAGE 2
56 void reset()
57 {
58 Sector_Erase(0x0000);
59 Byte_Program(0x0000,0);
60 Sector_Erase(0x0200);
61 Byte_Program(0x0200,0);
62 Sector_Erase(0x0400);
63 Byte_Program(0x0400,0);
64 Sector_Erase(0x0600);
65 Byte_Program(0x0600,0);
66 }
67 */
68 void sys_init()
69 {
70 1
71 1 bai=Byte_Read(0x0000);//读入eeprpm 数据
72 1 shi=Byte_Read(0x0200);
73 1 ge =Byte_Read(0x0400);
74 1 xsh=Byte_Read(0x0600);
75 1 WDT_CONTR=0x3c; //喂狗
76 1
77 1 }
78 void remember_ready()
79 {
80 1 updata[0]=bai;
81 1 updata[1]=shi;
82 1 updata[2]= ge;
83 1 updata[3]=xsh;
84 1 }
85 void remember()
86 {
87 1 Sector_Erase(0x0000);
88 1 Byte_Program(0x0000,updata[0]);
89 1 Sector_Erase(0x0200);
90 1 Byte_Program(0x0200,updata[1]);
91 1 Sector_Erase(0x0400);
92 1 Byte_Program(0x0400,updata[2]);
93 1 Sector_Erase(0x0600);
94 1 Byte_Program(0x0600,updata[3]);
95 1
96 1 WDT_CONTR=0x3c; //喂狗
97 1 }
98 void key()
99 {
100 1 if(key_up==0)
101 1 {
102 2 display();
103 2 Delay_MS (30);
104 2 if(key_up==0)
105 2 {display();
106 3 xsh++;
107 3 if(xsh==10)
108 3 {display();
109 4 xsh=0;ge++;
110 4 if(ge==10)
111 4 {display();
112 5 ge=0;shi++;
113 5 if(shi==10)
114 5 {display();
115 6 shi=0;bai++;
116 6 if(bai==2){bai=0;}
117 6 }
C51 COMPILER V7.50 FMFB5SX3_STC11 04/10/2009 11:12:16 PAGE 3
118 5 }
119 4 }
120 3
121 3 }
122 2 display();
123 2 }
124 1
125 1 WDT_CONTR=0x3c; //喂狗
126 1
127 1 if(key_down==0)
128 1 {
129 2 display();
130 2 Delay_MS (30);
131 2 if(key_down==0)
132 2 {display();
133 3 xsh--;
134 3 if(xsh==-1)
135 3 {display();
136 4 xsh=9;ge--;
137 4 if(ge==-1)
138 4 {display();
139 5 ge=9;shi--;
140 5 if(shi==-1)
141 5 {display();
142 6 shi=9;bai--;
143 6 if(bai==-1){bai=1;}
144 6 }
145 5 }
146 4 }
147 3
148 3 }
149 2 display();
150 2 }
151 1 display();
152 1 remember_ready(); //刷新updata
153 1
154 1 WDT_CONTR=0x3c; //喂狗
155 1
156 1 if(key_remember==0)
157 1 {
158 2 Delay_MS (40);
159 2 if(key_remember==0)
160 2 {
161 3 remember();
162 3 }
163 2 display();
164 2 }
165 1 }
166 void output()
167 {
168 1 uint output_data;
169 1 out[0]=Byte_Read(0x0000);
170 1 out[1]=Byte_Read(0x0200);
171 1 out[2]=Byte_Read(0x0400);
172 1 out[3]=Byte_Read(0x0600);
173 1
174 1 output_data = out[0]*1000+out[1]*100+out[2]*10+out[3];
175 1
176 1 WDT_CONTR=0x3c; //喂狗
177 1
178 1 b10=output_data%2;
179 1 b9=output_data/2%2;
C51 COMPILER V7.50 FMFB5SX3_STC11 04/10/2009 11:12:16 PAGE 4
180 1 b8=output_data/2/2%2;
181 1 b7=output_data/2/2/2%2;
182 1 b6=output_data/2/2/2/2%2;
183 1 b5=output_data/2/2/2/2/2%2;
184 1 b4=output_data/2/2/2/2/2/2%2;
185 1 b3=output_data/2/2/2/2/2/2/2%2;
186 1 b2=output_data/2/2/2/2/2/2/2/2%2;
187 1 b1=output_data/2/2/2/2/2/2/2/2/2%2;
188 1 b0=output_data/2/2/2/2/2/2/2/2/2/2%2;
189 1
190 1 }
191 //--------------------主函数------------------------
192 void main()
193 {
194 1 WDT_CONTR=0x3c; //喂狗
195 1 sys_init();
196 1 while(1)
197 1 {
198 2 key();
199 2
200 2 WDT_CONTR=0x3c; //喂狗
201 2
202 2 output();
203 2
204 2 }
205 1 }
206
207
208
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 691 ----
CONSTANT SIZE = 26 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 18 ----
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 + -