📄 function.lst
字号:
930 Returns :
931 Notes :
932 ------------------------------------------------------------------- */
933 void Switch_Input(unsigned char Inp_Source)
934 {
935 1 // Byte temp;
936 1 #if EEPROM
I2CWriteByte(EEPROM_MCU | ((EE_SOURCE/256)*2), (EE_SOURCE%256), bSource);
#endif
939 1 switch(Inp_Source)
940 1 {
941 2 case 0: // CVBS
942 2 bVideo = 1;
943 2 bVGA = 0;
944 2 bPanel_Change = 1;
945 2 S1 = 0; // switch to CCIR
946 2 S2 = 1;
947 2 I2CWriteByte(SAA7114_ADDR, 0x02, 0xC4);
948 2 I2CWriteByte(SAA7114_ADDR, 0x09, 0x41);
949 2 I2CWriteByte(SAA7114_ADDR, 0x0a, 0x80);//72
950 2 I2CWriteByte(SAA7114_ADDR, 0x0b, 0x50);//44
951 2 I2CWriteByte(SAA7114_ADDR, 0x14, I2CReadByte(SAA7114_ADDR, 0x14)&0xfc|0x02);
952 2 ParaAddress = EE_AV1_PARA;
953 2 Puts_UART("bVideoAV\r\n");
954 2 break;
955 2 case 1: // S Video
956 2 bVideo = 1;
957 2 bVGA = 0;
958 2 bPanel_Change = 1;
959 2 S1 = 0; // switch to CCIR
960 2 S2 = 1;
961 2 I2CWriteByte(SAA7114_ADDR, 0x02, 0xC8);
962 2 I2CWriteByte(SAA7114_ADDR, 0x09, 0xCC);
963 2 I2CWriteByte(SAA7114_ADDR, 0x0a, 0x72);
964 2 I2CWriteByte(SAA7114_ADDR, 0x0b, 0x44);
965 2 I2CWriteByte(SAA7114_ADDR, 0x14, I2CReadByte(SAA7114_ADDR, 0x14)&0xfc|0x01);
966 2 ParaAddress = EE_AV2_PARA;
967 2 Puts_UART("bVideoS\r\n");
968 2 break;
969 2 case 2: // VGA
970 2 bVideo = 0;
971 2 bVGA = 1;
972 2 bPanel_Change = 1;
973 2 S1 = 1; // switch to VGA
C51 COMPILER V7.07 FUNCTION 09/26/2006 08:56:43 PAGE 17
974 2 S2 = 0;
975 2 ParaAddress = EE_AV3_PARA;
976 2 Puts_UART("bVGA\r\n");
977 2 break;
978 2 case 3: // Tuner AI24
979 2 bVideo = 1;
980 2 bVGA = 0;
981 2 bPanel_Change = 1;
982 2 S1 = 0; // switch to CCIR
983 2 S2 = 1;
984 2 I2CWriteByte(SAA7114_ADDR, 0x02, 0xC5);
985 2 I2CWriteByte(SAA7114_ADDR, 0x09, 0x41);
986 2 I2CWriteByte(SAA7114_ADDR, 0x0a, 0x80);//72
987 2 I2CWriteByte(SAA7114_ADDR, 0x0b, 0x50);//44
988 2 I2CWriteByte(SAA7114_ADDR, 0x14, I2CReadByte(SAA7114_ADDR, 0x14)&0xfc|0x02);
989 2 ParaAddress = EE_TV_PARA;
990 2 Puts_UART("bTuner\r\n");
991 2 break;
992 2 default:
993 2 break;
994 2 }
995 1 Signal_Detect();
996 1 }
997 /* -------------------------------------------------------------------
998 Name : Reset_hx8824
999 Purpose :
1000 Passed :
1001 Returns :
1002 Notes :
1003 ------------------------------------------------------------------- */
1004 void Reset_hx8824()
1005 {
1006 1 Byte i;
1007 1 code unsigned reset_hx8824_table[11][2] = {{0x41,0x10},{0x42,0xF0},{0x43,0x00},{0x44,0xF0},
1008 1 {0x45,0x0C},{0x46,0x80},{0x47,0x80},{0x48,0x00},
1009 1 {0x49,0x00},{0x4A,0x80},{0x4B,0x00}};
1010 1 for(i = 0; i < 11; i++)
1011 1 I2CWriteByte(HX8824_ADDR, reset_hx8824_table[i][0], reset_hx8824_table[i][1]);
1012 1 #if EEPROM
I2CWriteByte(EEPROM_MCU | (((ParaAddress + EE_BRIGHTNESS)/256)*2), ParaAddress + EE_BRIGHTNESS, I2CRea
-dByte(HX8824_ADDR, HX8824_BRIGHTNESS));
I2CWriteByte(EEPROM_MCU | (((ParaAddress + EE_CONTRAST)/256)*2), ParaAddress + EE_CONTRAST, I2CReadByt
-e(HX8824_ADDR, HX8824_CONTRAST));
I2CWriteByte(EEPROM_MCU | (((ParaAddress + EE_SHARPNESS)/256)*2), ParaAddress + EE_SHARPNESS, I2CReadB
-yte(HX8824_ADDR, HX8824_SHARPNESS));
I2CWriteByte(EEPROM_MCU | (((ParaAddress + EE_SAT_SIN_HUE)/256)*2), ParaAddress + EE_SAT_SIN_HUE, I2CR
-eadByte(HX8824_ADDR, HX8824_SATSINHUE));
I2CWriteByte(EEPROM_MCU | (((ParaAddress + EE_SAT_SIN_HUE)/256)*2), ParaAddress + EE_SAT_SIN_HUE + 1,
-I2CReadByte(HX8824_ADDR, HX8824_SATSINHUE + 1));
I2CWriteByte(EEPROM_MCU | (((ParaAddress + EE_SAT_COS_HUE)/256)*2), ParaAddress + EE_SAT_COS_HUE, I2CR
-eadByte(HX8824_ADDR, HX8824_SATCOSHUE));
I2CWriteByte(EEPROM_MCU | (((ParaAddress + EE_SAT_COS_HUE)/256)*2), ParaAddress + EE_SAT_COS_HUE + 1,
-I2CReadByte(HX8824_ADDR, HX8824_SATCOSHUE + 1));
#endif
1021 1 }
1022 /* -------------------------------------------------------------------
1023 Name : test
1024 Purpose :
1025 Passed :
1026 Returns :
1027 Notes :
1028 ------------------------------------------------------------------- */
C51 COMPILER V7.07 FUNCTION 09/26/2006 08:56:43 PAGE 18
1029 void test()
1030 {
1031 1 unsigned char* string;
1032 1 //Init_OSD();
1033 1 //Print_String(2, 2, 0x00, 0x07, "ABCDEFGH");
1034 1 //SetFonts(1);
1035 1 //Print_Icon(0x41, 0x00, 0x00, 0x07, 0x00);
1036 1 //I2CWriteByte(HX8824_ADDR, 0x60, 0x20);
1037 1
1038 1 //I2CWriteByte(SAA7111_ADDR, 0x02, 0xC8);
1039 1 string = IntTobyStr(55);
1040 1 //Puts_UART(string);
1041 1 }
1042
1043 /* ================================================================
1044 Name : IntTobyStr
1045 Purpose : Change Integer Number to String
1046 Passed : integer
1047 Notes : string
1048 ================================================================ */
1049
1050 unsigned char* IntTobyStr(Byte c)
1051 {
1052 1 BYTE MAXHOLD = 5;
1053 1 BYTE Hundred = 1, Array = 0, Size = 0;
1054 1 Bool Finished = 0;
1055 1 unsigned char* string;
1056 1 while(Finished == 0)
1057 1 {
1058 2 if(c < 10)
1059 2 {
1060 3 Finished = 1;
1061 3 Size = 1;
1062 3 break;
1063 3 }
1064 2 Hundred *= 10;
1065 2 if(c - Hundred >= 0 && c - 10 * Hundred < 0)
1066 2 {
1067 3 Finished = 1;
1068 3 }
1069 2 Size ++;
1070 2 }
1071 1 if(Size >= MAXHOLD)
1072 1 {
1073 2 return 0;
1074 2 }
1075 1 while(Array <= Size)
1076 1 {
1077 2 if(Hundred == 0)
1078 2 {
1079 3 string[Array] = 0;
1080 3 }
1081 2 else
1082 2 {
1083 3 string[Array] = c / Hundred + 48;
1084 3 c -= c / Hundred * Hundred;
1085 3 Hundred /= 10;
1086 3 }
1087 2 ++Array;
1088 2 }
1089 1 string[Array] = 0;
1090 1 return string;
C51 COMPILER V7.07 FUNCTION 09/26/2006 08:56:43 PAGE 19
1091 1 }
1092
1093 /* ================================================================
1094 Name : Check_EEPROM
1095 Purpose : Check EEPROM DATA
1096 Passed :
1097 Notes :
1098 ================================================================ */
1099 void Check_EEPROM(void)
1100 {
1101 1 //Burning_EEPROM();
1102 1 //---Check wrong eeprom for MCU---//
1103 1 if((I2CReadByte(EEPROM_MCU | (EE_BURN1/256)*2, EE_BURN1%256) != EEPDATA[63][13])||
1104 1 (I2CReadByte(EEPROM_MCU | (EE_BURN2/256)*2, EE_BURN2%256) != EEPDATA[63][14])||
1105 1 (I2CReadByte(EEPROM_MCU | (EE_BURN3/256)*2, EE_BURN3%256) != EEPDATA[63][15]))
1106 1 {
1107 2 //Puts_UART("Burning EEPROM Start!\r\n");
1108 2 Burning_EEPROM();
1109 2 //Puts_UART("Burning EEPROM End!\r\n");
1110 2 }
1111 1 else if ((I2CReadByte(EEPROM_MCU | (EE_BURN1/256)*2, EE_BURN1%256) == EEPDATA[63][13])&&
1112 1 (I2CReadByte(EEPROM_MCU | (EE_BURN2/256)*2, EE_BURN2%256) == EEPDATA[63][14])&&
1113 1 (I2CReadByte(EEPROM_MCU | (EE_BURN3/256)*2, EE_BURN3%256) == EEPDATA[63][15]))
1114 1 {
1115 2 //Puts_UART("EEPROM matched!\r\n");
1116 2 }
1117 1
1118 1 }
1119 /*==============================================================================
1120
1121 ==============================================================================*/
1122 void Burning_EEPROM(void)
1123 {
1124 1
1125 1 Word address;
1126 1
1127 1 LEDG = 0;
1128 1 LEDR = 0;
1129 1
1130 1 for(address = 0; address < 0x400; address++) // 1024 byte
1131 1 {
1132 2 if((address % 256) == 0x00)
1133 2 LEDR = LEDG = 0;
1134 2 if((address % 256) == 0x80)
1135 2 LEDR = LEDG = 1;
1136 2 I2CWriteByte(EEPROM_MCU | (address/256)*2, address%256 , EEPDATA[address/16][address%16]);
1137 2 }
1138 1 LEDG = 1;
1139 1 LEDR = 0;
1140 1
1141 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 4660 ----
CONSTANT SIZE = 2183 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- 72
IDATA SIZE = ---- ----
BIT SIZE = ---- 1
END OF MODULE INFORMATION.
C51 COMPILER V7.07 FUNCTION 09/26/2006 08:56:43 PAGE 20
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -