📄 check.lst
字号:
255 3 LcdDisplay(24,0," 重试:0 错误:0 ",4);
256 3 LcdDisplay(48,16," [确认] [退出]",4);
257 3 while(1)
258 3 { //UartRxd(6,"888888");
259 4 val = GetKey();
260 4 if((val==K_HJ)||(val==K_TC)) return;
261 4 }
262 3 }
263 2 }
264 1 }
265
266 /*
267 ////////////////////////////////////////////////////////////////////
268 //Mode = 1 : 单字节编码
269 //Mode = 2 : 双字节编码
270 //Mode = 4 : 四字节编码
271 ////////////////////////////////////////////////////////////////////
272 void CodingDisplay(uchar mode)
273 {
274 uchar i,CodeDis[10],dat[2];
275 uchar str1[]={"1字节编码"},str2[25];
276 // ulong Bm;
277 switch(mode)
278 {
279 case 1:
280 strcpy(str2,"20<=编码<=7F");
281 break;
282 case 2:
283 str1[0]='2';
284 strcpy(str2,"8140<=编码<=F7FE");
285 break;
286 case 4:
287 str1[0]='4';
288 strcpy(str2,"8139EE39--82358738");
289 break;
290 default:return;
291 }
292 LcdDisplay(0,0,str1,3);
293 LcdDisplay(16,0,str2,0);
294 i=mode;
295 mode<<=1;
296 while(1)
297 {
298 LcdDisplay(32,0,"输入编码: ",0);
299 LcdDisplay(48,0,"对应字符:",0);
300 dat[0]=0;
301 memset(CodeDis,0,sizeof(CodeDis));
302 GetBcd(32,72,CodeDis,mode,dat);
303 if(dat[0] == K_TC)return;
C51 COMPILER V8.01 CHECK 03/28/2006 09:49:25 PAGE 6
304 CodeDis[i]=0;
305 LcdDisplay(48,72,CodeDis,0);
306 }
307 }
308
309 void CheckGB18030()
310 {
311 uchar Ln=1,Hov=1,InitKey[3];
312
313 while(1)
314 {
315 WindowsSet(3);
316 strcpy(&WinHint[0][1],"1.单字节编码");
317 strcpy(&WinHint[1][1],"2.双字节编码");
318 strcpy(&WinHint[2][1],"3.四字节编码");
319 InitKey[0]=K_HJ;
320 InitKey[1]=K_TC;
321 InitKey[2]=0;
322 Ln = Windows(Ln,0,InitKey);
323 if(*InitKey == K_TC) return;
324 switch(Ln)
325 {
326 case 1:
327 CodingDisplay(1);
328 break;
329 case 2:
330 CodingDisplay(2);
331 break;
332 case 3:
333 CodingDisplay(4);
334 break;
335 default:break;
336 }
337 }
338 }
339 */
340
341 void CheckSystem(void)
342 {
343 1 uchar select = 1;
344 1 uchar str[3];
345 1
346 1 while(1)
347 1 {
348 2 WindowsSet(5);
349 2 strcpy(WinHint[0]," 1.LCD显示检测");
350 2 strcpy(WinHint[1]," 2.键盘检测");
351 2 strcpy(WinHint[2]," 3.打印检测");
352 2 strcpy(WinHint[3]," 4.钱箱检测");
353 2 strcpy(WinHint[4]," 5.通信检测");
354 2 // strcpy(WinHint[5]," 6.GB18030汉字检测");
355 2 str[0] = K_HJ;
356 2 str[1] = K_TC; //只有“确认” “退出” 键才能退出菜单
357 2 str[2] = 0;
358 2 select = Windows(select,0,str); //显示选择菜单
359 2 if(str[0] == K_TC) return; //是“退出”键退出
360 2 switch(select)
361 2 {
362 3 case 1: CheckLcd(); break; //LCD显示测试
363 3 case 2: CheckKey(); break; //键盘测试
364 3 case 3: CheckPrint(); break; //打印测试
365 3 case 4: CheckBox(); break; //钱箱测试
C51 COMPILER V8.01 CHECK 03/28/2006 09:49:25 PAGE 7
366 3 case 5: CheckCom(); break; //通信测试
367 3 // case 6: CheckGB18030(); break;
368 3 default: break;
369 3 }
370 2 }
371 1 }
372 //------------------------自检---------------------------------------------
373 void Modify24C64()
374 {
375 1 uchar InitLen[2]={0,0};
376 1 uint adr,len;
377 1
378 1 LcdDisplay(0,16,"修改24C64内容",3);
379 1 LcdDisplay(16,32,"地址:",0);
380 1 LcdDisplay(32,32,"长度:",0);
381 1 adr=GetInt(16,72,0,5,0,InitLen);
382 1 InitLen[0]=0;
383 1 len=GetInt(32,72,0,3,0,InitLen);
384 1 // I2cRead(adr,len,RxdBuf);
385 1 // UartTxd(len,RxdBuf);
386 1 UartRxd(len,RxdBuf);
387 1 I2cWrite(adr,len,RxdBuf);
388 1 Hint(48,32,"修改完成!",0);
389 1 }
390
391 void Look24C64()
392 {
393 1 uchar InitLen[2]={0,0};
394 1 uint adr,len;
395 1
396 1 LcdDisplay(0,16,"查看24C64内容",3);
397 1 LcdDisplay(16,32,"地址:",0);
398 1 LcdDisplay(32,32,"长度:",0);
399 1 adr=GetInt(16,72,0,5,0,InitLen);
400 1 InitLen[0]=0;
401 1 len=GetInt(32,72,0,3,0,InitLen);
402 1 I2cRead(adr,len,RxdBuf);
403 1 UartTxd(len,RxdBuf);
404 1 Hint(48,16,"串口发送完成!",0);
405 1 }
406
407 void LookFlash()
408 {
409 1 uchar n;
410 1 ulong adr;
411 1 uint len;
412 1 uchar InitLen[2]={0,0};
413 1
414 1 LcdDisplay(0,16,"查看Flash内容",3);
415 1 LcdDisplay(16,32,"芯片:",0);
416 1 LcdDisplay(32,32,"地址:",0);
417 1 LcdDisplay(48,32,"长度:",0);
418 1 n=GetInt(16,72,0,1,0,InitLen);
419 1 InitLen[0]=0;
420 1 adr=GetInt(32,72,0,7,0,InitLen);
421 1 InitLen[0]=0;
422 1 len=GetInt(48,72,0,3,0,InitLen);
423 1 SerialFlashRead(n,adr,len,TxdBuf);
424 1 UartTxd(len,TxdBuf);
425 1 Hint(16,16,"串口发送完成!",3);
426 1 }
427
C51 COMPILER V8.01 CHECK 03/28/2006 09:49:25 PAGE 8
428 //void UsbTest()
429 //{
430 // uchar str[64],len;
431 // EA=1;
432 // InitUSB();
433 // while(1)
434 // {
435 // if(Receive(1,str)==1)
436 // {
437 // len=str[0];
438 // if(len==0xAA)
439 // {
440 // IEA = 0;
441 // UIEN = 0;
442 // UADR = 0;
443 // return;
444 // }
445 // if(Receive(len,&str[1])==1)
446 // {
447 // UsbSend(len+1,str);
448 // }
449 // }
450 // }
451 //}
452
453 void PcCom()
454 {
455 1 // uchar i;
456 1
457 1 // COM1CS;
458 1 // UARTC;
459 1 // UART1_Mod1_Timer1_9600;
460 1 //
461 1 // for(i=0;i<8;i++)
462 1 // TxdBuf[i]=0xAA;
463 1 // TxdNum=0;
464 1 // TxdLen=8;
465 1 // while(TxdNum<TxdLen)
466 1 // {
467 1 // SBUF2 = TxdBuf[TxdNum];
468 1 // while((SCON2 & 0x02)==0);
469 1 // SCON2 &= 0xFC;
470 1 // TxdNum++;
471 1 // }
472 1 //
473 1 // while(1)
474 1 // {
475 1 // UART1_Mod1_Timer1_9600;
476 1 //
477 1 // RxdLen=8;
478 1 // RxdNum=0;
479 1 // while(RxdNum<RxdLen)
480 1 // { while((SCON2 & 0x01)==0);
481 1 // SCON2 &= 0xFC;
482 1 // RxdBuf[RxdNum]=SBUF2;
483 1 // RxdNum++;
484 1 // if(RxdNum==1)
485 1 // {
486 1 // if(RxdBuf[0]==0xAA)return;
487 1 // RxdLen=RxdBuf[0]+1;
488 1 // }
489 1 // }
C51 COMPILER V8.01 CHECK 03/28/2006 09:49:25 PAGE 9
490 1 // for(i=0;i<RxdLen+1;i++)
491 1 // TxdBuf[i]=RxdBuf[i];
492 1 // TxdNum=1;
493 1 // TxdLen=RxdLen;
494 1 // UART1_Mod1_Timer1_9600;
495 1 //
496 1 // while(TxdNum<TxdLen)
497 1 // {
498 1 // SBUF2 = TxdBuf[TxdNum];
499 1 // while((SCON2 & 0x02)==0);
500 1 // SCON2 &= 0xFC;
501 1 // TxdNum++;
502 1 // }
503 1 // }
504 1 }
505
506 void ComTest()
507 {
508 1 uchar k,str[5];
509 1
510 1 while(1)
511 1 {
512 2 WindowsSet(3);
513 2 strcpy(&WinHint[0][1],"1.串口通信测试");
514 2 strcpy(&WinHint[1][1],"2.USB通信测试");
515 2 strcpy(&WinHint[2][1],"3.RS485联网通信测试");
516 2 str[0]=K_TC;
517 2 str[1]=K_HJ;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -