⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 scaler.c

📁 台湾联咏NT68663 LCD MONITOR 控制程序(完整版)
💻 C
📖 第 1 页 / 共 4 页
字号:
#include "STDIO.H"
#include "MATH.H"
#include "MYDEF.H"
#include "Scaler.H"
#include "MCU.H"
#include "USERADJ.H"
#include "F63XREG.H"
#include "F63XDEF.H"
#include "IIC.H"
#include "PANEL.H"
#include "RAM.H"
#include "ROM_MAP.H"
#include "OSD.H"
#include "sRGB.H"

#if PanelDepth == 6
	#define DisplayColorDepth 0xff
	#define DT158 PanelDethMode
#else
	#define DisplayColorDepth 0x00
	#define DT158 PanelDethMode
#endif

#if PanelTwoPixelPerClk == 1
	#define DisplayBusWidth 0x00
#else
	#define DisplayBusWidth 0xff
#endif

#if PanelSync_DE == 1
	#define DisplaySyncMode 0xff
#else
	#define DisplaySyncMode 0x00
#endif
#if PANEL == FLC48SXC8V_10 || PANEL == FUJ_FLC43XWC8V|| PANEL == Sharp_FG170M1LA04//nam0329
	#define DisplayControl (0xe1 | (DisplayColorDepth & BIT_3) | (DisplayBusWidth & BIT_2) | (DisplaySyncMode & BIT_1))
#else
	#define DisplayControl (0x61 | (DisplayColorDepth & BIT_3) | (DisplayBusWidth & BIT_2) | (DisplaySyncMode & BIT_1))
#endif

#define DT155 (unsigned char)PanelPadDrive
#define DT156 (unsigned char)(PanelPadDrive >> 8)|((~Panel_Invert_DVS & BIT_4) | (~Panel_Invert_DHS & BIT_5) | (~Panel_Invert_DCLK & BIT_6) | (~Panel_Invert_DEN & BIT_7))
#define DT61 ((Panel_Invert_DVS & BIT_0) | (Panel_Invert_DHS & BIT_1) | (Panel_Invert_DCLK & BIT_2) | (Panel_Invert_DEN & BIT_3))

code unsigned short H_ActiveTab[]={
	640,720,640,720,640,848,800,832,1024,1152,1152,1152,1280,1280,1600,1280,1280,756
};
code unsigned short V_ActiveTab[]={
	350,350,400,400,480,480,600,624,768,864,870,900,960,1024,1200,720,768, 574
};

code unsigned char TCON_Tab[]={
// CPT_M170
/*	
	0x00,0x63,0x22,0x00,0x88,0x4a,0x12,0x00,0x10,0x80,0x02,0x00,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	// OE
	0x01,0x00,0x02,0x04,0xa0,0x04,0x20,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	// CKV
	0x01,0x00,0x02,0x04,0xc0,0x04,0xff,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	// STV
	0x01,0x00,0x02,0x00,0x80,0x02,0x80,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	// POL
	0x01,0x00,0x01,0x00,0x00,0x02,0x00,0x02,0x02,0x10,0x00,0x00,0x00,0x00,0x00,0x00,
	// TP
	0x01,0x00,0x02,0x04,0x0c,0x05,0x14,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
*/
// AU_M170ES05

	0x00,0x63,0x22,0x00,0x88,0x8f,0x00,0x07,0x13,0x80,0x02,0x00,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	// OE
	0x01,0x00,0x01,0x00,0xe0,0x03,0x14,0x05,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	// CKV
	0x01,0x00,0x01,0x00,0x00,0x04,0x14,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	// STV
	0x01,0x00,0x02,0x00,0x80,0x02,0x80,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	// POL
	0x01,0x00,0x01,0x00,0x00,0x02,0x00,0x02,0x02,0x50,0x00,0x00,0x00,0x00,0x00,0x00,
	// TP
	0x01,0x00,0x02,0x04,0x0c,0x05,0x14,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

// CMO_M170ES05
/*
	0x00,0x63,0x22,0x00,0x88,0x83,0x00,0x00,0x10,0x80,0x02,0x00,0x00,0x00,0x00,0x00,
	// OE
	0x01,0x00,0x02,0x04,0xbc,0x04,0x44,0x04,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	// CKV
	0x01,0x00,0x01,0x00,0xa0,0x04,0x20,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	// STV
	0x01,0x00,0x02,0x00,0x00,0x02,0xff,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	// POL
	0x01,0x00,0x01,0x00,0x80,0x02,0x80,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	// TP
	0x01,0x00,0x02,0x04,0x0c,0x05,0x14,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	//GVON
	0x01,0x00,0x02,0x04,0x30,0x03,0xc0,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	//GVOFF
	0x01,0x00,0x02,0x04,0x30,0x03,0xc0,0x04,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	// STV
	0x01,0x00,0x02,0x00,0x00,0x02,0xff,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,
*/
};

void UpdatePresetData(void)
{
code unsigned short UpdateSquenceTable[]={
	0x002,0x005,0x008,
	0x020,0x023,0x025,0x026,0x027,
	0x02e,0x02f,0x030,0x031,
	0x032,0x033,0x034,0x035,0x036,0x037,
	0x060,0x064,0x065,0x066,
	0x154,0x156,0x157,0x158,0x16a,0x16e,0x186,0x18d,0x1f1
};

code unsigned char D1024x768[]={
//  0x002,	0x005,	0x008,
	0x01,	0x01,	0x00,
//  0x020,	0x023,	0x025,	0x026,	0x027,
	0x81,	0x00,	0x00,	0x80,	0x11,
#if DVImode == DEmode
//	0x02e,	0x02f,	0x030,	0x031,
	0xe0,	0x01,	0xe0,	0x01,
#else
//	0x02e,	0x02f,	0x030,	0x031,
	0x20,	0x00,	0x00,	0x00,
#endif
//	0x032,	0x033,	0x034,	0x035,	0x036,	0x037,
	0xe0,	0x01,	0x88,	0x00,	0x80,	0x02,
//	0x060,	0x064,	0x065,	0x066,
	0x00,	0x00,	0x00,	0x00,
//	0x154,	0x156,	0x157,	0x158,	0x16a,	0x16e,	0x186,	0x18d,	0x1f1
	0x00,	DT156,	0x40,	DT158,	DT16A,	0x06,	0x00,	0x00, 	0x15
};

unsigned char i;
	for(i=0; i<31; i++){
		WriteIIC563(UpdateSquenceTable[i],D1024x768[i]);
	}
}

void InitScaler(void)
{
unsigned char i;

code unsigned short InitTab[43][2]={
	{0x15B,(unsigned char)PanelTypVTotal},{0x15C,(unsigned char)(PanelTypVTotal>>8)}, // Display Vtotal
	{0x15D,(unsigned char)PanelMinVSyncWidth}, // Display V Pulse Width
	{0x162,(unsigned char)PanelVActiveStart},{0x163,(unsigned char)(PanelVActiveStart>>8)}, // Display Background Window VBegin
	{0x164,(unsigned char)PanelHeight},{0x165,(unsigned char)(PanelHeight>>8)}, // Display Background Window VLength
	{0x16f,(unsigned char)PanelVActiveStart},{0x170,(unsigned char)(PanelVActiveStart>>8)}, // Display Active VBegin
	{0x171,(unsigned char)PanelHeight},{0x172,(unsigned char)(PanelHeight>>8)}, // Display VActive

	{0x15E,(unsigned char)PanelMinHTotal},{0x15F,(unsigned char)(PanelMinHTotal>>8)}, // Display Htotal
	{0x160,(unsigned char)PanelMinHSyncWidth}, // Display H Pulse Width
	{0x166,(unsigned char)PanelHActiveStart},{0x167,(unsigned char)(PanelHActiveStart>>8)}, // Display Background Window HBegin
	{0x168,(unsigned char)PanelWidth},{0x169,(unsigned char)(PanelWidth>>8)}, // Display  Backgroun Window HWidth
	{0x173,(unsigned char)PanelHActiveStart},{0x174,(unsigned char)(PanelHActiveStart>>8)}, // Display Active HBegin
	{0x175,(unsigned char)PanelWidth},{0x176,(unsigned char)(PanelWidth>>8)}, // Display HActive
	{0x070,0x08}, // VSO output
	{0x072,0x00}, // Sync Processor Ctrl: Bypass Sync Control
	{0x196,0x14}, // Sync Processor Ctrl: Select Raw_hs
	{0x197,0x82}, // Sync Processor Ctrl2
	{0x021,0x0c}, // Clamp Pulse
	{0x022,0x83},
	{0x012,0x00}, // SOG Slicer Ctrl
	{0x18e,0x03}, //Clear FIFO interrupt 
	{0x18f,0x00}, //Disable FIFO interrupt
	{0x1a3,0x2d}, //Hsync not present 
	{0x1a4,0x2d}, //Hsync present
	{0x1a5,0x2d}, //Vsync not present
	{0x1a6,0x2d}, //Vsync present
	{0x1a7,0x08}, //Hcounter change threshold
	{0x1a8,0x24}, //Vcounter change threshold
	{0x1a9,0x3c}, // H/V interrupt enable1
	{0x1aa,0x00}, // H/V interrupt enable2
	{0x1ab,0x2f}, // H/V interrupt clear1
	{0x1ac,0x1f}, // H/V interrupt clear2
	{0x1d8,0x0a}, // sRGB static dither mode control
	{0x199,0x01}, //Graphic Filed control
};

	#if PRINT_MESSAGE
		printf("Init NT68563\r\n");
	#endif
	TCONInit();

	for(i=0;i<43;i++){
		WriteIIC563(InitTab[i][0],InitTab[i][1]);
	}
	UpdatePresetData();
	SetInterface();
	WriteIIC563(0x00e,0xff);
//	WriteIIC563(0x0f4,0x80);
	WriteIIC563(0x150,DisplayControl);
	WriteIIC563(0x154,0x02);
//Noise reduction
	//Noise reduction
	WriteIIC563(0x068,0x7a);
	WriteIIC563(0x069,0x43);
	WriteIIC563(0x06a,0xd2);
	WriteIIC563(0x06b,0x03);
//OSD blink control
	WriteIIC563(0x0a0,0x12);
//LVDS bandwidth
	WriteIIC563(0x1f5,0x06);
	WriteIIC563(0x1f6,0x06);
	WriteIIC563(0x1f7,0xc0);
//LVDS differential voltage
	WriteIIC563(0x1b8,0x10);
// For ADCclock duty control jacky 20040607
	WriteIIC563(0x0dc,0x50);
//----------------------------- 
// For Vsync output jacky 20040605
	//WriteIIC563(0x208,0x10);
	//WriteIIC563(0x1b9,0x31);
	//Sleep(20);
	if(PanelInterface != TCON_TO_RSDS && PanelInterface != TCON_TO_TTL)
		WriteIIC563(0x1b9,0x30);
	else
		WriteIIC563(0x1b9,0x31);
//-----------------------------	
// For DVI bandwidth setting jacky 20040607
	WriteIIC563(0x018,0x02);	//DVI DPLL FSM mode select
	WriteIIC563(0x019,0x03);	//DVI DPLL FSM mode select
	WriteIIC563(0x01d,0x1f);	//DVI bandwidth
	WriteIIC563(0x01e,0xb8);
	WriteIIC563(0x146,0xf3);
//----------------------------- 
// For ADC R/G/B phase delay jacky 20040629
	WriteIIC563(0x0d9,0x00);
	WriteIIC563(0x0da,0x00);
	WriteIIC563(0x0d9,0x40);
	WriteIIC563(0x0da,0x01);
	WriteIIC563(0x0d9,0x80);
	WriteIIC563(0x0da,0x00);
// For TQFP 64 pin channel swap jacky 20050121
	//WriteIIC563(0x1f4,0x04);
//----------------------------- 
// For HPLL Line counter set and initial
	WriteIIC563(0x0db,0x0c);
	WriteIIC563(0x0d5,0x01);
//----------------------------- 
// For Fastmute
	WriteIIC563(0x159,0xa0);
	WriteIIC563(0x1af,0x0a);
	#if PRINT_MESSAGE
		printf(PanelName);
	#endif
}


void TCONInit(void)
{
unsigned char i;//,j;
#if PanelUxga == 1
		SetDPLL(165000000);
	
#elif PanelSxga == 1
		SetDPLL(100000000);
		//WriteIIC563(0x0f1,0x10);	//103MHz
#else
		SetDPLL(50000000);
		//WriteIIC563(0x0f1,0x11);	//51.5MHz
#endif
	//WriteIIC563(0x0f2,0xaa);
	//WriteIIC563(0x0f3,0x2a);
	//WriteIIC563(0x0f4,0x11);
	//WriteIIC563(0x0f0,0x03);


#if PanelInterface == TCON_TO_RSDS || PanelInterface == TCON_TO_TTL
	
	if(PanelInterface == TCON_TO_RSDS || PanelInterface == TCON_TO_TTL)
		{
		WriteIIC563(0x0FF,0x02); // page2 enable
		#if PRINT_MESSAGE
			printf("TCON Init\r\n");
		#endif
		for(i=0; i<0x70; i=i+16)
			WritePage563(i,i,TCON_Tab);
		for(i=0x70; i<0x7b; i++)
			WriteIIC(SCALER_ADDR,i,TCON_Tab[i]);
		for(i=0x80; i<0xa0; i=i+16)
			WritePage563(i,i,TCON_Tab);
		WriteIIC563(0x0FF,0x00); // page1 disable
		WriteIIC563(0x2d0,0xb5); // Deflicker control
		
		}
#endif

#if Panel_Spread_Spect_En == 0xff
	i = (PanelSpreadSpectrumCtrl << 1) | BIT_0;
	WriteIIC563(0x0f5,i);
#endif
}

#if PanelInterface == TCON_TO_RSDS || PanelInterface == TCON_TO_TTL
void WritePage563(unsigned char addr1,unsigned char addr2,unsigned char *p)
{
unsigned char i,ch;
	IIC_Start();
	IIC_Tx(SCALER_ADDR);
	IIC_Tx(addr1);
	for(i=0; i<16; i++){
		ch = p[addr2 + i];
		IIC_Tx(ch);
	}
	IIC_Stop();
}
#endif

#if PanelInterface == TCON_TO_RSDS || PanelInterface == TCON_TO_TTL
void WritePage563(unsigned char addr1,unsigned char addr2,unsigned char *p)
{
unsigned char i,ch;
	IIC_Start();
	IIC_Tx(SCALER_ADDR);
	IIC_Tx(addr1);
	for(i=0; i<16; i++){
		ch = p[addr2 + i];
		IIC_Tx(ch);
	}
	IIC_Stop();
}
#endif

void SetADC_Phase(void)
{
	WriteIIC563(0x0d9,FuncBuf[pPHASE]);
	#if PRINT_MESSAGE
		printf("Phase = %d\r\n",(unsigned short)FuncBuf[pPHASE]);
	#endif
}

void CheckFreqRange(Byte Pixel)
{
	OutOfRange = 0;		
	if((H_SYNC > H_Max)||(H_SYNC < H_Min))
		//OutOfRange = 1;	
		OutOfRange = 2;	// Jacky 0918
	if((V_SYNC > V_Max)||(V_SYNC < V_Min))
		//OutOfRange = 1;	
		OutOfRange = 2;	// Jacky 0918		
//	if((H_SYNC > H_HI)||(H_SYNC < H_LO))
//		OutOfRange = 2;	
//	if((V_SYNC > V_HI)||(V_SYNC < V_LO))
//		OutOfRange = 2;		
//	if(Vresolution == 960)
//		OutOfRange = 2; 	
	#ifdef X21
	if((Pixel > P_Max) || (Hresolution > 1600))
	//if((Pixel > P_Max) || (Hresolution > 1280))
	#endif
	#ifdef X19
	if((Pixel > P_Max) || (Hresolution > 1280))
	#endif
	#ifdef X17
	if((Pixel > P_Max) || (Hresolution > 1280))
	//if(Pixel > P_Max)
	#endif
	#ifdef X15
	if((Pixel > P_Max) || (Hresolution > 1280))
	#endif
		OutOfRange = 2;		
}
#if 1
void SetADC_PLL(void)
{
	Byte code DpllSeqTab[4]={100,50,20,0};
	unsigned long PixelRate, LineCounter;//,H_Counter
	Byte ch,k;
	float temp;

	PixelRate = ((unsigned long)FuncBuf[pCLOCK] * H_SYNC)/10000;
	ch = (unsigned char)PixelRate;
	WriteIIC563(0x0d0,0x23);
	CheckFreqRange(ch);
	//----------------------------------
	if(ForceToBack == 0){
		k = ReadIIC563(0x0d1);
		k &= 0x03;
	}
	else{
		for(k=0;k<4;k++)
			if(ch > DpllSeqTab[k])
				break;
		WriteIIC563(0x0d1,0x10+k);
	}
	#if PRINT_MESSAGE
		printf("Htotal = %d\r\n",FuncBuf[pCLOCK]);
		printf("PixelRate = %d MHz\r\n",(unsigned short)PixelRate);
	#endif
	//WriteIIC563(0x0d6,0xa0);
	WriteIIC563(0x0d6,0xc0);
//	if(H_SYNC < 240){
		WriteIIC563(0x0db,0x0c);
		LineCounter = 4096;	//
//	}
//	else if(H_SYNC < 480){
//		WriteIIC563(0x0db,0x0d);
//		LineCounter = 8192;
//	}
//	else{
//		WriteIIC563(0x0db,0x0e);
//		LineCounter = 16384;
//	}
	if(SyncMode == 3)	//DVI
	{
		ch = ReadIIC563(0x102);
		WriteIIC563(0x102,ch|BIT_5);
		Sleep(5);
		WriteIIC563(0x102,ch);
		//Sleep(20);
	}
		
	if(ForceToBack != 0)
	{
		WriteIIC563(0x0d5,0x01);
		H_Counter = 0;
		if(SyncMode == 3 && (ReadIIC563(0x19a) & BIT_3) ==0x00 ){	// Jacky 20050916 for DVI DEmode, and H non-present
			PixelRate = ReadWordIIC563(0x19b) & 0x1fff;
			if((PixelRate == 0x1fff)||(PixelRate == 0)){
				H_SYNC_Temp = 0xffff;
			}
			else{
			    H_Counter = PixelRate * 512;
			}
		}
		else{
			LocalTimer = 25;
			while(LocalTimer > 0)
			{
				ch = ReadIIC563(0x0df) & 0x3f;
				PixelRate = ch;
				PixelRate <<= 8;
				ch = ReadIIC563(0x0de);
				PixelRate += ch;
				PixelRate <<= 8;
				ch = ReadIIC563(0x0dd);
				PixelRate += ch;
				if(abs(PixelRate - H_Counter) > 2)
				{
					H_Counter = PixelRate;
					LocalTimer = 25;
				}
				if(DetectBacklight())	//waiting for pll stable
					break;
			}
		}
		
		//temp = ((float)FuncBuf[pCLOCK] * 536870912) / PixelRate;
		temp = ((float)FuncBuf[pCLOCK] * 131072 * LineCounter) / PixelRate;
		PixelRate = temp;
		#if PRINT_MESSAGE
			printf("DSS = %x %x\r\n",(unsigned short)(PixelRate>>16),(unsigned short)PixelRate);
		#endif
		for(k; k>0; k--)
			PixelRate <<= 1;
		WriteIIC563(0x0d2,(unsigned char)PixelRate);
		WriteIIC563(0x0d3,(unsigned char)(PixelRate>>8));
		WriteIIC563(0x0d4,(unsigned char)(PixelRate>>16));
	}
	
	WriteIIC563(0x0d7,(Byte)FuncBuf[pCLOCK]);
	WriteIIC563(0x0d8,(Byte)(FuncBuf[pCLOCK]>>8));
	if((SyncMode == 1)||(SyncMode == 2)||(SyncMode == 5)||(SyncMode == 6)){ //H+V SOG
		WriteIIC563(0x0d5,0x09);
	}
	else{
	#if 0
		if((HV_Pol & BIT_4) == 0)
			WriteIIC563(0x0d5,0x03&(~BIT_3));
		else
			WriteIIC563(0x0d5,0x03|BIT_3);
	#else
		WriteIIC563(0x0d5,0x0b);
	#endif
	}
}
#else
void SetADC_PLL(void)
{
	//Byte code PixelTab[]={40,64,106,200};
	Byte code DpllSeqTab[4]={100,50,20,0};
	unsigned long PixelRate,H_Counter;
	//Word addr;
	Byte ch,k;
	float temp;
/*
	if(SyncMode > 0)	//composite & SOG mode
		{
		PixelRate = ((unsigned long)FuncBuf[pCLOCK] * H_SYNC)/10000;
		addr = FuncBuf[pCLOCK] - 1;
		WriteIIC563(0x00b,(unsigned char)addr);		//pll msb
		ch = addr >> 8;
		WriteIIC563(0x00a,ch);		//pll lsb
		ch = (unsigned char)PixelRate;
		CheckFreqRange(ch);
		for(i=0;i<4;i++)
			if(PixelTab[i] > ch)
				{
				k = i<<6;
				break;
				}
		if(ch < 75)
			k |= 0x0f;	//pll charge pump
		else
			k |= 0x2f;
		#if PRINT_MESSAGE
			printf("Htotal = %d\n",FuncBuf[pCLOCK]);
			printf("PixelRate = %d MHz\n",(unsigned short)PixelRate);
			printf("VCO Range = %x\n",(unsigned short)k);
		#endif
		WriteIIC563(0x00d,k);
		}
*/
/*
	else		//seperate mode
		{
*/
	PixelRate = ((unsigned long)FuncBuf[pCLOCK] * H_SYNC)/10000;
	ch = (unsigned char)PixelRate;
	WriteIIC563(0x0d0,0x23);
	CheckFreqRange(ch);
	//Jacky 20040910 for DVI pll bandwidth
	if(SyncMode == 3)
	{
		if(ch > 100)
			WriteIIC563(0x01d,0x01);
		else
			WriteIIC563(0x01d,0x1f);
	}
	//----------------------------------
	if(ForceToBack == 0){
		k = ReadIIC563(0x0d1);
		k &= 0x03;
	}
	else{
		for(k=0;k<4;k++)
			if(ch > DpllSeqTab[k])
				break;
		WriteIIC563(0x0d1,0x10+k);
	}
	#if PRINT_MESSAGE
		printf("Htotal = %d\r\n",FuncBuf[pCLOCK]);
		printf("PixelRate = %d MHz\r\n",(unsigned short)PixelRate);
	#endif
	//WriteIIC563(0x0d5,0x07);
	WriteIIC563(0x0d6,0xa0);
	WriteIIC563(0x0db,0x0c);
		
	if(ForceToBack == 0){
/*

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -