cpu.lst
来自「显示屏驱动源代码」· LST 代码 · 共 1,256 行 · 第 1/5 页
LST
1,256 行
236 3 WriteEEP( EE_PCDATA + LEN_PCDATA*i, 0 );
237 3 }
238 2 #endif
239 2 }
C51 COMPILER V7.06 CPU 02/21/2008 14:00:25 PAGE 5
240 1
241 1 #ifdef SUPPORT_GAMMA
DownLoadGamma();
#endif
244 1
245 1 VInputStdDetectMode = GetVInputStdDetectModeEE();
246 1 if( VInputStdDetectMode != AUTO )
247 1 SetVInputStd( VInputStdDetectMode );
248 1 else
249 1 SetVInputStd( NTSC );
250 1 SetPossibleAutoDetectStdEE();
251 1
252 1 //InputSelectionInx = 0;
253 1 InputSelection = UNKNOWN; //GetInputSelectionEE();
254 1
255 1 #ifdef SUPPORT_TV
InitTV();
#endif
258 1
259 1 ChangeInput( GetInputSelectionEE() );
260 1
261 1 #ifdef SUPPORT_KRS_OSDDEMO
DownloadUDFont_Only();
Change_OSDColorLookup_KRS();
DisplayKRSOSD();
LCDPowerON(0);
WriteTW88(0xb4, 0x02);
#else
269 1
270 1 DownloadUDFont();
271 1 DisplayLogo();
272 1
273 1 LCDPowerON(1); // Power on but free run
274 1
275 1 // DisplayInput();
276 1 #endif
277 1
278 1 AutoDetect = 1;
279 1
280 1 Puts("\n\rDone!!!");
281 1 Prompt();
282 1
283 1
284 1 //////////////////////////////////////////////////////////////////////////////////
285 1
286 1 // delay(100);
287 1 WaitDelay(100); // 100 * 10ms delay
288 1 WriteTW88( STATUS0, 0xff); // clear status
289 1 WriteTW88( STATUS1, 0xff); // clear status
290 1 ClearLogo();
291 1
292 1 }
293
294
295
296 // ************************ ifdef INTERNAL_MCU *******************************
297 #ifdef INTERNAL_MCU
BYTE xdata * data regTW88 = REG_START_ADDRESS;
//=============================================================================
// Initialize CPU
C51 COMPILER V7.06 CPU 02/21/2008 14:00:25 PAGE 6
//=============================================================================
void InitCPU(void)
{
SPICONTROL = 0x08; // slow FLASH access mode
/* CLOCK_11M --------------------------------------------------------------------
T0HIGH = 1; // default is 144 but change it to 432 easily makes 0.01s
T0LOW = 176;
T1LOW = 144; // default is 144 for 11.0592MHz makes 4800BPS
---------------------------------------------------------------------------------*/
/* CLOCK_22M ---------------------------------------------------------------------
T0HIGH = 1; // ddefault is 144 but change it to 432 easily makes 0.01s
T0LOW = 176;
T1LOW = 144; // default is 144 for 22.1184MHz makes 9600BPS
---------------------------------------------------------------------------------*/
T0HIGH = 1; // default is 144 but change it to 432 easily makes 0.01s
T0LOW = 176;
T1LOW = 176; // default is 144 for 11.0592MHz but 176 for 27MHz makes 9600BPS
/*----- Initialize interrupt -------------*/
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; // 0101 0000 mode 1 - 8 bit UART
// Enable serial reception
// TMOD = 0x22; // 0010 0010 timer 0 - 8 bit auto reload
TMOD = 0x66; // 0110 0110 timer 0 - 8 bit auto reload //by yhbae for synopsys core
// 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
//#if defined CLOCK_11M
// TH0 = 128;
//#elif defined CLOCK_22M
// TH0 = 128; // count 128
//#elif defined CLOCK_27M
TH0 = 131; // count 256 - 125 = 131
//#endif
PCON = PCON | 0x80; // 1000 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
// EIE = 0x0A; // 0000 1010 : EX5=1, EX3=1;
// EIE = 0x02; // 0000 0010 : EX5=0, EX3=1;
C51 COMPILER V7.06 CPU 02/21/2008 14:00:25 PAGE 7
EIE = 0x00; // disable all interrupts
//------------ Timer 2 for Remocon --------------------------------
T2CON = 0x00; // Timer2 Clear
TR2 = 0;
ET2 = 1;
C_T2 = 1; // timer source is external T2
InitForRemo();
//-----------------------------------------------------------------
}
//INTERRUPT(1, timer0_int)
void timer0_int(void) interrupt 1 using 1 // interrupt number1, bank register 2
{
#ifdef DEBUG_TIMER0
static BYTE test;
P2 = test++;
#endif
tm001++;
//---------- 0.01 sec timer ------------
// #ifdef CLOCK_11M
// if( tm001 > 2 ) { // BYH 0.01s with T0H 128, T0 divider by 144*3 = 432
// #elif defined CLOCK_22M
// if( tm001 > 4 ) { // BYH 0.01s with T0H 128, T0 divider by 432
// #elif defined CLOCK_27M
if( tm001 > 5 ) { // BYH 0.01s with T0H 125, T0 divider by 432
// #endif
tm001 = 0;
tic01++;
if( tic01==100 ) { // 1 sec
SystemClock++;
tic01 = 0;
}
if( tic_pc!=0xffff )
tic_pc++;
// Hans
if (cDelayCounter > 0)
cDelayCounter--;
}
}
void PowerDown( void )
{
// LCDPowerOFF();
// PowerLED(OFF);
// WriteTW88(TW88_OSDLOCKUPSEL, (ReadTW88(TW88_OSDLOCKUPSEL)|0x10)); // OSD All Off (TW8806B)
WriteTW88( MCU_STOP_MODE, (ReadTW88(MCU_STOP_MODE) | 0x80) ); // set bit7 to 1
PCON = PCON | 2; // enter stop mode
}
/*****************************************************************************/
/* Ext Int 3_n Interrupt : implements interrup service */
/*****************************************************************************/
WORD TW88IRQ = 0;
//INTERRUPT(9, ext3_int)
void ext3_int(void) interrupt 9 using 1
{
C51 COMPILER V7.06 CPU 02/21/2008 14:00:25 PAGE 8
BYTE page;
EXIF = EXIF & 0xDF; // clear interrupt 3;
page = ReadTW88(0xff);
WriteTW88(REG_PAGE, 0);
TW88IRQ = ReadTW88( STATUS0 );
TW88IRQ <<= 8;
TW88IRQ += ReadTW88( STATUS1 );
WriteTW88( STATUS0, 0xff ); // clear change bits
WriteTW88( STATUS1, 0xff ); // clear change bits
WriteTW88(REG_PAGE, page);
//EIE &= 0xFD; // disable interrupts
}
/*****************************************************************************/
/* Ext Int 5_n Interrupt : Power Down sequence */
/*****************************************************************************/
//INTERRUPT(11, ext5_int)
void ext5_int(void) interrupt 11 using 1
{
WORD i;
EXIF = EXIF & 0x7F; // clear interrupt 5;
// EA = 0; // disable all interrupts
// EX5 = 0;
// P2 = 0xf0;
for ( i=0; i<0xFF0; i++ ) ; // wait for some time...
if ( POWER_DOWN == 1 ) {
PowerDown();
//PCON = PCON | 2; // enter stop mode
}
else {
// EA = 1;
}
}
//------------------------------------------------------------------
// 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;
DebugLevel = 0;
RemoDataReady = 0;
}
//------------------------------------------------------------------
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?