📄 t100.lst
字号:
C51 COMPILER V6.12 T100 08/25/2007 18:38:52 PAGE 1
C51 COMPILER V6.12, COMPILATION OF MODULE T100
OBJECT MODULE PLACED IN .\T100.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE .\T100.c BROWSE DEBUG OBJECTEXTEND
stmt level source
1 #include "REG51.H"
2 #include <intrins.h>
3 #include "Remote.h"
4
5
6 #define OSD_EN
7 typedef unsigned char uCHAR;
8
9 //#include "T100Data_A.h"
10 //#include "T100Data_PA.h"
11 #include "T100Data_AU.h"
12 //#include "T100Data_LG.h"
13 //#include "T100Data_FOX.h"
14
15
16 #ifdef OSD_EN
17 #include "OSDFont1218_new.h"
18 #include "OSD1218_new.h"
19 #endif
20
21 sbit T100_RESET = P1^4;
22 sbit SCL = P1^6;
23 sbit SDA = P1^7;
24 sbit BL_EN = P0^7;
25 #if 1
26 #define kyKEY_MSK 0x81
27 #define KEYPORT P0
28
29 #define kyMENU 0x08
30 #define kyDEC 0x04
31 #define kyINC 0x02
32 #define kySOURCE 0x10
33 #define kyUD_LR 0x20
34 #define kyFULL_43 0x40
35 #else
#define kyKEY_MSK 0xc0
#define KEYPORT P2
#define kyMENU 0x02
#define kyDEC 0x08
#define kyINC 0x04
#define kySOURCE 0x10
#define kyUD_LR 0x20
#define kyFULL_43 0x01//0x40
#endif
46 /*sbit kyMENU = P0^1;
47 sbit kyDEC = P0^2;
48 sbit kyINC = P0^3;
49 sbit kySOURCE = P0^4;
50 sbit kyUD_LR = P0^5;
51 sbit kyFULL_43 = P0^6;//*/
52
53 bit bNTSC_PAL = 0; //0:PAL 1:NTSC
54 bit bFULL_43 = 1; //0:4:3 1:FULL
55 bit bUP_DOWN = 1; //0:Down to Up 1:Up to Down
C51 COMPILER V6.12 T100 08/25/2007 18:38:52 PAGE 2
56 bit bLEFT_RIGHT = 1; //0:Right to Left 1:Left to Right
57 uCHAR cSource = 3; //2-4:CVBS2-4 5:S-Video 6:ITU656
58 uCHAR cStandard = 0xff; //0:PAL 4:NTSC
59 uCHAR cKey_Curr,cKey_Pre;
60 void Initial(void);
61 void Delay_ms(uCHAR);
62 void InitT100(void);
63 void ClosePanel(void);
64 void OpenPanel(void);
65 void DetectNTSC_PAL(void);
66 void SetSource(void);
67 void SetMode(void);
68 void SetUD_LR(void);
69 void I2CWriteTbl(char*);
70 uCHAR I2CReadByte(uCHAR, uCHAR);
71 uCHAR I2CWriteByte(uCHAR,uCHAR,uCHAR);
72 void kyKeypad(void);
73 #ifdef OSD_EN
74 void InitOSD(void);
75 void OSDDisable(void);
76 void OSDEnable(void);
77 void OSDCtrl(char cDir);
78 uCHAR cLanguage=0; //0:English 1:French 2:German 3:Spanish 4:Japenese 5:Russian
79 uCHAR cOSDFunc=1; //0:OSD Off 1:Bright 2:Color 3:Screen
80 uCHAR cBright,cColor=COLOR;
81
82 #endif
83 void main(void)
84 {
85 1 Initial();
86 1 while(1)
87 1 {
88 2 kyKeypad();
89 2 DetectNTSC_PAL();
90 2 #ifdef OSD_EN
91 2 OSDEnable();
92 2 #endif
93 2
94 2 // OSDEnable();
95 2 }//while
96 1 }//main
97
98 void Initial(void)
99 {
100 1 //Initial 8051
101 1 P0=0xff;
102 1 P1=0xff;
103 1 P2=0xff;
104 1 P3=0xff;
105 1 //8051Register Set
106 1 IE = 0; // disable all interrupt
107 1 TMOD = 0x11; // Timer1 Mode 1, Timer0 Mode 1;
108 1 //TMOD = 0x01; // Timer0 Mode 1;
109 1 EX0 = 0; // disable external interrupt 0, IE[0]
110 1 EX1 = 0;
111 1 //ET0 = 1; // enable bTimer 0
112 1 //IT0 = 1; // falling endge generate interrupt, TCON[0]
113 1 INT0 = 1;
114 1 IT1 = 1; // falling endge generate interrupt, TCON[0]
115 1 INT1 = 1;
116 1
117 1 //Initial T100
C51 COMPILER V6.12 T100 08/25/2007 18:38:52 PAGE 3
118 1 T100_RESET = 0 ;
119 1 Delay_ms(50);
120 1 T100_RESET = 1 ;
121 1 Delay_ms(20);
122 1 InitT100();
123 1 // SetUD_LR();
124 1 #ifdef OSD_EN
125 1 InitOSD();
126 1 #endif
127 1 }//Initial
128
129 void Delay_ms(uCHAR cTime)
130 {
131 1 uCHAR i,j;
132 1 for(i=0;i<cTime;i++)
133 1 {
134 2 for(j=0;j<250;j++)_nop_();
135 2 for(j=0;j<250;j++)_nop_();
136 2 for(j=0;j<250;j++)_nop_();
137 2 for(j=0;j<250;j++)_nop_();
138 2 }//For
139 1 }//Delay
140
141 void InitT100(void)
142 {
143 1 #if 1
144 1 I2CWriteTbl(TCONData);
145 1 ClosePanel();
146 1 I2CWriteTbl(T100Init);
147 1 I2CWriteTbl(GAMMAData);
148 1 I2CWriteTbl(FilterData);
149 1 SetMode();
150 1 SetSource();
151 1 SetUD_LR();
152 1 #else
uCHAR cTemp1,cAddr;
for(cTemp1=0;cTemp1<PAGE2_E;cTemp1++)
{
if(cTemp1<PAGE1_S)cAddr=0x50;
else if(cTemp1<PAGE2_S)cAddr=0x52;
else cAddr=0x54;
I2CWriteByte(cAddr,RegisterMap[cTemp1],T100CVBS[cTemp1]);
}
#endif
162 1 // OpenPanel();
163 1 }//InitT100
164 void ClosePanel(void)
165 {
166 1 BL_EN=1;
167 1 I2CWriteByte(TW100, 0xC2, I2CReadByte(TW100, 0xC2)|0x12);
168 1 I2CWriteByte(TW100, 0x91, 0x87);//I2CReadByte(TW101, PATTERN_CTRL)|0x80); //Enable Frame Background Colo
-r
169 1 }
170 void OpenPanel(void)
171 {
172 1 I2CWriteByte(TW100, 0xC2, I2CReadByte(TW100, 0xC2)&0xED);
173 1 I2CWriteByte(TW100, 0x91, I2CReadByte(TW100, 0x91)&~0x80); //Enable Frame Background Color
174 1 Delay_ms(10);
175 1 BL_EN=0;
176 1 }
177 void DetectNTSC_PAL(void)
178 {
C51 COMPILER V6.12 T100 08/25/2007 18:38:52 PAGE 4
179 1 static int wBuff=0x000;
180 1 uCHAR cBuff[2];
181 1 wBuff+=1;
182 1 if(wBuff==0x01)
183 1 {
184 2 wBuff=0x00;
185 2 for(cBuff[1]=0;cBuff[1]<1;cBuff[1]++)
186 2 {
187 3 cBuff[0] = I2CReadByte(TW100, 0x5A)&0xe0;
188 3 if(cBuff[0]==cStandard)break;
189 3 // Delay_ms(10);
190 3 if(cBuff[0]>=0x40)
191 3 {
192 4 ClosePanel();
193 4 return;
194 4 } //*/
195 3 }
196 2 #ifdef ESS
197 2 if((bNTSC_PAL)&&(cSource==6))
198 2 {
199 3 cBuff[1] = I2CReadByte(TW100, 0x82);
200 3 if(cBuff[1]>0x90)I2CWriteByte(TW100+2, 0xd3,0x06);
201 3 else if(cBuff[1]<0x78)I2CWriteByte(TW100+2, 0xd3,0x04);
202 3 }
203 2 if((!bNTSC_PAL)&&(cSource==6))
204 2 {
205 3 cBuff[1] = I2CReadByte(TW100, 0x82);
206 3 if(cBuff[1]>0xb0)I2CWriteByte(TW100+2, 0xd3,0x0b);
207 3 else if(cBuff[1]<0x78)I2CWriteByte(TW100+2, 0xd3,0x04);
208 3 }
209 2 #endif
210 2 if(cBuff[0]!=cStandard)
211 2 {
212 3 ClosePanel();
213 3 cStandard=cBuff[0];
214 3 if(cStandard)
215 3 {
216 4 bNTSC_PAL = 0;
217 4 }
218 3 else bNTSC_PAL = 1;
219 3 T100_RESET = 0 ;
220 3 Delay_ms(30);
221 3 T100_RESET = 1 ;
222 3 Delay_ms(5);
223 3 cOSDFunc=(cOSDFunc+1)%4;
224 3 I2CWriteTbl(TCONData);
225 3 ClosePanel();
226 3 // InitT100();//*/
227 3 I2CWriteTbl(T100Init);
228 3 I2CWriteTbl(GAMMAData);
229 3 I2CWriteTbl(FilterData);
230 3 SetMode();
231 3 SetSource();
232 3 SetUD_LR(); //*/
233 3 // SetMode();
234 3 Delay_ms(255);
235 3 OpenPanel();
236 3 Delay_ms(10);
237 3 }
238 2 else OpenPanel();
239 2 }
240 1
C51 COMPILER V6.12 T100 08/25/2007 18:38:52 PAGE 5
241 1 }
242 void SetSource(void)
243 {
244 1 switch(cSource)
245 1 {
246 2 case 2: I2CWriteTbl(CVBS2Data);
247 2 break;
248 2 case 3: I2CWriteTbl(CVBS3Data);
249 2 break;
250 2 case 4: I2CWriteTbl(CVBS4Data);
251 2 break;
252 2 case 5: I2CWriteTbl(SVIDEOData);
253 2 break;
254 2 case 6: I2CWriteTbl(ITU656Data);
255 2 }
256 1 }
257 void SetMode(void)//N/P,Full/4:3
258 {
259 1 if(bNTSC_PAL)//NTSC&&FULL
260 1 {
261 2 I2CWriteTbl(NTSC_FULLData);
262 2 if((!bFULL_43))//NTSC&&4:3
263 2 I2CWriteTbl(NTSC_43Data);
264 2 if(cSource!=5)I2CWriteByte(TW100+4,0x00,0x00);
265 2 }
266 1 else//PAL&&FULL
267 1 {
268 2 I2CWriteTbl(PAL_FULLData);
269 2 if((!bFULL_43))//PAL&&4:3
270 2 I2CWriteTbl(PAL_43Data);
271 2 if(cSource!=5)I2CWriteByte(TW100+4,0x00,0x32);//PAL-N 0x36
272 2 }
273 1 if(cSource==5)I2CWriteByte(TW100+4,0x0f,0x01);
274 1 }
275 void SetUD_LR(void)
276 {
277 1 uCHAR cTemp;
278 1 if(bUP_DOWN&bLEFT_RIGHT)
279 1 {
280 2 cTemp=UD_LR;
281 2 }
282 1 else if(bUP_DOWN&!bLEFT_RIGHT)
283 1 {
284 2 cTemp=UD_RL;
285 2 }
286 1 else if(!bUP_DOWN&bLEFT_RIGHT)
287 1 {
288 2 cTemp=DU_LR;
289 2 }
290 1 else if(!bUP_DOWN&!bLEFT_RIGHT)
291 1 {
292 2 cTemp=DU_RL;
293 2 }
294 1 I2CWriteByte(TW100,0xe1,cTemp);
295 1 }
296
297 #define Set_SDA_High SDA = 1,SDA = 1
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -