📄 almset1.lst
字号:
686 1 press_phone_key(number[2],300,m);
687 1 if(phone_id==PHONE_1)
688 1 {get_dtmf_instruction();
689 2 }
690 1 if(flag_by_mb_or_set==BY_MB)
691 1 {hangup_mbphone;
692 2 clear_mbphone_screen;
693 2 }
694 1 else
695 1 {hangup_setphone;
696 2 }
697 1 delay_milliseconds(2000);
698 1 flag_reporting_alarm = FALSE;
699 1 }
700
701 static void get_dtmf_instruction()
702 {uint i;
703 1 uchar j,inst1,inst2;
704 1 bit ff;
705 1 inst1 = inst2 = 0x55;
706 1 for(j=0;j<100;j++)
707 1 {for(i=0;i<2750;i++) //2750:10 S; 22000:80 S; test:18000
708 2 {inst2 = receive_dtmf_byte();
709 3 if(inst2!=0x55)
710 3 {if((inst1==DTMF_CODE_NUM)||(inst1==DTMF_CODE_STAR))
711 4 {ff = FALSE;
712 5 if(inst1==DTMF_CODE_NUM)
713 5 {ff = TRUE;
714 6 }
715 5 if(inst2==DTMF_CODE_1) //set/cancal alarm
716 5 {flag_section_1_set_alarm = ff;
717 6 flag_section_2_set_alarm = ff;
718 6 flag_section_3_set_alarm = ff;
719 6 flag_section_4_set_alarm = ff;
720 6 flag_section_5_set_alarm = ff;
721 6 flag_section_6_set_alarm = ff;
722 6 flag_section_7_set_alarm = ff;
723 6 flag_section_8_set_alarm = ff;
724 6 flag_store_rc_inst = TRUE;
725 6 // flag_enable_report_to_user = FALSE;
726 6 }else
727 5 if(inst2==DTMF_CODE_2) //enable/disable bell
728 5 {flag_enable_bell = ff;
729 6 }else
730 5 if(inst2==DTMF_CODE_3)
731 5 {flag_enable_report_to_user = ff;
732 6 }
733 5 if((inst2==DTMF_CODE_1)||(inst2==DTMF_CODE_2)||(inst2==DTMF_CODE_3))
734 5 {press_phone_key(KEY_STAR,300,500);
735 6 if(inst1==DTMF_CODE_STAR)
C51 COMPILER V7.00 ALMSET1 09/25/2002 15:25:41 PAGE 13
736 6 {press_phone_key(KEY_7,300,500);
737 7 }
738 6 else
739 6 {press_phone_key(KEY_9,300,500);
740 7 }
741 6 press_phone_key(inst2,300,500);
742 6 if(j>=10)
743 6 {j -= 10;
744 7 }
745 6 }
746 5 }
747 4 inst1 = inst2;
748 4 inst2 = 0x55;
749 4 delay_milliseconds(200);
750 4 seconds_wdt = 15;
751 4 }
752 3 }
753 2 }
754 1 }
755
756 static void char_to_bcd(uchar m)
757 {uchar k;
758 1 uchar data * pt;
759 1 pt = number;
760 1 number[0] = number[1] = number[2] = 0;
761 1 while(m>=100)
762 1 {number[0] ++;
763 2 m -= 100;
764 2 }
765 1 while(m>=10)
766 1 {number[1] ++;
767 2 m -= 10;
768 2 }
769 1 number[2] = m;
770 1 }
*** WARNING C280 IN LINE 757 OF ..\ALARM\ALMSET1.C: 'k': unreferenced local variable
771
772 // interrupt period of T0 : 10 miliseconds
773 void timer0_int() interrupt 1 //using 1
774 {TR0=HIGH;
775 1 EA = TRUE;
776 1 ET0 = TRUE;
777 1 ES = FALSE;
778 1 ET1 = FALSE;
779 1 EX1 = FALSE;
780 1 EX0 = FALSE;
781 1 TL0 =TIMER0_CONST & 0x00ff;
782 1 TH0 =TIMER0_CONST >>8;
783 1 count_milliseconds --;
784 1 if(!count_milliseconds)
785 1 {count_milliseconds = 1000/TIME_TIMER0; //1 S
786 2 flag_seconds_count_overflow = TRUE;
787 2 if(seconds_down)
788 2 {seconds_down --;
789 3 }
790 2 //seconds_wdt=10;
791 2 if(!seconds_wdt) //watching the main program
792 2 {ljmp_0();
793 3 }
794 2 seconds_wdt --;
795 2 }
796 1 ////////////////////////
C51 COMPILER V7.00 ALMSET1 09/25/2002 15:25:41 PAGE 14
797 1 if(bit_dtmf_dv)
798 1 {flag_mbphone_power_on = 1;
799 2 }
800 1 if(!bit_buzzer)
801 1 {flag_mbphone_ring = TRUE;
802 2 // flag_mbphone_power_on = TRUE;
803 2 }
804 1 ///////////////////
805 1 if(flag_enable_bell&&flag_risk_occur)
806 1 {turn_on_bell;
807 2 count_sound = 0;
808 2 count_bell = 0;
809 2 }
810 1 else
811 1 {if(count_sound)
812 2 {if(count_bell)
813 3 {count_bell --;
814 4 }
815 3 else
816 3 {bit_bell = ~ bit_bell;
817 4 if(bit_bell)
818 4 {count_sound --;
819 5 count_bell = 300/TIME_TIMER0;
820 5 }
821 4 else
822 4 {count_bell = 100/TIME_TIMER0;
823 5 }
824 4 }
825 3 }
826 2 else
827 2 {turn_off_bell;
828 3 }
829 2 }
830 1 //////////
831 1 if(!flag_permit_int_t0)
832 1 {return;
833 2 }
834 1 ////////////
835 1 /////////////////////
836 1 if(bit_rc_count)
837 1 {if(rc_count_count<2550/TIME_TIMER0)
838 2 {rc_count_count ++;
839 3 }
840 2 }
841 1 else
842 1 {if(rc_count_count>=2500/TIME_TIMER0)
843 2 {//if(flag_risk_occur)
844 3 {flag_enable_bell = TRUE;
845 4 count_bell = 100/TIME_TIMER0;
846 4 count_sound = 4;
847 4 section_number = 0;
848 4 }
849 3 }else
850 2 if(rc_count_count>=20/TIME_TIMER0)
851 2 {section_number ++;
852 3 count_bell = 100/TIME_TIMER0;
853 3 count_sound = 1;
854 3 }
855 2 rc_count_count = 0;
856 2 }
857 1 /////////////////////
858 1 if(bit_rc_lock)
C51 COMPILER V7.00 ALMSET1 09/25/2002 15:25:41 PAGE 15
859 1 {if(rc_lock_count<2550/TIME_TIMER0)
860 2 {rc_lock_count ++;
861 3 }
862 2 }
863 1 else
864 1 {if(rc_lock_count>=2500/TIME_TIMER0)
865 2 {flag_urgent_alarm_occur = TRUE;
866 3 flag_store_rc_inst = TRUE;
867 3 section_number = 0;
868 3 flag_section_1_set_alarm = TRUE;
869 3 flag_section_2_set_alarm = TRUE;
870 3 flag_section_3_set_alarm = TRUE;
871 3 flag_section_4_set_alarm = TRUE;
872 3 flag_section_5_set_alarm = TRUE;
873 3 flag_section_6_set_alarm = TRUE;
874 3 flag_section_7_set_alarm = TRUE;
875 3 flag_section_8_set_alarm = TRUE;
876 3 turn_on_bell;
877 3 count_bell = 50/TIME_TIMER0;
878 3 count_sound = 1;
879 3 flag_enable_report_to_user = TRUE;
880 3 }
881 2 else
882 2 {if(rc_lock_count>=20/TIME_TIMER0)
883 3 {flag_store_rc_inst = TRUE;
884 4 stage_led_flash = 0;
885 4 count_led_pulse= 0;
886 4 count_red_led_flash = 1000/TIME_TIMER0;
887 4 turn_off_red_led;
888 4 if(section_number==0)
889 4 {flag_section_1_set_alarm = TRUE;
890 5 flag_section_2_set_alarm = TRUE;
891 5 flag_section_3_set_alarm = TRUE;
892 5 flag_section_4_set_alarm = TRUE;
893 5 flag_section_5_set_alarm = TRUE;
894 5 flag_section_6_set_alarm = TRUE;
895 5 flag_section_7_set_alarm = TRUE;
896 5 flag_section_8_set_alarm = TRUE;
897 5 turn_on_bell;
898 5 count_bell = 100/TIME_TIMER0;
899 5 count_sound = 2;
900 5 flag_enable_report_to_user = TRUE;
901 5 }else
902 4 if(section_number==1)
903 4 {flag_section_1_set_alarm = TRUE;
904 5 turn_on_bell;
905 5 count_bell = 100/TIME_TIMER0;
906 5 count_sound = 1;
907 5 flag_enable_report_to_user = TRUE;
908 5 }else
909 4 if(section_number==2)
910 4 {flag_section_2_set_alarm = TRUE;
911 5 turn_on_bell;
912 5 count_bell = 100/TIME_TIMER0;
913 5 count_sound = 1;
914 5 flag_enable_report_to_user = TRUE;
915 5 }else
916 4 if(section_number==3)
917 4 {flag_section_3_set_alarm = TRUE;
918 5 turn_on_bell;
919 5 count_bell = 100/TIME_TIMER0;
920 5 count_sound = 1;
C51 COMPILER V7.00 ALMSET1 09/25/2002 15:25:41 PAGE 16
921 5 flag_enable_report_to_user = TRUE;
922 5 }else
923 4 if(section_number==4)
924 4 {flag_section_4_set_alarm = TRUE;
925 5 turn_on_bell;
926 5 count_bell = 100/TIME_TIMER0;
927 5 count_sound = 1;
928 5 flag_enable_report_to_user = TRUE;
929 5 }else
930 4 if(section_number==5)
931 4 {flag_section_5_set_alarm = TRUE;
932 5 turn_on_bell;
933 5 count_bell = 100/TIME_TIMER0;
934 5 count_sound = 1;
935 5 flag_enable_report_to_user = TRUE;
936 5 }else
937 4 if(section_number==6)
938 4 {flag_section_6_set_alarm = TRUE;
939 5 turn_on_bell;
940 5 count_bell = 100/TIME_TIMER0;
941 5 count_sound = 1;
942 5 flag_enable_report_to_user = TRUE;
943 5 }else
944 4 if(section_number==7)
945 4 {flag_section_7_set_alarm = TRUE;
946 5 turn_on_bell;
947 5 count_bell = 100/TIME_TIMER0;
948 5 count_sound = 1;
949 5 flag_enable_report_to_user = TRUE;
950 5 }else
951 4 {flag_section_8_set_alarm = TRUE;
952 5 turn_on_bell;
953 5 count_bell = 100/TIME_TIMER0;
954 5 count_sound = 1;
955 5 flag_enable_report_to_user = TRUE;
956 5 }
957 4 section_number = 0;
958 4 }
959 3 }
960 2 rc_lock_count = 0;
961 2 }
962 1 //////////////////
963 1 if(bit_rc_open)
964 1 {if(rc_open_count<2550/TIME_TIMER0)
965 2 {rc_open_count ++;
966 3 }
967 2 }
968 1 else
969 1 {if(rc_open_count>=2500/TIME_TIMER0)
970 2 {flag_urgent_alarm_occur = FALSE;
971 3 flag_section_1_set_alarm = FALSE;
972 3 flag_section_2_set_alarm = FALSE;
973 3 flag_section_3_set_alarm = FALSE;
974 3 flag_section_4_set_alarm = FALSE;
975 3 flag_section_5_set_alarm = FALSE;
976 3 flag_section_6_set_alarm = FALSE;
977 3 flag_section_7_set_alarm = FALSE;
978 3 flag_section_8_set_alarm = FALSE;
979 3 flag_enable_bell = FALSE;
980 3 flag_store_rc_inst = TRUE;
981 3 // flag_enable_report_to_user = FALSE;
982 3 count_bell = 100/TIME_TIMER0;
C51 COMPILER V7.00 ALMSET1 09/25/2002 15:25:41 PAGE 17
983 3 count_sound = 2;
984 3 section_number = 0;
985 3 }else
986 2 if(!flag_urgent_alarm_occur)
987 2 {if(rc_open_count>=20/TIME_TIMER0)
988 3 {flag_store_rc_inst = TRUE;
989 4 // flag_enable_report_to_user = FALSE;
990 4 stage_led_flash = 0;
991 4 count_led_pulse= 0;
992 4 count_red_led_flash = 1000/TIME_TIMER0;
993 4 turn_off_red_led;
994 4 if(section_number==0)
995 4 {flag_section_1_set_alarm = FALSE;
996 5 flag_section_2_set_alarm = FALSE;
997 5 flag_section_3_set_alarm = FALSE;
998 5 flag_section_4_set_alarm = FALSE;
999 5 flag_section_5_set_alarm = FALSE;
1000 5 flag_section_6_set_alarm = FALSE;
1001 5 flag_section_7_set_alarm = FALSE;
1002 5 flag_section_8_set_alarm = FALSE;
1003 5 flag_enable_bell = FALSE;
1004 5 // flag_enable_report_to_user = FALSE;
1005 5 count_bell = 100/TIME_TIMER0;
1006 5 count_sound = 2;
1007 5 }else
1008 4 if(section_number==1)
1009 4 {flag_section_1_set_alarm = FALSE;
1010 5 count_bell = 100/TIME_TIMER0;
1011 5 count_sound = 1;
1012 5 }else
1013 4 if(section_number==2)
1014 4 {flag_section_2_set_alarm = FALSE;
1015 5 count_bell = 100/TIME_TIMER0;
1016 5 count_sound = 1;
1017 5 }else
1018 4 if(section_number==3)
1019 4 {flag_section_3_set_alarm = FALSE;
1020 5 count_bell = 100/TIME_TIMER0;
1021 5 count_sound = 1;
1022 5 }else
1023 4 if(section_number==4)
1024 4 {flag_section_4_set_alarm = FALSE;
1025 5 count_bell = 100/TIME_TIMER0;
1026 5 count_sound = 1;
1027 5 }else
1028 4 if(section_number==5)
1029 4 {flag_section_5_set_alarm = FALSE;
1030 5 count_bell = 100/TIME_TIMER0;
1031 5 count_sound = 1;
1032 5 }else
1033 4 if(section_number==6)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -