📄 t100.lst
字号:
282 1
283 1 //Initial T100
284 1 T100_RESET = 0 ;
285 1 Delay_ms(50); //50
286 1 T100_RESET = 1 ;
287 1 Delay_ms(20);
288 1 InitT100();
289 1 /* EepVideo.cBright=0x80;
290 1 EepVideo.cContrast=0x80;
291 1 EepVideo.cSharp=0x05;
292 1 EepVideo.cSat=0x80;
293 1 EepVideo.cHue=0x80;*/
294 1 // m_cGammaFlag=I2CReadByte(EEPBLOCK0,0x10);
295 1 /*if(m_cGammaFlag==0xA3)
296 1 AdjustGammmaDate();
297 1 else
298 1 SaveEeprom();*/
299 1 // SetUD_LR();
300 1 // OSDInit();
301 1 // OSDShowSource();
302 1 }//Initial
303
C51 COMPILER V7.06 T100 09/21/2005 18:16:31 PAGE 6
304 void Delay_ms(uCHAR cTime)
305 {
306 1 uCHAR i,j;
307 1 for(i=0;i<cTime;i++)
308 1 {
309 2 for(j=0;j<250;j++)_nop_();
310 2 for(j=0;j<250;j++)_nop_();
311 2 for(j=0;j<250;j++)_nop_();
312 2 for(j=0;j<250;j++)_nop_();
313 2 }//For
314 1 }//Delay
315
316 void InitT100(void)
317 {
318 1 I2CWriteTbl(TCONData);
319 1 ClosePanel();
320 1 I2CWriteTbl(T100Init);
321 1 I2CWriteTbl(GAMMAData);
322 1 I2CWriteTbl(FilterData);
323 1 SetMode();
324 1 SetSource();
325 1 SetUD_LR();
326 1 }//InitT100
327 void ClosePanel(void)
328 {
329 1 BL_EN=1;
330 1 I2CWriteByte(TW100, 0xC2, I2CReadByte(TW100, 0xC2)|0x12);
331 1 I2CWriteByte(TW100, 0x91, 0x87);//I2CReadByte(TW101, PATTERN_CTRL)|0x80); //Enable Frame Background Colo
-r
332 1 }
333 void OpenPanel(void)
334 {
335 1 I2CWriteByte(TW100, 0xC2, I2CReadByte(TW100, 0xC2)&0xED);
336 1 I2CWriteByte(TW100, 0x91, I2CReadByte(TW100, 0x91)&~0x80); //Enable Frame Background Color
337 1 Delay_ms(10);
338 1 BL_EN=0;
339 1 }
340 void DetectNTSC_PAL(void)
341 {
342 1 static int wBuff=0x000;
343 1 uCHAR cBuff[2];
344 1 wBuff+=1;
345 1 if(wBuff==0x01)
346 1 {
347 2 wBuff=0x00;
348 2
349 2 for(cBuff[1]=0;cBuff[1]<1;cBuff[1]++){
350 3 // cBuff[0]=I2CReadByte(TW101+4, 0x3c)&0x04; /
351 3 cBuff[0] = I2CReadByte(TW100, 0x5A)&0xe0;
352 3
353 3 if(cBuff[0]==cStandard)break;
354 3 // Delay_ms(10);
355 3 if(cBuff[0]>=0x40)
356 3 {
357 4 ClosePanel();
358 4 return;
359 4 } //*/
360 3 }
361 2 #ifdef ESS
362 2 if((bNTSC_PAL)&&(cSource==6))
363 2 {
364 3 cBuff[1] = I2CReadByte(TW100, 0x82);
C51 COMPILER V7.06 T100 09/21/2005 18:16:31 PAGE 7
365 3 if(cBuff[1]>0x90)I2CWriteByte(TW100+2, 0xd3,0x06);
366 3 else if(cBuff[1]<0x78)I2CWriteByte(TW100+2, 0xd3,0x04);
367 3 }
368 2 if((!bNTSC_PAL)&&(cSource==6))
369 2 {
370 3 cBuff[1] = I2CReadByte(TW100, 0x82);
371 3 if(cBuff[1]>0xb0)I2CWriteByte(TW100+2, 0xd3,0x0b);
372 3 else if(cBuff[1]<0x78)I2CWriteByte(TW100+2, 0xd3,0x04);
373 3 }
374 2 #endif
375 2 if(cBuff[0]!=cStandard)
376 2 {
377 3 ClosePanel();
378 3 cStandard=cBuff[0];
379 3 if(cStandard)bNTSC_PAL = 0;
380 3 else bNTSC_PAL = 1;
381 3 SetMode();
382 3 Delay_ms(100);
383 3 OpenPanel();
384 3 Delay_ms(10);
385 3 }
386 2 else OpenPanel();
387 2 }
388 1
389 1 }
390 void SetSource(void)
391 {
392 1 cSource=2;
393 1 switch(cSource)
394 1 {
395 2 case 2: I2CWriteTbl(CVBS2Data);
396 2 break;
397 2 case 3: I2CWriteTbl(CVBS3Data);
398 2 break;
399 2 case 4: I2CWriteTbl(CVBS4Data);
400 2 break;
401 2 case 5: I2CWriteTbl(SVIDEOData);
402 2 break;
403 2 // case 6: I2CWriteTbl(ITU656Data);
404 2 }
405 1 // OSDShowSource();
406 1 }
407 void SetMode(void)//N/P,Full/4:3
408 {
409 1 // uCHAR data i;
410 1 if(bNTSC_PAL)//NTSC&&FULL
411 1 {
412 2 I2CWriteTbl(NTSC_FULLData);
413 2 if((!bFULL_43))//NTSC&&4:3
414 2 I2CWriteTbl(NTSC_43Data);
415 2 if(cSource!=5)
416 2 {
417 3 I2CWriteByte(TW100+4,0x03,0x00);
418 3 I2CWriteByte(TW100+4,0x00,0x00);
419 3 }
420 2 else
421 2 {
422 3 I2CWriteByte(TW100+4,0x03,0x03);
423 3 I2CWriteByte(TW100+4,0x00,0x01);
424 3 }
425 2 /*I2CWriteTbl(NTSC443Data);
426 2 if(cSource!=5){
C51 COMPILER V7.06 T100 09/21/2005 18:16:31 PAGE 8
427 2 I2CWriteByte(TW100+4,0x03,0x03);
428 2 I2CWriteByte(TW100+4,0x00,0x00);
429 2 }
430 2 else{
431 2 I2CWriteByte(TW100+4,0x03,0x03);
432 2 I2CWriteByte(TW100+4,0x00,0x01);
433 2 }*/
434 2 /*I2CWriteTbl(PAL_MData);
435 2 if(cSource!=5){
436 2 I2CWriteByte(TW100+4,0x03,0x00);
437 2 I2CWriteByte(TW100+4,0x00,0x04);
438 2 }
439 2 else{
440 2 I2CWriteByte(TW100+4,0x03,0x03);
441 2 I2CWriteByte(TW100+4,0x00,0x05);
442 2 }*/
443 2 /* I2CWriteTbl(PAL_60Data);
444 2 if(cSource!=5){
445 2 I2CWriteByte(TW100+4,0x03,0x02);
446 2 I2CWriteByte(TW100+4,0x00,0x02);
447 2 }
448 2 else{
449 2 I2CWriteByte(TW100+4,0x03,0x03);
450 2 I2CWriteByte(TW100+4,0x00,0x03);
451 2 }*/
452 2 /*#if 0
453 2 switch(c60HZ_Mode)
454 2 {
455 2 case 1: I2CWriteTbl(NTSC443Data);
456 2 if(cSource!=5)
457 2 {
458 2 I2CWriteByte(TW100+4,0x03,0x03);
459 2 I2CWriteByte(TW100+4,0x00,0x00);
460 2 }
461 2 else
462 2 {
463 2 I2CWriteByte(TW100+4,0x03,0x03);
464 2 I2CWriteByte(TW100+4,0x00,0x01);
465 2 }
466 2 break;
467 2 case 2:
468 2 I2CWriteTbl(PAL_60Data);
469 2 if(cSource!=5)
470 2 {
471 2 I2CWriteByte(TW100+4,0x03,0x02);
472 2 I2CWriteByte(TW100+4,0x00,0x02);
473 2 }
474 2 else{
475 2 I2CWriteByte(TW100+4,0x03,0x03);
476 2 I2CWriteByte(TW100+4,0x00,0x03);
477 2 }
478 2 break;
479 2 case 3: I2CWriteTbl(PAL_MData);
480 2 if(cSource!=5)
481 2 {
482 2 I2CWriteByte(TW100+4,0x03,0x00);
483 2 I2CWriteByte(TW100+4,0x00,0x04);
484 2 }
485 2 else
486 2 {
487 2 I2CWriteByte(TW100+4,0x03,0x03);
488 2 I2CWriteByte(TW100+4,0x00,0x05);
C51 COMPILER V7.06 T100 09/21/2005 18:16:31 PAGE 9
489 2 }
490 2 break;
491 2 }
492 2 #endif*/
493 2 }
494 1 else//PAL&&FULL
495 1 {
496 2 I2CWriteTbl(PAL_FULLData);
497 2 if((!bFULL_43))//PAL&&4:3
498 2 I2CWriteTbl(PAL_43Data);
499 2 if(cSource!=5)
500 2 {
501 3 I2CWriteByte(TW100+4,0x03,0x02);
502 3 I2CWriteByte(TW100+4,0x00,0x32);
503 3 }
504 2 else
505 2 {
506 3 I2CWriteByte(TW100+4,0x03,0x03);
507 3 I2CWriteByte(TW100+4,0x00,0x33);
508 3 }
509 2 /* I2CWriteTbl(PAL_CNData);
510 2 if(cSource!=5){
511 2 I2CWriteByte(TW100+4,0x00,0x36);
512 2 I2CWriteByte(TW100+4,0x03,0x03);
513 2 }
514 2 else{
515 2 I2CWriteByte(TW100+4,0x03,0x03);
516 2 I2CWriteByte(TW100+4,0x00,0x37);
517 2 }*/
518 2 /*for(i=0;i<=1;i++)
519 2 {
520 2 // if(c50HZ_Mode)
521 2 I2CWriteTbl(PAL_CNData);
522 2 if(cSource!=5){
523 2 I2CWriteByte(TW100+4,0x00,0x36);
524 2 I2CWriteByte(TW100+4,0x03,0x03);
525 2 }
526 2 else{
527 2 I2CWriteByte(TW100+4,0x03,0x03);
528 2 I2CWriteByte(TW100+4,0x00,0x37);
529 2 }*/
530 2 // Delay_ms(50);
531 2 //if((I2CReadByte(TW100+4,0x3c)&0x01))i=2;
532 2 // else c50HZ_Mode=!c50HZ_Mode;
533 2 //}
534 2 }
535 1 // if(cSource==5)I2CWriteByte(TW100+4,0x0f,0x33);
536 1 }
537
538 void SetUD_LR(void)
539 {
540 1 uCHAR cTemp;
541 1 if(bUP_DOWN&bLEFT_RIGHT)
542 1 {
543 2 cTemp=UD_LR;
544 2 }
545 1 else if(bUP_DOWN&!bLEFT_RIGHT)
546 1 {
547 2 cTemp=UD_RL;
548 2 }
549 1 else if(!bUP_DOWN&bLEFT_RIGHT)
550 1 {
C51 COMPILER V7.06 T100 09/21/2005 18:16:31 PAGE 10
551 2 cTemp=DU_LR;
552 2 }
553 1 else if(!bUP_DOWN&!bLEFT_RIGHT)
554 1 {
555 2 cTemp=DU_RL;
556 2 }
557 1 I2CWriteByte(TW100,0xe1,cTemp);
558 1 }
559
560 //*************************************************
561 void StartCondition(void)
562 {
563 1 uCHAR ix;
564 1 uCHAR cTWtrytime=0;
565 1 EA=0;
566 1 while(++cTWtrytime)
567 1 {
568 2 Set_SDA_High;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -