📄 main.lst
字号:
-date;
524 5 else
525 5 day_count = day_count + 31+ 28 + 31+ 30 + 31 + 30 + 31 + 31 + gps_point.OS_UTC.times.date;
526 5
527 5 break;
528 5 case 0x0A:
529 5 if(day_count_temp1==0)
530 5 day_count = day_count + 31+ 29 + 31+ 30 + 31 + 30 + 31 + 31 + 30 + gps_point.OS_UTC.t
-imes.date;
531 5 else
532 5 day_count = day_count + 31+ 28 + 31+ 30 + 31 + 30 + 31 + 31 + 30 + gps_point.OS_UTC.times.date;
533 5
534 5 break;
535 5 case 0x0B:
536 5 if(day_count_temp1==0)
537 5 day_count = day_count + 31+ 29 + 31+ 30 + 31 + 30 + 31 + 31 + 30 + 31 + gps_point.OS_
-UTC.times.date;
538 5 else
539 5 day_count = day_count + 31+ 28 + 31+ 30 + 31 + 30 + 31 + 31 + 30 + 31 + gps_point.OS_UTC.times.date;
540 5
541 5 break;
542 5 case 0x0C:
543 5 if(day_count_temp1==0)
544 5 day_count = day_count + 31+ 29 + 31+ 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + gps_poin
-t.OS_UTC.times.date;
545 5 else
C51 COMPILER V7.06 MAIN 01/12/2006 13:06:29 PAGE 10
546 5 day_count = day_count + 31+ 28 + 31+ 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + gps_point.OS_UTC.times.
-date;
547 5
548 5 break;
549 5 }
550 4 ReportTime_buf[4] = day_count%7;
551 4 if(ReportTime_buf[4]==0) ReportTime_buf[4] = 7;
552 4
553 4 Int0Send_flag = 1;
554 4
555 4 if(gps_point.OS_UTC.times.hour>18&&gps_point.star_number>3)
556 4 {
557 5 if(TimeCorrect_flag)
558 5 {
559 6 TimeCorrect_flag = 0;
560 6 Int0Send_flag = 1;
561 6 IE0 = 1;
562 6 }
563 5 }
564 4 if(gps_point.OS_UTC.times.hour<18)
565 4 {
566 5 TimeCorrect_flag = 1;
567 5 }
568 4
569 4
570 4 if(gps_point.orientation == 0x01)
571 4 {
572 5 LED1=!LED1; //flash here
573 5 Process_GPS();
574 5 }
575 4 } //2
576 3 } //3
577 2 _nop_();
578 2 switch(gps_point.star_number)
579 2 {
580 3 case 0x00:
581 3 LED2 = 1;LED3 = 1;LED4 = 1;LED5 = 1;LED6 = 1;LED7 = 1;
582 3 break;
583 3 case 0x01:
584 3 LED2 = 0;LED3 = 1;LED4 = 1;LED5 = 1;LED6 = 1;LED7 = 1;
585 3 break;
586 3 case 0x02:
587 3 LED2 = 0;LED3 = 0;LED4 = 1;LED5 = 1;LED6 = 1;LED7 = 1;
588 3 break;
589 3 case 0x03:
590 3 LED2 = 0;LED3 = 0;LED4 = 0;LED5 = 1;LED6 = 1;LED7 = 1;
591 3 break;
592 3 case 0x04:
593 3 LED2 = 0;LED3 = 0;LED4 = 0;LED5 = 0;LED6 = 1;LED7 = 1;
594 3 break;
595 3 case 0x05:
596 3 LED2 = 0;LED3 = 0;LED4 = 0;LED5 = 0;LED6 = 0;LED7 = 1;
597 3 break;
598 3 case 0x06:
599 3 LED2 = 0;LED3 = 0;LED4 = 0;LED5 = 0;LED6 = 0;LED7 = 0;
600 3 break;
601 3 }
602 2 /*
603 2 if(gps_point.star_number>0) {LED2 = 0;LED3 = 1;LED4 = 1;LED5 = 1;LED6 = 1;LED7 = 1;}
604 2 if(gps_point.star_number>1) {LED2 = 0;LED3 = 0;LED4 = 1;LED5 = 1;LED6 = 1;LED7 = 1;}
605 2 if(gps_point.star_number>2) {LED2 = 0;LED3 = 0;LED4 = 0;LED5 = 1;LED6 = 1;LED7 = 1;}
606 2 if(gps_point.star_number>3) {LED2 = 0;LED3 = 0;LED4 = 0;LED5 = 0;LED6 = 1;LED7 = 1;}
C51 COMPILER V7.06 MAIN 01/12/2006 13:06:29 PAGE 11
607 2 if(gps_point.star_number>4) {LED2 = 0;LED3 = 0;LED4 = 0;LED5 = 0;LED6 = 0;LED7 = 1;}
608 2 if(gps_point.star_number>5) {LED2 = 0;LED3 = 0;LED4 = 0;LED5 = 0;LED6 = 0;LED7 = 0;}
609 2 */
610 2 // gps_point.star_number = 0;
611 2 } //4
612 1 }
613
614
615 /*********************************************************************************/
616 /*************************** ************************************/
617 /*************************** funcitons body ************************************/
618 /*************************** ************************************/
619 /*********************************************************************************/
620 void MCU_init(void)
621 {
622 1 main_count = 0;
623 1 gps_en=1;
624 1 GPS_received_data_OK=0;
625 1
626 1 TCON = TCON|0x01;
627 1
628 1 TimeCorrect_flag = 1;
629 1 Int0Send_flag = 0;
630 1 }
631
632 void delay(uchar m)
633 {
634 1 uchar idata i,j,k;
635 1 for (i=0;i<=m;i++)
636 1 {
637 2 for (j=0;j<=m;j++)
638 2 {
639 3 for(k=0;k<=m;k++)
640 3 {
641 4 _nop_();
642 4 }
643 3 }
644 2 }
645 1 }
646
647 void delay20()
648 {
649 1 _nop_();
650 1 _nop_();
651 1 _nop_();
652 1 _nop_();
653 1 _nop_();
654 1 _nop_();
655 1 _nop_();
656 1 _nop_();
657 1 _nop_();
658 1 _nop_();
659 1 _nop_();
660 1 _nop_();
661 1 _nop_();
662 1 _nop_();
663 1 _nop_();
664 1 _nop_();
665 1 _nop_();
666 1 _nop_();
667 1 _nop_();
668 1 _nop_();
C51 COMPILER V7.06 MAIN 01/12/2006 13:06:29 PAGE 12
669 1 _nop_();
670 1 _nop_();
671 1 _nop_();
672 1 _nop_();
673 1 _nop_();
674 1 _nop_();
675 1 _nop_();
676 1 _nop_();
677 1 _nop_();
678 1 _nop_();
679 1 _nop_();
680 1 _nop_();
681 1 _nop_();
682 1 }
683
684 void serial1(void) interrupt 20 using 1
685 {
686 1 if((SCON1&0x01)==1)
687 1 {
688 2 SCON1 = SCON1&0xFE;
689 2 if(gps_en)
690 2 {
691 3 r_buf[r_in ++] = SBUF1;
692 3 if(r_buf[r_in - 1]=='$')
693 3 {
694 4 r_in=1;
695 4 r_buf[0]='$';
696 4 }
697 3 if(r_buf[r_in - 1]==0x0a)
698 3 {
699 4 if(r_in>50) {GPS_received_data_OK = 1;GPS_received_data_OK1 = 1;}
700 4 r_in = 0;
701 4 }
702 3 }
703 2 }
704 1 else if((SCON1&0x02)==1)
705 1 {
706 2 SCON1 = SCON1&0xFD;
707 2 }
708 1 }
709
710 void serial0(void) interrupt 4 using 2
711 {
712 1 uchar idata com_receive_temp;
713 1
714 1
715 1 if((SCON0 & 0x01) == 0x01) //RI1=0;
716 1 {
717 2 SCON0 &= ~0x01;
718 2 }
719 1 if(((SCON0 & 0x02) == 0x02)&&buff_flag) //TI1=0;
720 1 {
721 2 SCON0 &= ~0x02;
722 2 }
723 1 }
*** WARNING C280 IN LINE 712 OF MAIN.C: 'com_receive_temp': unreferenced local variable
724
725 void int0() interrupt 0 using 3
726 {
727 1 uchar idata i, InfoLength = 5, temp;
728 1 IE0 = 0;
729 1 if(Int0Send_flag)
C51 COMPILER V7.06 MAIN 01/12/2006 13:06:29 PAGE 13
730 1 {
731 2 Int0Send_flag = 0;
732 2 for(i=0;i<7;i++)
733 2 {
734 3 ReportTimetoMach[InfoLength] = ReportTime_buf[i+1];
735 3 if(ReportTime_buf[i+1]==0xAA)
736 3 {
737 4 InfoLength++;
738 4 ReportTimetoMach[InfoLength] = 0xAA;
739 4 }
740 3 InfoLength++;
741 3 }
742 2 ReportTimetoMach[InfoLength] = 0xAA;
743 2 InfoLength++;
744 2 ReportTimetoMach[InfoLength] = 0xCC;
745 2 InfoLength++;
746 2 temp = 0xAA;
747 2 for(i=1;i<InfoLength;i++)
748 2 {
749 3 temp ^= ReportTimetoMach[i];
750 3 }
751 2 ReportTimetoMach[InfoLength] = temp;
752 2 InfoLength++;
753 2 for(i=0;i<InfoLength;i++)
754 2 {
755 3 ES0 = 0;
756 3 TI0 = 0;
757 3 SBUF0 = ReportTimetoMach[i];
758 3 while(TI0==0);
759 3 TI0 = 0;
760 3 ES0 = 1;
761 3 }
762 2 }
763 1
764 1
765 1 }
766
767 timer3() interrupt 14 using 0
768 {
769 1 TMR3CN &=~0x84; //TF3=0 TR3=0;
770 1
771 1 main_count++;
772 1
773 1 TMR3CN |=0x04;;;//TR3 = 1
774 1 }
775
776 /******************************************************************************/
777 /* send data service function */
778 /* executes each 1s @ 11.0592 MHz Crystal Clock */
779 /******************************************************************************/
780 // 放入一个字节到发送缓冲区
781 void putbyte(uchar ch)
782 {
783 1 // ES0=0; /*暂停串行中断,以免数据比较时出错
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -