📄 main.lst
字号:
C51 COMPILER V7.07 MAIN 09/26/2006 08:56:43 PAGE 1
C51 COMPILER V7.07, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN main.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE main.c BROWSE DEBUG OBJECTEXTEND
stmt level source
1 /*********************************************************************
2
3 COPYRIGHT (C) Himax Technologies, Inc.
4
5 File name : main.c
6
7 Description : Main Programm
8
9 Author : Taylor
10
11 Create date : 2005/06/10
12
13 Modifications :
14 *********************************************************************/
15
16 #define _MAIN_C
17
18 /********************** Include Section *****************************/
19
20 #include "main.h"
21 #include "mcu_io.h"
22 #include "i2c_control.h"
23 #include "common.h"
24 #include "hx8824.h"
25 #include "rs232.h"
26 #include "Key.h"
27 #include "OSD.h"
28
29 idata unsigned char Osd_Status, Item, bOSDPOS, bVideo, Mode, b60hz, bBurnInMode,
30 bVideo_Status, Status_Change, New_Status = 0x02, Old_Status,bDithering,
31 bPanel_Change, Panel_Type, bVGA, bSwitchInput, border_flag,
32 bVGA_Status = 0x01, bSource, pre_status = 0x00, now_status = 0x02, TV_Mode, Channel,
33 bNo_Signal, logo_fg, Pre_Channel;
34 idata unsigned char timer_cnt = 100;
35 idata unsigned int ParaAddress;
36
37
38 void Initial_Parameters(void);
39
40 /********************* Main Program Section *************************/
41 void main(void)
42 {
43 1 Byte Bypass = 0, temp;
44 1 if(Bypass) // Bypass for compile warning 2004/8/26 05:30pm
45 1 {
46 2 Init_OSD();
47 2 //OsdSetPallete();
48 2 I2CWrtCNByte(0x0,0x0,0x0,0x0);
49 2 HexTobyStr(0x0);
50 2 temp = ReadWord();
51 2 temp = Get_UART();
52 2 Init_HX8824();
53 2 Init_SAA7111();
54 2 Init_SAA7114();
55 2 DelayX10ms(1);
C51 COMPILER V7.07 MAIN 09/26/2006 08:56:43 PAGE 2
56 2 Select_Video_Input(0x0);
57 2 Contrast_Adj(0);
58 2 Print_String(2, 2, 0x00, 0x07, "ABCDEFGH");
59 2 test();
60 2 Switch_Input(0);
61 2 Initial_Tuner();
62 2 Set_Channel(0);
63 2 Auto_Scan();
64 2 Initial_Parameters();
65 2 }
66 1
67 1 sInitSys(); // Initial System
68 1
69 1 while(1)
70 1 {
71 2 Get_Key();
72 2 Key_Proc();
73 2 //Signal_Detect();
74 2 }
75 1 }
76
77 /******************* Main Relative Function Implement *****************/
78
79 /* -------------------------------------------------------------------
80 Name : sInitSys
81 Purpose : Initial system
82 Passed :
83 Returns :
84 Notes :
85 ------------------------------------------------------------------- */
86 void sInitSys(void)
87 {
88 1 LED1 = 0;
89 1 LED2 = 1;
90 1 BL_CTRL = 1; // turn back light ON; 1: for old inverter/ 0: for new inverter
91 1 ResetN = 0; // HX8824 Reset Active Low
92 1
93 1 DelayX1ms(5); // Delay A While
94 1
95 1 ResetN = 1; // PA8824 Reset OK
96 1
97 1 P1 = 0x9F; // input pin setting
98 1 LEDG = 1; // turn on green LED
99 1 LEDR = 0;
100 1
101 1 S1 = 0; // switch to CCIR
102 1 S2 = 1;
103 1
104 1 //S1 = 1; // switch to VGA
105 1 //S2 = 0;
106 1 Osd_Status = Item = bBurnInMode = Second = bVGA = border_flag = bNo_Signal = logo_fg = 0;
107 1 Status_Change = bVideo = Panel_Type = bDithering = 1;
108 1 Mode = 0;
109 1
110 1 Init_UART(); // Initial UART, Timer 1 was used
111 1
112 1 EX0 = 1; // int0 interrupt enable
113 1
114 1 IT0 = 1; // set INT0 : falling edge trigger, remote controller
115 1
116 1 EA = 1; // Enable interrupt ALL
117 1
C51 COMPILER V7.07 MAIN 09/26/2006 08:56:43 PAGE 3
118 1 Init_I2C(); // Initial I2C Bus
119 1 //Puts_UART("[1]MPC Reset OK!\r\n"); // Intialization MPU
120 1 DelayX1ms(5); // Delay A While
121 1
122 1 #if EEPROM
Check_EEPROM(); // check if new EEPROM
#endif
125 1
126 1 DelayX1ms(5);
127 1 Init_PLL(); // Initial PLL
128 1 DelayX1ms(5); // Delay A While
129 1 //Init_SAA7111();
130 1 Init_SAA7114();
131 1 DelayX1ms(5);
132 1 Init_HX8824(); //Initial HX8824
133 1 DelayX1ms(5);
134 1 Init_OSD();
135 1 DelayX1ms(5);
136 1 Gamma_Adj();
137 1 DelayX1ms(5);
138 1 DelayX1ms(5);
139 1 #if TV
//TV_Mode = TV_AIR;
TV_Mode = CATV_STD;
//Channel = 0;
Initial_Tuner();
DelayX1ms(5);
Set_Channel(Channel);
#endif
147 1 #if EEPROM
Initial_Parameters();
#endif
150 1 Puts_UART("Initial OK!\r\n");
151 1 BL_CTRL = 0; // turn back light ON; 1: for old inverter/ 0: for new inverter
152 1 LED1 = 1;
153 1 LED2 = 0;
154 1 // for pattern gen
155 1 Get_Key();
156 1 if(bBurnInMode == 1)
157 1 {
158 2 Stand_alone_mode();
159 2 LEDG = 0;
160 2 LEDR = 1;
161 2 // I2CWriteByte(HX8824_ADDR, 0x80, 0x00); // for 1st version CF design error,
162 2 I2CWriteByte(HX8824_ADDR, HX8824_TEST_PATTERN, 0x40);
163 2 Puts_UART("BurnInMode in initial\r\n");
164 2 }
165 1 }
166
167 /* -------------------------------------------------------------------
168 Name : Signal_Detect
169 Purpose : Detect the video & VGA signal
170 Passed :
171 Returns :
172 Notes :
173 ------------------------------------------------------------------- */
174 void Signal_Detect()
175 {
176 1 if(bVideo)
177 1 {
178 2 //Puts_UART("enter if(bVideo)!\r\n");
179 2 Video_Detect(); // detect if video signal exist?
C51 COMPILER V7.07 MAIN 09/26/2006 08:56:43 PAGE 4
180 2 if(bVideo_Status)
181 2 {
182 3 //Puts_UART("bVideo_Status = 1!\r\n");
183 3 if(Status_Change || bPanel_Change) //if(Status_Change)
184 3 {
185 4 //Puts_UART("Status Change!\r\n");
186 4 //Puts_UART("Panel Change!\r\n");
187 4 switch (b60hz)
188 4 {
189 5 case 0: // PAL
190 5 if(Panel_Type == 0x0) // 800x600 panel
191 5 {
192 6 Mode = 8;
193 6 // I2CWriteByte(HX8824_ADDR, 0x81, 0x3C);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -