📄 ia500.lst
字号:
716 1 cmd_end();
717 1 while(!init);
718 1
719 1 }
720 //============================================
721 void diag_test(uchar temp)
722 {
723 1 temp += 0x30;
724 1 idle();
725 1 cmd_start();
726 1 serial_out(size,strlen(size));
727 1 s_out(temp);
728 1 cmd_end();
729 1 while(!init);
730 1 }
731
732 //=======================================================
733 void send_time()
734 {
735 1 uchar i;
736 1 idle();
737 1 cmd_start();
C51 COMPILER V6.02 IA500 07/18/2005 11:04:42 PAGE 13
738 1 serial_out(clock,strlen(clock));
739 1 for (i = 0; i < 16;i++)
740 1 {
741 2 s_out('x');
742 2 }
743 1 cmd_end();
744 1 while (!init);
745 1
746 1 }
747 //===========================================================
748 void init_ia500()//18,init
749 {
750 1 send_act();
751 1 rgled(1);
752 1
753 1 send_mbaddr();
754 1 rgled(1);
755 1 send_mbun();
756 1 rgled(1);
757 1 send_mbpd();
758 1 rgled(1);
759 1 send_smtp();
760 1 rgled(1);
761 1 send_sport();
762 1 rgled(1);
763 1 send_receive_mail();
764 1 rgled(1);
765 1
766 1 send_ispun();
767 1 rgled(1);
768 1 send_ispno();
769 1 rgled(1);
770 1 send_isppd();
771 1 rgled(1);
772 1
773 1 send_remote_pd();
774 1 rgled(1);
775 1 send_remote_ring();
776 1 rgled(1);
777 1
778 1 send_idnum();
779 1 rgled(1);
780 1 send_unit();
781 1 rgled(1);
782 1 send_cudef();
783 1 rgled(1);
784 1 send_atname();
785 1 rgled(1);
786 1 send_speak();
787 1 rgled(1);
788 1 image_size(1);
789 1 rgled(5);
790 1 nop
791 1
792 1 }
793 //===================================================================
794 /*
795 void time_mode()
796 {
797 uchar xdata *temp;
798 uchar i;
799 temp = 0x0b;
C51 COMPILER V6.02 IA500 07/18/2005 11:04:42 PAGE 14
800 *temp = 0xaa;
801 temp ++;
802 i = *temp;
803 *temp = 0x00;
804 temp --;
805 *temp = 0x2a;
806 }
807 */
808
809 //功能:延时1秒
810 //输入:时间长度
811 void delay_s ( uint time )
812 {
813 1 int idata i,j,k;
814 1
815 1 if ( time == 0x00 )
816 1 return;
817 1
818 1 for ( i = 0; i < time; i ++ )
819 1 for (j = 0; j < 100; j ++ )
820 1 for ( k = 0; k < 100; k ++ );
821 1 }
822
823 /*********************************************/
824 //串行接受:返回0-正确,1-错误
825 /*********************************************/
826 /*
827 bit serial_in(uchar *pbuf)
828 {
829 uchar temp;
830 while(!s_in(&temp))
831 {
832 s_in(&temp);
833 *pbuf = temp;
834 pbuf ++;
835 }
836 return(1);
837 }
838 */
839 /*********************************************/
840 //串行发送
841 /*********************************************/
842 void s_out(uchar ndata)
843 {
844 1 TI = 0;
845 1 tcount = 0;
846 1 timeout = 0;
847 1 TR0 = 1;
848 1 SBUF = ndata;
849 1 while(TI == 0){
850 2 if (timeout)
851 2 { init = 1; break;}
852 2 }
853 1 TI = 0;
854 1 TR0 = 0;
855 1 }
856 //put character via 8051 serial port
857 void serial_out(char *outdata,int len)
858 {
859 1 int i;
860 1 for (i=0;i<len;i++)
861 1 {
C51 COMPILER V6.02 IA500 07/18/2005 11:04:42 PAGE 15
862 2 // putchar(*outdata);
863 2 s_out(*outdata);
864 2 outdata++;
865 2 }
866 1 }
867 /*********************************************/
868 //串行发送
869 /*********************************************/
870 //void serial_out(uchar data *pbuf, uchar nlen)
871 /*
872 void serial_out(uchar *pbuf)
873 {
874 while(1)
875 {
876 if( *pbuf == '$')
877 break;
878 s_out(*pbuf);
879 pbuf ++;
880 }
881 }
882 */
883 //===================================================================
884 //功能:串行口中断
885
886 void sio_ir( ) interrupt 4
887 {
888 1 uchar char_temp;
889 1
890 1 char_temp = SBUF;
891 1 if (char_temp >= 0x30)
892 1 {
893 2 init = 1;
894 2 ia500 = char_temp;
895 2 }
896 1 RI = 0;
897 1 }
898
899 //===================================================================
900 //触发中断,外部中断1
901 void int_ex0() interrupt 0
902 {
903 1 mode = check_config();//work mode ]
904 1 if (mode&0x06 == 0x00)
905 1 manypicture = 1;
906 1 if (mode&0x06 == 0x02)
907 1 manypicture = 2;
908 1 if (mode&0x06 == 0x06)
909 1 manypicture = 3;
910 1 if (mode&0x08 == 0x00)
911 1 {
912 2 ia500 = 0x40;//snap immedeltely
913 2 tdelay = 0;
914 2 }
915 1 if (mode&0x08 == 0x08)
916 1 ia500 = 0x41;//course
917 1 if (mode&0x06 == 0x04)
918 1 ;
919 1 EX0 = OFF;
920 1 }
921
922 //===========================================================================
923 //外部中断0,遥控接收
C51 COMPILER V6.02 IA500 07/18/2005 11:04:42 PAGE 16
924 void Int_Ex1(void) interrupt 2
925 {
926 1 bit Key_Flag;
927 1 bit Key_Low_Highbit1;
928 1 bit Key_Low_Highbit2;
929 1 bit Key_Low_Highbit3;
930 1 if(Key_Exit) //按键结束返回
931 1 {
932 2 return;
933 2 }
934 1 TR0 = 0;
935 1 if(Key_Finish) //键码接收完成,重新启动计数器
936 1 {
937 2 TH0 = 0x00;
938 2 TL0 = 0x00;
939 2 ET0 = 1;
940 2 TR0 = 1;
941 2 return;
942 2 }
943 1 if(TH0 == 0x00 && TL0 == 0x00) //首次进入
944 1 {
945 2 TR0 = 1;
946 2 return;
947 2 }
948 1
949 1 Key_Temp = TH0;
950 1 TH0 = 0x00;
951 1 TL0 = 0x00;
952 1 TR0 = 1;
953 1 if(!Key_Key) //还未读取间隔码
954 1 {
955 2 if(Key_Temp > 20) //判断是否为间隔码
956 2 {
957 3 Key_Key = 1; //间隔码读取完成
958 3 return;
959 3 }
960 2 else
961 2 {
962 3 return;
963 3 }
964 2 }
965 1
966 1 if(Key_Temp > 20) //已读取间隔码续读取码值
967 1 {
968 2
969 2 if ((Key_Use_High == 0x02)&(Key_Use_Low == 0xfd))
970 2 {
971 3 Key_Store = Key_High;
972 3 // Key_Store = Key_Low;
973 3 Key_Low = 0;
974 3 Key_High = 0;
975 3 Key_Use_Low = 0;
976 3 Key_Use_High = 0;
977 3 TH0 = 0;
978 3 TL0 = 0;
979 3 TR0 = 0;
980 3 Key_Finish = 1;
981 3 Key_Exit = 1;
982 3 Key_Key = 1;
983 3 ird = 1;
984 3 EX1 = 0;
985 3 //===================================
C51 COMPILER V6.02 IA500 07/18/2005 11:04:42 PAGE 17
986 3 if(Key_Store == 0x48)
987 3 stopall = 1;
988 3 //===================================
989 3 return;
990 3 }
991 2 else
992 2 {
993 3 Key_Key = 0;
994 3 return;
995 3 }
996 2
997 2 }
998 1 else //键值码
999 1 {
1000 2 if(Key_Temp > 12) //22.1184M
1001 2 // if(Key_Temp > 5) //11.0592
1002 2
1003 2 {
1004 3 Key_Flag = 1;
1005 3 }
1006 2 else
1007 2 {
1008 3 Key_Flag = 0;
1009 3 }
1010 2 Key_Low_Highbit1 = Key_Low & 0x80;
1011 2 Key_Low <<= 1;
1012 2 if(Key_Flag)
1013 2 {
1014 3 Key_Low += 0x01;
1015 3 }
1016 2 Key_Low_Highbit2 = Key_High & 0x80;
1017 2 Key_High <<= 1;
1018 2 if(Key_Low_Highbit1)
1019 2 {
1020 3 Key_High += 0x01;
1021 3 }
1022 2 //==================================================
1023 2 Key_Low_Highbit3 = Key_Use_Low & 0x80;
1024 2 Key_Use_Low <<= 1;
1025 2 if(Key_Low_Highbit2)
1026 2 {
1027 3 Key_Use_Low += 0x01;
1028 3 }
1029 2 Key_Use_High <<= 1;
1030 2 if(Key_Low_Highbit3)
1031 2 {
1032 3 Key_Use_High += 0x01;
1033 3 }
1034 2
1035 2 return;
1036 2 }
1037 1 }
1038
1039 //==================================================================
1040
1041 void timer0() interrupt 1
1042 {
1043 1 TH0 = 0;
1044 1 TL0 = 0;
1045 1 TR0 = 0;
1046 1 tcount ++;
1047 1 if (tcount >= 20)
C51 COMPILER V6.02 IA500 07/18/2005 11:04:42 PAGE 18
1048 1 {
1049 2 tcount = 0;
1050 2 // timeout = 1;
1051 2 // tdelay ++;
1052 2 }
1053 1 else
1054 1 timeout = 0;
1055 1
1056 1 }
1057
1058
1059
1060
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 3638 ----
CONSTANT SIZE = 286 ----
XDATA SIZE = 36 ----
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = 12 ----
BIT SIZE = 11 ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -