📄 mcu.lst
字号:
590 5 line2l();
591 5 break;
592 5 }
593 4 case 6:{
594 5 line3l();
595 5 break;
596 5 }
597 4
598 4 }
599 3
600 3
601 3
602 3 for(j=1;j<4;j++)
603 3 {
604 4 if((Row1()==0))
605 4 {
606 5 k=i;
607 5 i=8;
608 5 h=1;
609 5 j=5;
610 5
611 5 }
C51 COMPILER V7.06 MCU 12/11/2007 11:28:42 PAGE 11
612 4 else if(Row2()==0)
613 4 {
614 5 k=i;
615 5 i=8;
616 5 h=2;
617 5 j=6;
618 5
619 5 }
620 4 else if(Row3()==0)
621 4 {
622 5 k=i;
623 5 i=9;
624 5 h=3;
625 5 j=7;
626 5 // LED_GrnOff();
627 5 }
628 4
629 4 // LED_RedOff();
630 4 // break;
631 4 while((Row1()==0)||(Row2()==0)||(Row3()==0))
632 4 {
633 5 CLRWDT = 0x55;
634 5
635 5
636 5 }
637 4 j = 5;
638 4
639 4 }
640 3 }
641 2 switch(k)
642 2 {
643 3 case 4:{
644 4 m=1;
645 4 break;
646 4 }
647 3 case 5:{
648 4 m=2;
649 4 break;
650 4 }
651 3 case 6:{
652 4 m=3;
653 4 break;
654 4 }
655 3
656 3 default:{
657 4 m=0;
658 4 h=0;
659 4 }
660 3
661 3 }
662 2 }
663 1
664 1 line1h();
665 1 line2h();
666 1 line3h();
667 1 //line4h();
668 1
669 1 if(m==0)
670 1 {
671 2 return 0;
672 2 }
673 1 else
C51 COMPILER V7.06 MCU 12/11/2007 11:28:42 PAGE 12
674 1 {
675 2 return (h*10+m);
676 2 }
677 1
678 1 }
679
680 void line1l()
681 {
682 1 Byte Port;
683 1 Port = PTD_REG;
684 1 Port |= RDPD_REG;
685 1 Port &= ~PD3;
686 1 PTD_REG = Port;
687 1 }
688 void line2l()
689 {
690 1 Byte Port;
691 1 Port = PTD_REG;
692 1 Port |= RDPD_REG;
693 1 Port &= ~PD4;
694 1 PTD_REG = Port;
695 1 }
696 void line3l()
697 {
698 1 Byte Port;
699 1 Port = PTD_REG;
700 1 Port |= RDPD_REG;
701 1 Port &= ~PD5;
702 1 PTD_REG = Port;
703 1 }
704 /*void line4l()
705 {
706 Byte Port;
707 Port = PTD_REG;
708 Port |= RDPD_REG;
709 Port &= ~PD6;
710 PTD_REG = Port;
711 }*/
712 void line1h()
713 {
714 1 Byte Port;
715 1 Port = PTD_REG;
716 1 Port |= RDPD_REG;
717 1 Port |= PD3;
718 1 PTD_REG = Port;
719 1 }
720 void line2h()
721 {
722 1 Byte Port;
723 1 Port = PTD_REG;
724 1 Port |= RDPD_REG;
725 1 Port |= PD4;
726 1 PTD_REG = Port;
727 1 }
728 void line3h()
729 {
730 1 Byte Port;
731 1 Port = PTD_REG;
732 1 Port |= RDPD_REG;
733 1 Port |= PD5;
734 1 PTD_REG = Port;
735 1 }
C51 COMPILER V7.06 MCU 12/11/2007 11:28:42 PAGE 13
736 void line4h()
737 {
738 1 Byte Port;
739 1 Port = PTD_REG;
740 1 Port |= RDPD_REG;
741 1 Port |= PD6;
742 1 PTD_REG = Port;
743 1 }
744 bit Row1()
745 {
746 1 bit m;
747 1 Byte Port;
748 1 RDPD_REG |=PD0;
749 1 Port = PTD_REG;
750 1 if((Port & PD0)!=0)
751 1 {
752 2 m=1;
753 2 }
754 1 else
755 1 {
756 2 m=0;
757 2 }
758 1 return m;
759 1 }
760
761 bit Row2()
762 {
763 1 bit m;
764 1 Byte Port;
765 1 RDPD_REG |=PD1;
766 1 Port = PTD_REG;
767 1 if((Port & PD1)!=0)
768 1 {
769 2 m=1;
770 2 }
771 1 else
772 1 {
773 2 m=0;
774 2 }
775 1 return m;
776 1 }
777 bit Row3()
778 {
779 1 bit m;
780 1 Byte Port;
781 1 RDPD_REG |=PD2;
782 1 Port = PTD_REG;
783 1 if((Port & PD2)!=0)
784 1 {
785 2 m=1;
786 2 }
787 1 else
788 1 {
789 2 m=0;
790 2 }
791 1 return m;
792 1 }
793 //==========================================
794 void Sleep(Word T)
795 {
796 1 Word i,j;
797 1 for(j=0;j<T;j++)
C51 COMPILER V7.06 MCU 12/11/2007 11:28:42 PAGE 14
798 1 for(i=0;i<53*(CPU_CLK/20000000);i++)
799 1 CLRWDT=0x55;
800 1 }
801 /*==========================================
802 ==========================================*/
803 void WaitSetup(unsigned short time)
804 {
805 1 LocalTimer = time; /* timeout n ms */
806 1 while(LocalTimer != 0){
807 2 CheckModeChange();
808 2 }
809 1 }
810 /*==========================================
811 ==========================================*/
812 bit DetectBacklight()
813 {
814 1 //return I_OBackLightStatus;
815 1 return 1;
816 1 }
817 /*==========================================
818 ==========================================*/
819 void PanelPowerOn(void)
820 {
821 1 //I_OXRSTLow;
822 1 I_OLCDSTBLow;
823 1 Sleep(10);
824 1 //I_OXRSTHigh;
825 1 I_OLCDSTBHigh;
826 1 //I_OPanelPowerHigh;
827 1 }
828 /*==========================================
829 ==========================================*/
830 void ResetScaler(void)
831 {
832 1 I_OResetOn;
833 1 Sleep(12);
834 1 I_OResetOff;
835 1 Sleep(50);
836 1 WriteIIC563(0x101, 0x20);
837 1 Sleep(12);
838 1 WriteIIC563(0x101, 0x0f);
839 1 }
840 /*==========================================
841 ==========================================*/
842 bit DetectIRQ()
843 {
844 1 return !(PTB_REG & PB2);
845 1 // return 0;
846 1 }
847 /*==========================================
848 ==========================================*/
849 void IntGroup1(void) interrupt 2 using 1
850 {
851 1 if(INT_SRC & INT_EXT){
852 2 if(INTEXT_FLG & INTE0){
853 3 if(FastMuteEnable){
854 4 I_OBackLightLow;
855 4 if(SyncMode <3){ //add by kevin 92/10/21 if ysnc mode in sep/com/SOG -->COM
856 5 // INTEXT_EN = INTE1; // Disable interrupt INT0 enable INT1
857 5 FLG_Change_SyncMode=1;
858 5 }
859 4 }
C51 COMPILER V7.06 MCU 12/11/2007 11:28:42 PAGE 15
860 3 Abort = 1; //abort autotune
861 3 if(ChangeMode<10)
862 3 ChangeMode++;
863 3 INTEXT_FLG = INTE0;
864 3 }
865 2 /*
866 2 if(INTEXT_FLG & INTE1){
867 2 INTEXT_FLG = INTE1;
868 2 I_OBackLightLow;
869 2 WarmUp(); //reset system
870 2
871 2 }
872 2 */
873 2
874 2 }
875 1 }
876 void LED_GrnOff(void)
877 {
878 1 unsigned char port;
879 1 port = PTC_REG;
880 1 port |= RDPC_REG;
881 1 port |= PC1;
882 1 PTC_REG = port;
883 1 }
884
885 void LED_GrnOn(void)
886 {
887 1 unsigned char port;
888 1 port = PTC_REG;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -