📄 cpu.lst
字号:
477 1 #endif
478 1 LCDPowerOFF();
479 1 InitCCFL(); // Hans
480 1 ConfigPanel(); // Hans
481 1 ConfigTCON(); // Hans
482 1 Puts("\r\n\nDetect ");
483 1
484 1 switch( ReadTW88(0) ) {
485 2 case 0x21: Puts("TW8816"); break;
486 2 case 0x49: Puts("TW8817"); break;
C51 COMPILER V7.50 CPU 04/01/2008 15:02:02 PAGE 9
487 2 default: Printf("Nothing --0x%02x\r\n", (WORD)ReadDecoder(0));
488 2 while(1) {
489 3 #ifdef SERIAL
490 3 if( RS_ready() ) break;
491 3 #endif
492 3 Printf("Check again --0x%02x\r\n", (WORD)ReadDecoder(0));
493 3 delay(99);
494 3 if( ReadTW88(0)==0 ) continue;
495 3 if( ReadTW88(0)==0xff ) continue;
496 3 break;
497 3 }
498 2 delay(99);
499 2 delay(99);
500 2 Printf("Last Check --0x%02x\r\n", (WORD)ReadDecoder(0));
501 2 break;
502 2 }
503 1
504 1 #ifdef ADD_ANALOGPANEL
if(IsAnalogOn())
Printf("%s \n", AddedAnalogPanelStr);
else
#endif
509 1 Printf("%s \n", PanelInfoStr);
510 1
511 1 CheckSpecialMode();
512 1 DebugLevel = 0xff;
513 1 main_init();
514 1
515 1 }
516 //=============================================================================
517 // Power LED ON / OFF
518 //=============================================================================
519 void PowerLED(BYTE flag)
520 {
521 1 #define GREEN_LED P1_7
522 1 #define RED_LED P1_6
523 1
524 1 if( flag==ON ) {
525 2 RED_LED = 0; // ON RED
526 2 GREEN_LED = 0; // ON GREEN
527 2 dPuts("\r\n(PowerLED)-ON");
528 2 }
529 1 else {
530 2 RED_LED = 0; // ON RED
531 2 GREEN_LED = 1; // OFF GREEN
532 2 dPuts("\r\n(PowerLED)-OFF");
533 2 }
534 1 }
535 #else
//=============================================================================
// Initialize WINBOND CPU
//=============================================================================
void InitCPU(void)
{
CHPENR = 0x87; // Enable AUX RAM in Winbond(W78E516B)
CHPENR = 0x59; //
CHPCON = 0x10; //
CHPENR = 0x00; // Write Disable
/*----- Initialize interrupt -------------*/
C51 COMPILER V7.50 CPU 04/01/2008 15:02:02 PAGE 10
TH1 = 0xff; // SMOD = 0 SMOD =1
// 0ffh :57600 bps
// 0fdh : 9600 bps 0fdh :19200 bps
// 0fah : 4800 bps
// 0f4h : 2400 bps
// 0e8h : 1200 bps
SCON = 0x50; // 0100 0000 mode 1 - 8 bit UART
// Enable serial reception
TMOD = 0x22; // 0010 0010 timer 0 - 8 bit auto reload
// timer 1 - baud rate generator
TCON = 0x55; // 0101 0001 timer 0,1 run
// int 0, edge triggered
// int 1, edge triggered
// TF1 TR1 TF0 TR0 EI1 IT1 EI0 IT0
TH0 = TL0 = 64; // 64=4608 Hz at 11.0592MHz
PCON = 0x80; // 0000 0000 SMOD(double baud rate bit) = 1
IP = 0x02; // 0000 0000 interrupt priority
// - - PT2 PS PT1 PX1 PT0 PX0
#ifdef SERIAL
IE = 0x92; // 1001 0010 interrupt enable:Serial,TM0
// EA - ET2 ES ET1 EX1 ET0 EX0
TI = 1; // LJY000724 // For Starting Serial TX
ES = 1; // LJY000724
#else
IE = 0x82;
#endif // SERIAL
//------------ Timer 2 for Remocon --------------------------------
T2CON = 0x00; // Timer2 Clear
TR2 = 0;
ET2 = 1;
//-----------------------------------------------------------------
}
#define _ReadKey() ( ((~P4>>2)& 0x01) | (~P1 & 0xfc) )
////////////////////////////////
//INTERRUPT(1, timer0_int)
void timer0_int(void) interrupt 1 using 1 // interrupt number1, bank register 2
{
tm001++;
//---------- 0.01 sec timer ------------
#ifdef CLOCK_11M
if( tm001 > 48 ) { // LJY001220 0.01sec
#elif defined CLOCK_22M
if( tm001 > 48*2 ) { // LJY001220 0.01sec
#endif
tm001 = 0;
tic01++;
if( tic01==100 ) { // 1 sec
SystemClock++;
C51 COMPILER V7.50 CPU 04/01/2008 15:02:02 PAGE 11
tic01 = 0;
}
if( tic_pc!=0xffff )
tic_pc++;
///////////////////////////////////////////
if( _ReadKey() ) {
if( keytic==3 ) {
Key = _ReadKey();
RepeatKey = 0;
KeyReady = 1;
}
else if( keytic==100 ) {
Key = _ReadKey();
RepeatKey = 1;
KeyReady = 1;
keytic = 80;
}
keytic++;
}
else
keytic = 0;
///////////////////////////////////////////
// Hans
if (cDelayCounter > 0)
cDelayCounter--;
}
}
//------------------------------------------------------------------
// void InitVars(void) - variable initialize
//------------------------------------------------------------------
void InitVars(void)
{
SystemClock=0; //00:00
LastBlockedTime=0xffffffff; //00:00 //ljy010904...CC_FIX_CLEAR_ON_TIME..oops! previous vchip clear error
-
OffTime=0xffff;
SleepTimer=0;
SleepTime=0xffff;
SEL_DVI= 1; // disable Digital VGA
// ResetKey();
DebugLevel = 0;
RemoDataReady = 0;
P0_7 = 1;
delay(100);
PowerDown_XTAL(0);
TW88HWReset = 1; delay(1);
}
//------------------------------------------------------------------
// void InitTechwell(void) - Techwell Decoder initialize
//------------------------------------------------------------------
void InitTechwell( void )
{
#ifdef NO_INITIALIZE
if( P0_3==0 ) {// No Initialize
C51 COMPILER V7.50 CPU 04/01/2008 15:02:02 PAGE 12
NoInitAccess =1;
Printf("\r\n No-initialize Test going on with DIP SW4 ..: %d\n", (WORD)P0_3);
return;
}
#endif
LCDPowerOFF();
InitCCFL(); // Hans
ConfigPanel(); // Hans
ConfigTCON(); // Hans
Puts("\r\n\nDetect ");
switch( ReadTW88(0) ) {
case 0x21: Puts("TW8816"); break;
case 0x49: Puts("TW8817"); break;
default: Printf("Nothing --0x%02x\r\n", (WORD)ReadDecoder(0));
while(1) {
#ifdef SERIAL
if( RS_ready() ) break;
#endif
Printf("Check again --0x%02x\r\n", (WORD)ReadDecoder(0));
delay(99);
if( ReadTW88(0)==0 ) continue;
if( ReadTW88(0)==0xff ) continue;
break;
}
delay(99);
delay(99);
Printf("Last Check --0x%02x\r\n", (WORD)ReadDecoder(0));
break;
}
#ifdef ADD_ANALOGPANEL
if(IsAnalogOn())
Printf("%s \n", AddedAnalogPanelStr);
else
#endif
Printf("%s \n", PanelInfoStr);
CheckSpecialMode();
main_init();
}
//=============================================================================
// Power LED ON / OFF
//=============================================================================
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -