📄 main.lst
字号:
400 1 union {float Float;unsigned char FloatArray[4];}xdata EUnion;
401 1 float xdata TempFloat;
402 1
403 1 unsigned char TempLogic;
404 1 wdt_init();
405 1 wdt_refresh();
406 1 init_5045wdt(0x20);
407 1 // SlaveTimer1=SlaveTimer2=0;
408 1 cs5045=0;
409 1 cs5045=1;
410 1 Project_Init();
411 1 wdt_refresh();
412 1 if(read_page_float4(EE_POWER1)!=123.4567)
413 1 {
C51 COMPILER V7.06 MAIN 10/23/2004 16:55:18 PAGE 8
414 2 ////write 1 page,include RunMileage,SingleMileage,TotalMileage,ErrorTimes,FuelUse
415 2 RunTime=0;
416 2 RunErrorTimes=0;
417 2 FuelUse=0;
418 2 RunMileage=0;
419 2 SingleMileage=0;
420 2 TotalMileage=0;
421 2
422 2 write_page_float4(RUN_MILEAGE,0);
423 2 write_page_float4(SINGLE_MILEAGE,0);
424 2 wdt_refresh();
425 2 write_page_float4(TOTAL_MILEAGE,0);
426 2 write_byte(RUN_ERROR_TIMES,0);
427 2 write_byte(RUN_TIME,0);
428 2 write_byte(FUEL_USE,0);
429 2 wdt_refresh();
430 2 write_byte(ERROR_CODE0,0);
431 2 write_byte(ERROR_CODE1,0);
432 2 write_byte(ERROR_CODE2,0);
433 2 write_byte(ERROR_CODE3,0);
434 2 wdt_refresh();
435 2 write_byte(ERROR_CODE4,0);
436 2 write_byte(ERROR_CODE5,0);
437 2 write_byte(ERROR_CODE6,0);
438 2 write_byte(ERROR_CODE7,0);
439 2 wdt_refresh();
440 2 for(loop1=0;loop1<10000;loop1++)
441 2 {
442 3 ;
443 3 }
444 2 write_page_float4(EE_POWER1,123.4567);
445 2 }
446 1
447 1 wdt_refresh();
448 1 cs5045=0;
449 1 _nop_();
450 1 _nop_();
451 1 cs5045=1;
452 1 RunMileage=read_page_float4(RUN_MILEAGE);
453 1 SingleMileage=read_page_float4(SINGLE_MILEAGE);
454 1 TotalMileage=read_page_float4(TOTAL_MILEAGE);
455 1 if((SingleMileage>9999.9)||(SingleMileage<0.01))
456 1 {
457 2 write_page_float4(SINGLE_MILEAGE,0);
458 2 SingleMileage=0;
459 2 }
460 1 if((TotalMileage>999999)||(TotalMileage<0))
461 1 {
462 2 write_page_float4(TOTAL_MILEAGE,0);
463 2 TotalMileage=0;
464 2 }
465 1 RunTime=read_byte(RUN_TIME);
466 1 RunErrorTimes=read_byte(RUN_ERROR_TIMES);
467 1 FuelUse=read_byte(FUEL_USE);
468 1 wdt_refresh();
469 1 cs5045=0;
470 1 _nop_();
471 1 _nop_();
472 1 cs5045=1;
473 1
474 1 for(loop1=0;loop1<20;loop1++)
475 1 {
C51 COMPILER V7.06 MAIN 10/23/2004 16:55:18 PAGE 9
476 2 for(loop2=0;loop2<8;loop2++)
477 2 {
478 3 MsgTrans[loop1][loop2]=0;
479 3 }
480 2 }
481 1 for(loop=0;loop<13;loop++)
482 1 {
483 2 ReceiveBuffer[loop]=0;
484 2 }
485 1 wdt_refresh();
486 1 cs5045=0;
487 1 _nop_();
488 1 _nop_();
489 1 cs5045=1;
490 1 for(loop=0;loop<4;loop++)
491 1 {
492 2 fre[loop]=0;
493 2 }
494 1 for(loop=0;loop<5;loop++)
495 1 {
496 2 EngineSpeedArray[loop]=0;
497 2 }
498 1
499 1 for(loop=0;loop<51;loop++)
500 1 {
501 2 SendBuffer[loop]=0;
502 2 }
503 1 diagnostic[0]=read_byte(ERROR_CODE0);
504 1 diagnostic[1]=read_byte(ERROR_CODE1);
505 1 diagnostic[2]=read_byte(ERROR_CODE2);
506 1 diagnostic[3]=read_byte(ERROR_CODE3);
507 1 diagnostic[4]=read_byte(ERROR_CODE4);
508 1 diagnostic[5]=read_byte(ERROR_CODE6);
509 1 diagnostic[6]=read_byte(ERROR_CODE6);
510 1 diagnostic[7]=read_byte(ERROR_CODE7);
511 1
512 1 wdt_refresh();
513 1 cs5045=0;
514 1 _nop_();
515 1 _nop_();
516 1 cs5045=1;
517 1
518 1 for(loop=0;loop<8;loop++)
519 1 {
520 2 ADValue[0][loop]=ad_single(0);
521 2 }
522 1 for(loop=0;loop<8;loop++)
523 1 {
524 2 ADValue[1][loop]=ad_single(1);
525 2 }
526 1 wdt_refresh();
527 1 cs5045=0;
528 1 _nop_();
529 1 _nop_();
530 1 cs5045=1;
531 1 SensorValue=0;//calculate sum
532 1 for(loop=0;loop<8;loop++)
533 1 {
534 2 ADValue[1][loop]=ad_single(1);/////////added 2004/09/15//by lihx
535 2 SensorValue+=ADValue[1][loop];
536 2
537 2 }
C51 COMPILER V7.06 MAIN 10/23/2004 16:55:18 PAGE 10
538 1 ADResult=SensorValue/8.0+0.5;//calculate average
539 1 SensorValue=sensor_value(300,ADResult);
540 1 if(SensorValue>180) SensorValue=180;
541 1 if(SensorValue<10) SensorValue=10;
542 1 FuelQ=10.0/17.0*SensorValue-100.0/17.0+0.5;
543 1
544 1 SensorValue=0;//calculate sum
545 1 for(loop=0;loop<8;loop++)
546 1 {
547 2 ADValue[0][loop]=ad_single(0);/////////added 2004/09/15//by lihx
548 2 SensorValue+=ADValue[0][loop];
549 2 }
550 1 ADResult=SensorValue/8.0+0.5;//calculate average
551 1 SensorValue=sensor_value(300,ADResult);
552 1 WaterT=WaterTTable[find_data(SensorValue,WaterTSensorTable,81)];
553 1 if(WaterT>=44)
554 1 {
555 2 WaterT-=4;
556 2 }
557 1 wdt_refresh();
558 1 cs5045=0;
559 1 _nop_();
560 1 _nop_();
561 1 cs5045=1;
562 1 ///////////////////////added for DFqc ////////////////////////////////
563 1 ///////////////////////20041022//////////////////////////////////////
564 1 SensorValue=0;//calculate sum
565 1 for(loop=0;loop<8;loop++)
566 1 {
567 2 ADValue[2][loop]=ad_single(2);/////////added 2004/09/15//by lihx
568 2 SensorValue+=ADValue[2][loop];
569 2 }
570 1 ADResult=SensorValue/8.0+0.5;//calculate average
571 1 SensorValue=sensor_value(300,ADResult);
572 1 WaterT1=Water1TTable[find_data(SensorValue,Water1TSensorTable,81)];
573 1 /////////////////////////////////////////////////////////////////////
574 1
575 1 ClearDelayTimer1=0;
576 1 ClearDelayTimer2=0;
577 1 ClearOnTimer1=0;
578 1 ClearOnTimer2=0;
579 1 ClearErrorFlag=0;
580 1 ClearMileageFlag=0;
581 1 KeyBuffer=0;
582 1 TH0Buffer=0;
583 1 TL0Buffer=0;
584 1 T0IntBuffer=0;
585 1 T0IntCounter=0;
586 1 PowerOnTimer=0;
587 1 ////////////////////////////////////////////////////////////////////////////////////////////////////////
588 1 for(;;)
589 1 {
590 2 wdt_refresh();
591 2 p=MsgTrans;
*** WARNING C182 IN LINE 591 OF MAIN.C: pointer to different objects
592 2 ////////read and send transmission message
593 2 for(loop1=0;loop1<8;loop1++)
594 2 {
595 3 for(loop2=0;loop2<8;loop2++)
596 3 {
597 4 MsgTrans[loop1][loop2]=99;
598 4 }
C51 COMPILER V7.06 MAIN 10/23/2004 16:55:18 PAGE 11
599 3 }
600 2 cs5045=0;
601 2 _nop_();
602 2 _nop_();
603 2 cs5045=1;
604 2 // TurnLeft=get_bit(_C_111XM,O11_111XM,p);
605 2 // TurnRight=get_bit(_C_111XM,O12_111XM,p);
606 2 lamp[0]=Sort_Port_Bit(
607 2 0,//TurnLeft,//左转
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -