Example #1
0
void main()
{
	TxBuf[0]=0x00; 
	Read_18B20_Temperature();
	Read_18B20_Temperature();
	delay1ms(200);
	Read_18B20_Temperature();
	Read_18B20_Temperature();
	delay1ms(200);
	Read_18B20_Temperature();
	Read_18B20_Temperature();
	delay1ms(200);
	nRF24L01_Config();	  //初始化NRF24L01
	SPI_RW_Reg(FLUSH_TX,0);	
	EX1=1;
	IT1=1;
	EA=1;
	init_1602();
	while(1)
	{
		Read_18B20_Temperature();
		keyscan();
		Control();
		display();
		TxBuf[0]=0xAA;
		TxBuf[2]=Tem_dispbuf[4];
		TxBuf[3]=Tem_dispbuf[0]; 
		TxBuf[4]=beep_flag;
		nRF24L01_TxPacket(TxBuf); //发送数据
		delay1ms(10);
	}

}
Example #2
0
/************************************  Function Initialization ***************************************************/
void initialize_lcd(void) {
  int i;

  for (i=0; i<15; i++) {            // wait 15 ms
    delay1ms();
  }

  write_command4_lcd(0x03);         // write SF_D<11:8> =0x3 and pulse lcd_E high for 12 clock cycles 

  for (i=0; i<5; i++) {             //  wait 5 ms
    delay1ms();           
  }

  write_command4_lcd(0x03);			// write SF_D<11:8> =0x3 and pulse lcd_E high for 12 clock cycles 
  
  
  for (i=0; i<100; i++) {           //  wait 100 us
    delay1us();
  };

  write_command4_lcd(0x03);			// write SF_D<11:8> =0x3 and pulse lcd_E high for 12 clock cycles 
 
  
  for (i=0; i<40; i++) {            // wait 40 us
    delay1us();
  };
  
  write_command4_lcd(0x02);			// write SF_D<11:8> =0x2 and pulse lcd_E high for 12 clock cycles 

  for (i=0; i<40; i++) {            // wait 40 us
    delay1us();
  }
  
}
Example #3
0
/*********************************** Function Configuration **************************************************************/
void configure_lcd(void)
{
  write_command8_lcd(0x28);         // issue function Set Command 0x28
  write_command8_lcd(0x06);         // issue an Entry Mode Set 0x06
  write_command8_lcd(0x0c);         // issue a Display On/Off Command 0x0c
  write_command8_lcd(0x01);         // clear display command
  delay1ms();                       // |
  delay1ms();                       // |  wait 2 ms
}
Example #4
0
void write_data(uchar date)
{
	lcdrs=1;
	P0=date;
	delay1ms(5);
	lcden=1;
	delay1ms(5);
	lcden=0;
}
Example #5
0
void write_com(uchar com)
{
	lcdrs=0;
	P0=com;
	delay1ms(5);
	lcden=1;
	delay1ms(5);
	lcden=0;
}
Example #6
0
/* 
 * We use the presence/absence of a keyboard to determine whether the internal
 * console can be used for input.
 *
 * Perform a simple test on the keyboard; issue the ECHO command and see
 * if the right answer is returned. We don't do anything as drastic as
 * full keyboard reset; it will be too troublesome and take too much time.
 */
static int
probe_keyboard(void)
{
    int retry = PROBE_MAXRETRY;
    int wait;
    int i;

    while (--retry >= 0) {
	/* flush any noise */
	while (inb(IO_KBD + KBD_STATUS_PORT) & KBDS_ANY_BUFFER_FULL) {
	    delay7();
	    inb(IO_KBD + KBD_DATA_PORT);
	    delay1ms();
	}

	/* wait until the controller can accept a command */
	for (wait = PROBE_MAXWAIT; wait > 0; --wait) {
	    if (((i = inb(IO_KBD + KBD_STATUS_PORT)) 
                & (KBDS_INPUT_BUFFER_FULL | KBDS_ANY_BUFFER_FULL)) == 0)
		break;
	    if (i & KBDS_ANY_BUFFER_FULL) {
		delay7();
	        inb(IO_KBD + KBD_DATA_PORT);
	    }
	    delay1ms();
	}
	if (wait <= 0)
	    continue;

	/* send the ECHO command */
	outb(IO_KBD + KBD_DATA_PORT, KBDC_ECHO);

	/* wait for a response */
	for (wait = PROBE_MAXWAIT; wait > 0; --wait) {
	     if (inb(IO_KBD + KBD_STATUS_PORT) & KBDS_ANY_BUFFER_FULL)
		 break;
	     delay1ms();
	}
	if (wait <= 0)
	    continue;

	delay7();
	i = inb(IO_KBD + KBD_DATA_PORT);
#ifdef PROBE_KBD_BEBUG
        printf("probe_keyboard: got 0x%x.\n", i);
#endif
	if (i == KBD_ECHO) {
	    /* got the right answer */
	    return (1);
	}
    }

    return (0);
}
Example #7
0
/**
* turn on DCDC
*
*	DCDC startup step
*	SSPLL ON
*	FP PWC ON
*	call DCDC_on(0) & DCDC_on(1)
*	delay
*	wait VBlank
*	Enable FP Data Out
*	delay
*	call DCDC_on(2)
*	FP Bias On
*
* DCDC data out needs more then 200ms delay after SSPLL_PowerUp(ON).
*/
BYTE DCDC_StartUP_sub(void)
{
	BYTE ret;

	//-------------
	//FPPWC ON
	FP_PWC_OnOff(ON);

	//ret=DCDC_On(0);
	//ret=DCDC_On(1);

	//-------------
	// wait
#ifdef TW8835_EVB_10
	delay1ms(100);
#endif

	WaitVBlank(1);
	//-------------
	//FP Data Out
	OutputEnablePin(ON,ON);		//Output enable. FP data: enable


#ifdef TW8835_EVB_10
	delay1ms(15);
#endif

	//DCDC final
	//ret=DCDC_On(2);
	ret=ERR_SUCCESS;

	//-------------
	//FPBIAS ON 
	FP_BiasOnOff(ON);

	//disable Blank
	//WriteTW88Page(PAGE2_SCALER);
	//WriteTW88(REG21E, ReadTW88(REG21E) & ~0x01);

//	PrintSystemClockMsg("DCDC_StartUp END");
	if(ret!=ERR_SUCCESS) {
		Puts(" FAIL");

		//WriteTW88Page(PAGE0_DCDC);
		//WriteTW88(REG0E8, 0xF2);	Printf("\nREG0E8:F2[%bd]",ReadTW88(REG0EA)>>4);
		//WriteTW88(REG0E8, 0x02);	Printf("\nREG0E8:02[%bd]",ReadTW88(REG0EA)>>4);
		//WriteTW88(REG0E8, 0x03);	Printf("\nREG0E8:03[%bd]",ReadTW88(REG0EA)>>4);
		//WriteTW88(REG0E8, 0x01);	Printf("\nREG0E8:01[%bd]",ReadTW88(REG0EA)>>4);
		//WriteTW88(REG0E8, 0x11);	Printf("\nREG0E8:11[%bd]",ReadTW88(REG0EA)>>4);
		//WriteTW88(REG0E8, 0x71);	Printf("\nREG0E8:71[%bd]",ReadTW88(REG0EA)>>4);
	}
	return ret;
}
Example #8
0
void main()
{
	nRF24L01_Config();
	SetRX_Mode();
	if(MAX_RT)
	{
		SPI_RW_Reg(FLUSH_TX,0);
	}
	SPI_RW_Reg(WRITE_REG+STATUS,0xFF);// clear RX_DR or TX_DS or MAX_RT interrupt flag
    SPI_RW_Reg(FLUSH_RX,0);
	SCON =0x40;
	TMOD = 0x20;
	TH1 = 0xfd;
	TL1 = 0xfd;
	TR1 = 1;
	EX1=1;
	IT1=0;
	EA=1;
	init_1602();
	while(1)
	{
		Control(); 
		display();
		if(RxBuf[0]==0xAA)
		{
			RxBuf[0]=0;
			//PH_dat=RxBuf[1];
			temp_dat=RxBuf[2];
			temp_dot=RxBuf[3];
			beep_flag=RxBuf[4];
		}
		delay1ms(10);
	}
}
Example #9
0
void initkey()
{
	P1=0xFF;
	delay1ms(25);
	senddata(0xA4);
	cls=1;
}
Example #10
0
//*******************************************************************************************
//
// Function : arp_who_is
// Description : send arp request to destination ip, and save destination mac to dest_mac.
// call this function to find the destination mac address before send other packet.
//
//*******************************************************************************************
BYTE arp_who_is ( BYTE *rxtx_buffer, BYTE *dest_mac, BYTE *dest_ip )
{
	BYTE i;
	WORD dlength;

	// send arp request packet to network
	arp_send_request ( rxtx_buffer, dest_ip );

	for ( i=0; i<10; i++ )
	{
		// Time out 10x10ms = 100ms
		delay1ms ( 10 );
		dlength = enc28j60_packet_receive( rxtx_buffer, MAX_RXTX_BUFFER );

		// destination ip address was found on network
		if ( dlength )
		{
			if ( arp_packet_is_arp ( rxtx_buffer, (WORD_BYTES){ARP_OPCODE_REPLY_V} ) )
			{
				// copy destination mac address from arp reply packet to destination mac address
				memcpy ( dest_mac, &rxtx_buffer[ ETH_SRC_MAC_P ], sizeof(MAC_ADDR) );
				return 1;
			}
		}
	}
	
	// destination ip was not found on network
	return 0;
}
Example #11
0
/*
 * Estimate CPU frequency.  Sets mips_hpt_frequency as a side-effect
 */
static unsigned int __init estimate_cpu_frequency(void)
{
	unsigned int count;
	unsigned long flags;
	unsigned int start;

	local_irq_save(flags);

	/* Start r4k counter. */
	start = read_c0_count();

	/* delay 1 second */
	delay1ms(1000);

	count = read_c0_count() - start;

	/* restore interrupts */
	local_irq_restore(flags);

	count += 5000;    /* round */
	count -= count%10000;

	mips_hpt_frequency = count;

	/* on 34K, 2 cycles per count */
	count *= 2;

	return count;
}
Example #12
0
void DisplayVol(void)
{
	BYTE CODE *Str ;
	BYTE len;

	//#ifdef DEBUG_OSD
	//dPuts("\r\n++(DisplayVol)");
	//#endif
	
	if(( DisplayedOSD & FOSD_TVVOL ) == 0 ) {
		ClearOSDInfo();
		FOsdDefaultLUT();
		delay1ms(100);
		
		InitFOsdMenuWindow(Init_Osd_BarWindow);
	
		FOsdRamMemset(FOSDMENU_BARADDR,    0x020, BG_COLOR_CYAN | FG_COLOR_WHITE, 25 );		// Total 25*2 Char. 
		FOsdRamMemset(FOSDMENU_BARADDR+25, 0x020, BG_COLOR_WHITE | FG_COLOR_CYAN, 25 );
	
		Str = StrVolume[OSDLang];
		len=TWstrlen(Str);
		WriteStringToAddr(FOSDMENU_BARADDR, Str, len);  
	
		FOsdWinEnable(FOSDMENU_BARWIN,TRUE);
		FOsdOnOff(ON, 1);	//with vdelay 1
	}
	DisplayVolumebar(AudioVol);

	DisplayedOSD |= FOSD_TVVOL;
	OSDDisplayedTime = GetTime_ms();
}
Example #13
0
void UartPutByte(char ucData) 
{
	SBUF = ucData;
	while(!TI);
	TI = 0;	
	delay1ms(1);
}
LONG CalcRCLK()
{
	// BYTE uc ;
	int i ;
	long sum, RCLKCNT  ;

	InitCEC();
	sum = 0 ;
	for( i = 0 ; i < 5 ; i++ )
	{
		// uc = CEC_ReadI2C_Byte(0x09) & 0xFE ;
		CEC_WriteI2C_Byte(0x09, 1);
		delay1ms(100);
		CEC_WriteI2C_Byte(0x09, 0);
		RCLKCNT = CEC_ReadI2C_Byte(0x47);
		RCLKCNT <<= 8 ;
		RCLKCNT |= CEC_ReadI2C_Byte(0x46);
		RCLKCNT <<= 8 ;
		RCLKCNT |= CEC_ReadI2C_Byte(0x45);
		// HDMITX_DEBUG_PRINTF1(("RCLK = %ld\n",RCLKCNT) );
		sum += RCLKCNT ;
	}
	DisableCEC();
	RCLKCNT = sum * 32 ;
	HDMITX_DEBUG_PRINTF(("RCLK = %ld,%03ld,%03ld\n",RCLKCNT/1000000,(RCLKCNT%1000000)/1000,RCLKCNT%1000));
	return RCLKCNT ;
}
Example #15
0
// Description:
//      Send initialization/configuration bytes to the OLED controller.
//
static void __oledWriteInit(void){


    // Initialize the OLED display.
    OLED_RESET_HIGH();  // tie reset pin high
    delay1ms();         // wait for Vdd to become stable
    OLED_RESET_LOW();   // tie reset pin low
    delayxms(10);       // wait for reset
    OLED_RESET_HIGH();  // tie reset pin high

    // Send initialization commands (most of these are taken from the
    // Adafruit SSD1306 library).
    OLED_DISPLAY_OFF();         // turn off display
    OLED_CLOCK(8, 1);           // Fosc = speed 8, display clock = Fosc
    OLED_MULTIPLEX(64);         // MUX = 32
    OLED_VERTICAL_OFFSET(0);    // no vertical offset
    OLED_START_LINE(0);         // start at line 0 of RAM
    OLED_CHARGE_PUMP_ENABLE();  // enable 7.5V charge pump
    OLED_VERTICAL_MODE();       // use vertical addressing mode
    OLED_REVERSE_COLUMN();      // don't reverse column addressing
    OLED_REVERSE_ROW();         // reverse row addressing
    // Configure COM pins.
    OLED_PIN_CONFIG(OLED_DISABLE_ROW_REMAP | OLED_ALT_COM);
    OLED_CONTRAST(127);         // set contrast to 0.5
    // Period 1 = 15 DCLK, period 2 = 1 DCLK.
    OLED_PRECHARGE_PERIOD(1, 15);
    OLED_VCOMH_077VCC();        // Vcomh deselect = 0.77 * Vcc
    OLED_DISPLAY_RESUME();      // resume display
    OLED_DISPLAY_NORMAL();      // normal display mode
    OLED_DISPLAY_ON();          // turn on OLED panel
}
Example #16
0
/**
* check Video Loss
*
* @param n: wait counter
* @return
*	0:Video detected
*	1:Video not present. Video Loss
*
* register
*	R101[0]
*/ 
BYTE DecoderCheckVDLOSS( BYTE n )
{
	volatile BYTE	mode;
	BYTE start;

#ifdef DEBUG_DEC
	dPrintf("\n\rDecoderCheckVDLOSS(%d) start",(WORD)n);
#endif
	start = n;

	while (n--) {
		mode = ReadTW88(REG101);		//read Chip Status
		if (( mode & 0x80 ) == 0 ) {
#ifdef DEBUG_DEC
			dPrintf("->end%bd",start - n);
#endif
			return ( 0 );				//check video detect flag
		}
		delay1ms(10);
	}
#ifdef DEBUG_DEC
	ePrintf("\n\rDecoderCheckVDLOSS->fail");
#endif
	return ( 1 );						//fail. We loss the Video
}
Example #17
0
void delayms(unsigned int t)			   //delay milliseconds
{
	unsigned int n;

	for (n=0; n<t; n++) delay1ms();

} /*Delay*/
Example #18
0
BYTE LEDCOn(BYTE step)
{
	BYTE i;

	WriteTW88Page(PAGE0_LEDC);

	switch(step)
	{
	case 0:
		WriteTW88(REG0E0, 0x72);	//default. & disable OverVoltage
		WriteTW88(REG0E5, 0x80);	//LEDC digital output enable.
		WriteTW88(REG0E0, 0x12);	//Off OverCurrent. Disable Protection
		WriteTW88(REG0E0, 0x13);	//LEDC digital block enable
		break;
	case 1:
		WriteTW88(REG0E0, 0x11);	//Analog block powerup
		break;
	case 2:
		WriteTW88(REG0E0, 0x71);	//enable OverCurrent, enable Protection control
		break;
	//default:
	//	ePuts("\nBUG");
	//	return;
	}
	for(i=0; i < 10; i++) {
		if((ReadTW88(REG0E2) & 0x30)==0x30) {	//wait normal
			//dPrintf("\nLEDC(%bd):%bd",step,i);
			return ERR_SUCCESS;	//break;
		}
		delay1ms(2);
	}
	dPrintf("\nLEDC(%bd) FAIL",step);
	return ERR_FAIL;
}
Example #19
0
void ClearLogo(void)
{
	DECLARE_LOCAL_page
	BYTE i, j;

	ReadTW88Page(page);
	WriteTW88Page(PAGE3_FOSD );
	//=============================== Fade OUT ======================================
	for ( i=0; i<9; i++ ) {
		delay1ms(30);
		for ( j=0; j<16; j++ ) {
			WriteTW88(REG_FOSD_ALPHA_SEL, j );
			WriteTW88(FOSDWinBase[TECHWELLOGO_OSDWIN]  +1, i );
			WriteTW88(FOSDWinBase[TECHWELLOGO_OSDWIN+2]+1, i );
		}
	}
	//============ Disable window and recover Trans value ============================
	FOsdOnOff(OFF, 1);	//with vdelay 1
	FOsdWinEnable(TECHWELLOGO_OSDWIN,FALSE);
	FOsdWinEnable(TECHWELLOGO_OSDWIN+2,FALSE);
	//assume page3
	for ( j=0; j<16; j++ ) {
		WriteTW88(REG_FOSD_ALPHA_SEL, j );
		WriteTW88(FOSDWinBase[TECHWELLOGO_OSDWIN]  +1, 0 );
		WriteTW88(FOSDWinBase[TECHWELLOGO_OSDWIN+2]+1, 0 );
	}

	WriteTW88Page(page );
}
Example #20
0
//  Busy wait loop to generate a delay multiple of 100ms.
void delay100ms(unsigned int secs){
  unsigned int i,j;

  if (secs > 0) {
     for (j=0; j<=secs; j++)
        for (i=0; i<100; i++)	delay1ms(1);
  }
}
Example #21
0
void write_str(uchar *str)  
{  
 while(*str!='\0')  //未结束   
 {  
  write_data(*str++);  
  delay1ms(1);  
 }  
} 
Example #22
0
u8 KEY_Scan(void)
{
	if(!SW1)
	delay1ms(2);
	if(!SW1)
		return 1;
	else
		return 0;
}
Example #23
0
void delayms(unsigned int time)
{
    unsigned int t;

	for (t=0; t< time; t++)
	{
		delay1ms();
	}
} /* delayms */
Example #24
0
//*************************
//**********主函数*********
//*************************
void main()
{
	 Initial_com();
	 LCD_Init();
	 LCD_Write_String(0,0,"Serial:p");
	 while(1)
	 {
		 SBUF=0xff;
		 delay1ms();
		 SBUF=0xdd;
		 delay1ms();
		  if(RI)
		  {
			   date=SBUF;    //单片机接受
			   SBUF=date;    //单片机发送
			   LCD_Write_HEX(0,1,date);
			   RI=0;  //必须软件清零
		  }		
		  //LED_display();
	  }
}
Example #25
0
void MonOsdTestDDR(void)
{
	WORD i;

	OsdWriteMode( BLOCKFILL | BLT_NO | CONV_DIS | PIXEL8 | SOURCE0 );
	OsdBlockFill( 0, 0, 512, 256, 0 );

	for(i=0; i<512; i++) {
		OsdBlockFill( i, 0, 1, i+1, i );
		Printf("\nBlock Fill %d", i);
		delay1ms(50);
	}
	
}		
Example #26
0
File: Util.c Project: lgnq/tw8836
void I2CDeviceInitialize(BYTE *RegSet, BYTE delay)
{
	int	cnt=0;
	BYTE addr, index, val;
	WORD w_page=0;
//	BYTE speed;

	addr = *RegSet;
#ifdef DEBUG_TW88
	dPrintf("\nI2C address : %02bx", addr);
#endif
	cnt = *(RegSet+1);	//ignore cnt
	RegSet+=2;

//	if(addr)
//		speed = SetI2CSpeed(I2C_SPEED_SLOW);


	while (( RegSet[0] != 0xFF ) || ( RegSet[1]!= 0xFF )) {			// 0xff, 0xff is end of data
		index = *RegSet;
		val = *(RegSet+1);

		if ( addr == 0 ) {
			if(index==0xFF) {
				w_page=val << 8;
			}
			else {
				WriteTW88(w_page+index, val);
			}
		}
		else
			WriteI2CByte(addr, index, val);

		if(delay)
			delay1ms(delay);
#ifdef DEBUG_TW88
		dPrintf("\n    addr=%02x  index=%03x   val=%02x", (WORD)addr, w_page | index, (WORD)val );
#endif
		RegSet+=2;
	}

//	if(addr)
//		SetI2CSpeed(speed);
															   
}
Example #27
0
BYTE DCDC_On(BYTE step)
{
	BYTE i;

//	dPrintf("\nDCDC_On(%bx)",step);

	//-------------
	//DCDC ON
	WriteTW88Page(PAGE0_DCDC);
	switch(step) {
	case 0:
#if 0
		WriteTW88(REG0E8, 0x72);	//default. & disable OverVoltage
		WriteTW88(REG0E8, 0x12);	//disable OverCurrent, disable UnderCurrent
		WriteTW88(REG0E8, 0x13);	//enable DC convert digital block
#endif
		WriteTW88(REG0E8, 0xF2);	//Printf("\nREG0E8:F2[%bd]",ReadTW88(REG0EA)>>4);
		WriteTW88(REG0E8, 0x02);	//Printf("\nREG0E8:02[%bd]",ReadTW88(REG0EA)>>4);
		WriteTW88(REG0E8, 0x03);	//Printf("\nREG0E8:03[%bd]",ReadTW88(REG0EA)>>4);
		WriteTW88(REG0E8, 0x01);	//Printf("\nREG0E8:01[%bd]",ReadTW88(REG0EA)>>4);
		break;
	case 1:
		WriteTW88(REG0E8, 0x11);	//powerup DC sense block
		break;
	case 2:
		WriteTW88(REG0E8, 0x71);	//turn on under current feedback control
									//0x11->0x51->0x71
		break;
	//default:
	//	ePuts("\nBUG");
	//	return;
	}
	for(i=0; i < 10; i++) {
		if((ReadTW88(REG0EA) & 0x30)==0x30) {
			//dPrintf("\nDCDC(%bd):%bd",step,i);
			return ERR_SUCCESS;	//break;
		}
		delay1ms(2);
	}
//	Printf("\nDCDC_On(%bd) FAIL",step);
	return ERR_FAIL;
}
Example #28
0
/**
* check Video Loss
*
* register
*	R101[0]
*
* oldname: CheckDecoderVDLOSS().
*
* @param n: wait counter
* @return
*	0:Video detected
*	1:Video not present. Video Loss
*/ 
BYTE DecoderCheckVDLOSS( BYTE n )
{
	volatile BYTE	mode;
	BYTE start;

	dPrintf("\nDecoderCheckVDLOSS(%d) start",(WORD)n);
	start = n;

	WriteTW88Page(PAGE1_DECODER );
	while (n--) {
		mode = ReadTW88(REG101);		//read Chip Status
		if (( mode & 0x80 ) == 0 ) {
			dPrintf("->end%bd",start - n);
			return ( 0 );				//check video detect flag
		}
		delay1ms(10);
	}
	ePrintf("\nDecoderCheckVDLOSS->fail");
	return ( 1 );						//fail. We loss the Video
}
Example #29
0
/******************************完成一次转换********************************
* 函  数:u16 One_Change(void);
* 功  能:控制DS18B20完成一次温度转换
* 参  数:无
* 返回值:无
* 更  新:无
* 备  注:无
若要读出当前的温度数据我们需要执行两次工作周期,
第一个周期为复位、跳过ROM指令(0xCC)、
执行温度转换存储器操作指令(0x44)、
等待500uS温度转换时间。
紧接着执行第二个周期为复位、
跳过ROM指令(0xCC)、执行读RAM的存储器操作指令(0xBE)、
读数据(最多为9个字节,中途可停止,只读简单温度值则读前2个字节即可)。
****************************************************************************/
extern u16 One_Change(void)
{
    ErrorStatus i;
    do
    {
        i = Init_18B20();
    }while(!i);

    Skip_ID();//跳过ROM指令
    Change();//执行温度转换存储器操作指令
    delay1ms(10);

    do
    {
        i = Init_18B20();
    }while(!i);
    Skip_ID();//跳过ROM指令
    Read_Ram();
    return (Tmp_Get());
}
Example #30
0
/**
* check detected decoder video input standard
*
*	To get a stable the correct REG11C[6:4] value,
*		read REG101[6] and REG130[7:5] also.
*	I saw the following values(BK110303)
* 		E7 E7 67 67 87 87 87 87 ..... 87 87 87 87 87 87 87 87 87 07 07 07 .... 
* 		B7 B7 B7 37 37 87 87 87 ..... 87 87 87 87 87 87 87 87 87 07 07 07 07 07 07 07
*
* oldname: CheckDecoderSTD
*
* register
*	R11C[6:4].
* 	R101[6].
*	R130[7:5].
* @return
*	0x80: filed.
*	other: detected standard value.
*/
BYTE DecoderCheckSTD( BYTE n )
{
	volatile BYTE	r11c,r101,r130;
	BYTE start=n;
	BYTE count;
#ifdef DEBUG_DEC
	ePrintf("\n\rDecoderCheckSTD(%d) start",(WORD)n);
#endif
	
	count=0;
	while (n--) {
		r11c = ReadTW88(REG11C);
		if (( r11c & 0x80 ) == 0 ) {
			r101 = ReadTW88(REG101);
			r130 = ReadTW88(REG130);
#ifdef DEBUG_DEC
			dPrintf("\n\r%02bx:%02bx-%02bx-%02bx ",start-n, r11c, r101,r130);
#endif
			if((r101 & 0x40) && ((r130 & 0xE0)==0)) {
#ifdef DEBUG_DEC
				ePrintf("->success:%d",(WORD)start-n);
#endif
				if(count > 4)
					return (r11c);
				count++;
			}
 		}
		delay1ms(5);
	}
#ifdef DEBUG_DEC
	ePrintf("->fail");
#endif

	//This is only for pattern generator.
	if((r101 & 0xC1) == 0x41) //PAL ? 
		return (r11c);

	return ( 0x80 );
}