📄 cpu.lst
字号:
235 3 for(i=0; i<EE_PC_MAX+1; i++)
236 3 WriteEEP( EE_PCDATA + LEN_PCDATA*i, 0 );
237 3 }
238 2 #endif
239 2 }
C51 COMPILER V7.50 CPU 04/01/2008 15:02:02 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
256 1 InitTV();
257 1 #endif
258 1
259 1 ChangeInput( GetInputSelectionEE() );
260 1
261 1 DownloadUDFont();
262 1 DisplayLogo();
263 1
264 1 LCDPowerON(1); // Power on but free run
265 1
266 1 AutoDetect = 1;
267 1
268 1 Puts("\n\rDone!!!");
269 1 Prompt();
270 1
271 1
272 1 //////////////////////////////////////////////////////////////////////////////////
273 1
274 1 // delay(100);
275 1 WaitDelay(100); // 100 * 10ms delay
276 1 WriteTW88( STATUS0, 0xff); // clear status
277 1 WriteTW88( STATUS1, 0xff); // clear status
278 1 ClearLogo();
279 1
280 1 }
281
282
283
284 // ************************ ifdef INTERNAL_MCU *******************************
285 #ifdef INTERNAL_MCU
286 BYTE xdata * data regTW88 = REG_START_ADDRESS;
287
288 //=============================================================================
289 // Initialize CPU
290 //=============================================================================
291 void InitCPU(void)
292 {
293 1
294 1 SPICONTROL = 0x08; // slow FLASH access mode
295 1 /* CLOCK_11M --------------------------------------------------------------------
296 1 T0HIGH = 1; // default is 144 but change it to 432 easily makes 0.01s
297 1 T0LOW = 176;
298 1 T1LOW = 144; // default is 144 for 11.0592MHz makes 4800BPS
299 1 ---------------------------------------------------------------------------------*/
300 1 /* CLOCK_22M ---------------------------------------------------------------------
301 1 T0HIGH = 1; // ddefault is 144 but change it to 432 easily makes 0.01s
C51 COMPILER V7.50 CPU 04/01/2008 15:02:02 PAGE 6
302 1 T0LOW = 176;
303 1 T1LOW = 144; // default is 144 for 22.1184MHz makes 9600BPS
304 1 ---------------------------------------------------------------------------------*/
305 1 T0HIGH = 1; // default is 144 but change it to 432 easily makes 0.01s
306 1 T0LOW = 176;
307 1 T1LOW = 176; // default is 144 for 11.0592MHz but 176 for 27MHz makes 9600BPS
308 1
309 1
310 1 /*----- Initialize interrupt -------------*/
311 1
312 1 TH1 = 0xff; // SMOD = 0 SMOD =1
313 1 // 0ffh :57600 bps
314 1 // 0fdh : 9600 bps 0fdh :19200 bps
315 1 // 0fah : 4800 bps
316 1 // 0f4h : 2400 bps
317 1 // 0e8h : 1200 bps
318 1
319 1 SCON = 0x50; // 0101 0000 mode 1 - 8 bit UART
320 1 // Enable serial reception
321 1 // TMOD = 0x22; // 0010 0010 timer 0 - 8 bit auto reload
322 1 TMOD = 0x66; // 0110 0110 timer 0 - 8 bit auto reload //by yhbae for synopsys core
323 1 // timer 1 - baud rate generator
324 1 TCON = 0x55; // 0101 0001 timer 0,1 run
325 1 // int 0, edge triggered
326 1 // int 1, edge triggered
327 1 // TF1 TR1 TF0 TR0 EI1 IT1 EI0 IT0
328 1
329 1 //#if defined CLOCK_11M
330 1 // TH0 = 128;
331 1 //#elif defined CLOCK_22M
332 1 // TH0 = 128; // count 128
333 1 //#elif defined CLOCK_27M
334 1 TH0 = 131; // count 256 - 125 = 131
335 1 //#endif
336 1
337 1 PCON = PCON | 0x80; // 1000 0000 SMOD(double baud rate bit) = 1
338 1 IP = 0x02; // 0000 0000 interrupt priority
339 1 // - - PT2 PS PT1 PX1 PT0 PX0
340 1
341 1 #ifdef SERIAL
342 1 IE = 0x92; // 1001 0010 interrupt enable:Serial,TM0
343 1 // EA - ET2 ES ET1 EX1 ET0 EX0
344 1
345 1 TI = 1; // LJY000724 // For Starting Serial TX
346 1 ES = 1; // LJY000724
347 1 #else
IE = 0x82;
#endif // SERIAL
350 1 // EIE = 0x0A; // 0000 1010 : EX5=1, EX3=1;
351 1 // EIE = 0x02; // 0000 0010 : EX5=0, EX3=1;
352 1 EIE = 0x00; // disable all interrupts
353 1
354 1 //------------ Timer 2 for Remocon --------------------------------
355 1 T2CON = 0x00; // Timer2 Clear
356 1 TR2 = 0;
357 1 ET2 = 1;
358 1 C_T2 = 1; // timer source is external T2
359 1 InitForRemo();
360 1 //-----------------------------------------------------------------
361 1 }
362
363 //INTERRUPT(1, timer0_int)
C51 COMPILER V7.50 CPU 04/01/2008 15:02:02 PAGE 7
364 void timer0_int(void) interrupt 1 using 1 // interrupt number1, bank register 2
365 {
366 1
367 1 #ifdef DEBUG_TIMER0
static BYTE test;
P2 = test++;
#endif
371 1 tm001++;
372 1 //---------- 0.01 sec timer ------------
373 1
374 1 // #ifdef CLOCK_11M
375 1 // if( tm001 > 2 ) { // BYH 0.01s with T0H 128, T0 divider by 144*3 = 432
376 1 // #elif defined CLOCK_22M
377 1 // if( tm001 > 4 ) { // BYH 0.01s with T0H 128, T0 divider by 432
378 1 // #elif defined CLOCK_27M
379 1 if( tm001 > 5 ) { // BYH 0.01s with T0H 125, T0 divider by 432
380 2 // #endif
381 2 tm001 = 0;
382 2 tic01++;
383 2
384 2 if( tic01==100 ) { // 1 sec
385 3 SystemClock++;
386 3 tic01 = 0;
387 3 }
388 2 if( tic_pc!=0xffff )
389 2 tic_pc++;
390 2 // Hans
391 2 if (cDelayCounter > 0)
392 2 cDelayCounter--;
393 2 }
394 1
395 1 }
396
397 void PowerDown( void )
398 {
399 1 // LCDPowerOFF();
400 1 // PowerLED(OFF);
401 1 // WriteTW88(TW88_OSDLOCKUPSEL, (ReadTW88(TW88_OSDLOCKUPSEL)|0x10)); // OSD All Off (TW8806B)
402 1 WriteTW88( MCU_STOP_MODE, (ReadTW88(MCU_STOP_MODE) | 0x80) ); // set bit7 to 1
403 1 PCON = PCON | 2; // enter stop mode
404 1 }
405
406 /*****************************************************************************/
407 /* Ext Int 3_n Interrupt : implements interrup service */
408 /*****************************************************************************/
409 WORD TW88IRQ = 0;
410
411 //INTERRUPT(9, ext3_int)
412 void ext3_int(void) interrupt 9 using 1
413 {
414 1 BYTE page;
415 1
416 1 EXIF = EXIF & 0xDF; // clear interrupt 3;
417 1 page = ReadTW88(0xff);
418 1 WriteTW88(REG_PAGE, 0);
419 1 TW88IRQ = ReadTW88( STATUS0 );
420 1 TW88IRQ <<= 8;
421 1 TW88IRQ += ReadTW88( STATUS1 );
422 1 WriteTW88( STATUS0, 0xff ); // clear change bits
423 1 WriteTW88( STATUS1, 0xff ); // clear change bits
424 1 WriteTW88(REG_PAGE, page);
425 1 //EIE &= 0xFD; // disable interrupts
C51 COMPILER V7.50 CPU 04/01/2008 15:02:02 PAGE 8
426 1 }
427
428 /*****************************************************************************/
429 /* Ext Int 5_n Interrupt : Power Down sequence */
430 /*****************************************************************************/
431
432 //INTERRUPT(11, ext5_int)
433 void ext5_int(void) interrupt 11 using 1
434 {
435 1 WORD i;
436 1 EXIF = EXIF & 0x7F; // clear interrupt 5;
437 1 // EA = 0; // disable all interrupts
438 1 // EX5 = 0;
439 1
440 1 // P2 = 0xf0;
441 1 for ( i=0; i<0xFF0; i++ ) ; // wait for some time...
442 1 if ( POWER_DOWN == 1 ) {
443 2 PowerDown();
444 2 //PCON = PCON | 2; // enter stop mode
445 2 }
446 1 else {
447 2 // EA = 1;
448 2 }
449 1 }
450
451 //------------------------------------------------------------------
452 // void InitVars(void) - variable initialize
453 //------------------------------------------------------------------
454 void InitVars(void)
455 {
456 1 SystemClock=0; //00:00
457 1 LastBlockedTime=0xffffffff; //00:00 //ljy010904...CC_FIX_CLEAR_ON_TIME..oops! previous vchip clear error
-
458 1 OffTime=0xffff;
459 1 SleepTimer=0;
460 1 SleepTime=0xffff;
461 1
462 1 DebugLevel = 0;
463 1 RemoDataReady = 0;
464 1 }
465
466 //------------------------------------------------------------------
467 // void InitTechwell(void) - Techwell Decoder initialize
468 //------------------------------------------------------------------
469 void InitTechwell( void )
470 {
471 1 #ifdef NO_INITIALIZE
472 1 if( ReadKey()==MENUKEY ) {// No Initialize
473 2 NoInitAccess =1;
474 2 Printf("\r\n No-initialize Test going on with MENU KEY pressed ..: %d\n", (WORD)P0_3);
475 2 return;
476 2 }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -