📄 main.lst
字号:
180 3
181 3 sSendComBuf[1]=3; //路号
182 3 sSendComBuf[2]=TesTemperature3/100 ; //整数位
183 3 sSendComBuf[3]=TesTemperature3%100; //小数位
184 3
185 3 send_string_com(sSendComBuf,5);
186 3 delay_ms(50);
187 3 }
188 2
189 2
190 2 }
191 1
192 1 }
193
194
195 //--------------------------------------------------------
196 //把读到的温度放到要显示缓存中
197 //输入:uiData 读到的数值 ID是温度的路号1表是第一路,2表示第二路,3表示第三路
198 //输出:通过给相应的数组赋值,达到输出
199 int translate(unsigned int uiData,unsigned char ID)
200 {
201 1
202 1 unsigned int uiInteger; //数据的整数部分
203 1 unsigned int uiDecimal; //数据的小数部分
204 1 unsigned int uiBai; //显示温度的百位
205 1 unsigned int uiShi; //显示温度的十位
206 1 unsigned int uiGe; //显示温度的个位
207 1 unsigned int uiShi_d; //显示温度的十分位
208 1 unsigned int uiBai_d; //显示温度的百分位
209 1 // unsigned int uiQian_d; //显示温度的千分位
210 1 unsigned int uiResidue; //数据的余数,作除法
211 1
212 1 uiInteger = 0;
213 1 uiDecimal = 0;
214 1
215 1 if(uiData & 0x0400)
216 1 uiInteger += 64; //转换为整数部分
217 1 if(uiData & 0x0200)
218 1 uiInteger += 32;
219 1 if(uiData & 0x0100)
220 1 uiInteger += 16;
221 1 if(uiData & 0x0080)
222 1 uiInteger += 8;
223 1 if(uiData & 0x0040)
224 1 uiInteger += 4;
225 1 if(uiData & 0x0020)
226 1 uiInteger += 2;
227 1 if(uiData & 0x0010)
228 1 uiInteger += 1;
229 1
230 1 if(uiData & 0x0008)
231 1 uiDecimal += 5000; //转换为小数部分
232 1 if(uiData & 0x0004)
233 1 uiDecimal += 2500;
234 1 if(uiData & 0x0002)
235 1 uiDecimal += 1250;
236 1 if(uiData & 0x0001)
237 1 uiDecimal += 625;
238 1
239 1 uiBai = uiInteger/100; //小数点前面部分
240 1 uiResidue = uiInteger%100;
C51 COMPILER V7.06 MAIN 05/23/2008 15:00:22 PAGE 5
241 1 uiInteger = uiResidue;
242 1 uiShi = uiInteger/10;
243 1 uiResidue = uiInteger%10;
244 1 uiGe = uiResidue;
245 1
246 1 uiShi_d = uiDecimal/1000; //小数点后面部分
247 1 uiResidue = uiDecimal%1000;
248 1 uiDecimal = uiResidue;
249 1 uiBai_d = uiDecimal/100;
250 1 uiResidue = uiDecimal%100;
251 1 uiDecimal = uiResidue;
252 1
253 1
254 1 //显示
255 1
256 1 switch(ID)
257 1 {
258 2 case 1:
259 2 tt[2]=uiShi+'0' ;
260 2 tt[3]=uiGe+'0' ;
261 2 // tt[4]='.';
262 2 tt[5]= uiShi_d+'0';
263 2 tt[6]= uiBai_d+'0' ;
264 2 break;
265 2 case 2:
266 2 tt[11]=uiShi+'0' ;
267 2 tt[12]=uiGe+'0' ;
268 2 // tt[13]='.';
269 2 tt[14]= uiShi_d+'0';
270 2 tt[15]= uiBai_d+'0' ;
271 2 break;
272 2 case 3:
273 2 PP[4]=uiShi+'0' ;
274 2 PP[5]=uiGe+'0' ;
275 2 // PP[6]='.';
276 2 PP[7]= uiShi_d+'0';
277 2 PP[8]= uiBai_d+'0' ;
278 2 break;
279 2 default:break;
280 2
281 2 }
282 1
283 1
284 1 return uiShi*1000+uiGe*100+uiShi_d*10+uiBai_d ;
285 1 }
286
287
288
289 void Key_Scan(void)//按键扫描
290 {
291 1
292 1 static unsigned char spo=0;
293 1 P2_0=1;
294 1 P2_1=1;
295 1 P2_2=1;
296 1 P2_3=1;
297 1 if(P2_0==0) //全开
298 1 {
299 2 delay_ms(5);
300 2 if(P2_0==0)
301 2 {
302 3 ID_choose1=1;
C51 COMPILER V7.06 MAIN 05/23/2008 15:00:22 PAGE 6
303 3 ID_choose2=1;
304 3 ID_choose3=1;
305 3 while(P2_0==0)
306 3 {;}
307 3 }
308 2 }
309 1
310 1 if(P2_1==0) //开/关第一路
311 1 {
312 2 delay_ms(5);
313 2 if(P2_1==0)
314 2 {
315 3 ID_choose1=~ID_choose1;
316 3 while(P2_1==0)
317 3 {;}
318 3 }
319 2 }
320 1 if(P2_2==0) //开/关第二路
321 1 {
322 2 delay_ms(5);
323 2 if(P2_2==0)
324 2 {
325 3 ID_choose2=~ID_choose2;
326 3
327 3 while(P2_2==0)
328 3 {;}
329 3 }
330 2 }
331 1 if(P2_3==0) //开/关第三路
332 1 {
333 2 delay_ms(5);
334 2 if(P2_3==0)
335 2 {
336 3 spo++;
337 3 if(spo>8)
338 3 {
339 4 spo=0;
340 4 }
341 3 ID_choose3=~ID_choose3;
342 3 sSendComBuf[1]=ID_choose1; //路号
343 3 sSendComBuf[2]=TesTemperature1/100 ; //整数位
344 3 sSendComBuf[3]=TesTemperature1%100; //小数位
345 3 send_string_com(sSendComBuf,5);
346 3
347 3 while(P2_3==0)
348 3 {;}
349 3 }
350 2 }
351 1 }
352
353
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 1520 ----
CONSTANT SIZE = 64 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 57 20
IDATA SIZE = ---- ----
BIT SIZE = 4 ----
END OF MODULE INFORMATION.
C51 COMPILER V7.06 MAIN 05/23/2008 15:00:22 PAGE 7
C51 COMPILATION COMPLETE. 1 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -