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

📄 init.c

📁 CRT显示器的运行程序
💻 C
📖 第 1 页 / 共 2 页
字号:

void Init_MTV021(void)
{
     BYTE idata i,mm;
     GoI2CMaster(0x7A);           //================================//
     SendI2CByte(0x8F);           //      row 15 of osd ic          //
     SendI2CByte(0x0F);           //================================//
     SendI2CByte(0x40);           // column 15 resolution of        //
             		              // a horizontal display line      //
             		              //================================//                                                      
     SendI2CByte(0x10);           // column 16 row to row spacing   //                                    
     SendI2CByte(0x00);           // in unit of horizontal line     //
                         		  //================================//
     SendI2CByte(0x11);           //          column 17             //
     SendI2CByte(0x80);           //     OSDEN,BSEN,SHADOW,FAN      //          
                                  //   BLANK,WENCLR,RAMCLR,FBKGC    //
                           		  //================================//
     SendI2CByte(0x12);           //          column 18             //
     SendI2CByte(0xf1);           //   TRIC,FBKGP,PWMCK,SELVCL      //   
                           		  //     HSP,VSP,VCO1,VCO0 (0xD2)   //
                           		  //================================//
     SendI2CByte(0x13);           // color of shadwing windos & the //
     SendI2CByte(0x00);           // color of bordering on character//          
                           		  //===================================//     
     SendI2CByte(0x14);           //CFONT Enable 16 multi-color font   //
     SendI2CByte(0x01);           //UFONT Enable 8 user programma font //
                          		  //===================================//    
     SendI2CByte(0x0c);           //Vertical position   //
     SendI2CByte(0x20);           
     SendI2CByte(0x0d);           //horizontal position                //
     SendI2CByte(0x20);         
			                      //===========window1==================//
     SendI2CByte(0x00);           //column0 //
     SendI2CByte(0x0f);              //row start address and row end address //	 
     SendI2CByte(0x01);           //column1 //
     SendI2CByte(0x00);           //column start address and WEN WSHD// 
     SendI2CByte(0x02);           //column2 //
     SendI2CByte(0x01);           //column end address and RGB//	 
                          		  //===========window2==================//
     SendI2CByte(0x03);           //column3 //
     SendI2CByte(0x0f);           //row start address and row end address //	 
     SendI2CByte(0x04);           //column4 //
     SendI2CByte(0x00);           //column start address and WEN WSHD//
     SendI2CByte(0x05);           //column5 //
     SendI2CByte(0x01);           //column end address and RGB//
                                  //===========window3==================//
     SendI2CByte(0x06);           //column6 //
     SendI2CByte(0x0f);           //row start address and row end address //	  
     SendI2CByte(0x07);           //column7 //
     SendI2CByte(0x00);           //column start address and WEN WSHD//
     SendI2CByte(0x08);           //column8//
     SendI2CByte(0x01);           //column end address and RGB// 
                             	  //===========window4==================//
     SendI2CByte(0x09);           //column9//
     SendI2CByte(0x0f);           //row start address and row end address //	 	 
     SendI2CByte(0x0a);           //column10//
     SendI2CByte(0x00);           //column start address and WEN WSHD//
     SendI2CByte(0x0b);           //column11//
     SendI2CByte(0x01);           //column end address and RGB//
     SendI2CStop();     
     GoI2CMaster(0x7A);
     for(i=0;i<=14;i++)
     { 
        SendI2CByte(0x80+i);
        SendI2CByte(0x1e);
        SendI2CByte(0x00); 
	  	for(mm=0;mm<=0x1e;mm++)
		{
			SendI2CByte(0x80+i);
			SendI2CByte(mm);
	              SendI2CByte(0x00);
			SendI2CByte(0xa0+i);
			SendI2CByte(mm);
                     SendI2CByte(0x00);
		}
	 }
     SendI2CStop();   
	 return;
}  

#ifdef INIT_DDC_DATA
unsigned char code edid_data[128]={
0x00,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x0a,0x85,0x10,0x79,0x09,0x00,0x00,0x00,
0x0a,0x0b,0x01,0x02,0x68,0x20,0x18,0x7e,0xea,0xbb,0xbb,0xa3,0x52,0x46,0x98,0x24,
0x0f,0x48,0x4b,0x24,0x4a,0x00,0x31,0xca,0x45,0x59,0x61,0x59,0x81,0x80,0x31,0x59,
0x01,0x01,0x01,0x01,0x01,0x01,0xea,0x24,0x00,0x60,0x41,0x00,0x28,0x30,0x30,0x60,
0x13,0x00,0x36,0xe6,0x10,0x00,0x00,0x1e,0x00,0x00,0x00,0xfc,0x00,0x42,0x69,0x67,
0x74,0x69,0x64,0x65,0x2d,0x43,0x4d,0x31,0x37,0x37,0x00,0x00,0x00,0xfc,0x00,0x30,
0x4d,0x4b,0x2d,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x39,0x0a,0x00,0xfc,
0x00,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x39,0x0a,0x20,0x20,0x00,0x4d
};
#endif

//EEPROM中无明确意义的用该组数据初始化
unsigned char code Eeprom_Init_Data[16]={
    0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

//系统的显示模式辅助参数
unsigned char code EepInitData_ModeSub[4]={
    0xff,0xff,0x80,0x80};
//与显示模式无关的参数的默认数据
unsigned char code EepInitData_Mode_Norelation[8]={
    0xcc,0xcc,0x80,0x80,0x80,0x00,0x00,0x80};
//系统配置参数和初始化标志
//unsigned char code EepInitData_SysConfig[4]={0xe1,0x00,0x0a,0x69};






//	功能:进行EEPROM的初始化,首先要判断该EEPROM是否被初始化过
      
void Init_Eeprom(void)
{
	unsigned char data i,j,k,check_data;
	
	for (j=0;j<2;j++)  {
		if (!Flg_Init_Eeprom)  {
			check_data=0;
			for (i=0;i<20;i++)	{
				eepByteIn(eepInitFlag);
				check_data=eepByteIn(eepInitFlag);
				if (check_data==0x69)  break;
				else {check_data=0; continue;}
				}
		if (i!=20)	return;
		}
        #ifdef INIT_DDC_DATA
           //	将默认的EDID数据写入第0页的前128字节
              for(k=0;k<128;k++){
	                             eepByteOut(eepEDID+i,edid_data[i]);
                                }		
        #endif
              
       //将存放10个工厂预置模式的10个与显示模式相关的参数,共占90个字节
     for (i=0;i<10;i++) {
	 	           eepByteOut(eepFModeRelPar+i*9,0x80);
                         eepByteOut(eepFModeRelPar+i*9+1,0x80);
                         eepByteOut(eepFModeRelPar+i*9+2,0x80);
                         eepByteOut(eepFModeRelPar+i*9+3,0x80);
                         eepByteOut(eepFModeRelPar+i*9+4,0x80);
                         eepByteOut(eepFModeRelPar+i*9+5,0x80);
                         eepByteOut(eepFModeRelPar+i*9+6,0x80);
                         eepByteOut(eepFModeRelPar+i*9+7,0x80);
                         eepByteOut(eepFModeRelPar+i*9+8,0x80);
                         }

  
//将存放10个用户预制模式的10个与显示模式相关的参数,共占90个字节
     for (i=0;i<10;i++) {
	 	           eepByteOut(eepUModeRelPar+i*9,0x80);
                         eepByteOut(eepUModeRelPar+i*9+1,0x80);
                         eepByteOut(eepUModeRelPar+i*9+2,0x80);
                         eepByteOut(eepUModeRelPar+i*9+3,0x80);
                         eepByteOut(eepUModeRelPar+i*9+4,0x80);
                         eepByteOut(eepUModeRelPar+i*9+5,0x80);
                         eepByteOut(eepUModeRelPar+i*9+6,0x80);
                         eepByteOut(eepUModeRelPar+i*9+7,0x80);
                         eepByteOut(eepUModeRelPar+i*9+8,0x80);
                         }
//
  

//	初始化显示模式的特征参数,包括水平及垂直同步信号频率,及行场同步的极性(工厂预制模式)
    for (i=0;i<10;i++) {
                        eepByteOut(eepFSyncAttr+i*3,0x00);
                        eepByteOut(eepFSyncAttr+i*3+1,0x00);
                        eepByteOut(eepFSyncAttr+i*3+2,0x00);
                        }
//	初始化显示模式的特征参数,包括水平及垂直同步信号频率,及行场同步的极性(用户预制模式)
    for (i=0;i<10;i++) {eepByteOut(eepUserSyncAttr+i*3,0x00);
                        eepByteOut(eepUserSyncAttr+i*3+1,0x00);
                        eepByteOut(eepUserSyncAttr+i*3+2,0x00);
                        }
	
//	初始化色温参数区
	for (i=0;i<15;i++)  eepByteOut(eepColorPar+i,0x80);
	
//	初始化显示模式无关参数区(工厂设置区和用户设置区)
    for(i=0;i<7;i++) eepByteOut(eepFModeNoRelPar+i,EepInitData_Mode_Norelation[i]);

//	初始化模式辅助参数
    for(i=0;i<4;i++) eepByteOut(eepModeSubPar+i,EepInitData_ModeSub[i]);
 
//初始化系统配置参数及初始化参数
    eepByteOut(eepSysConfig,0xe1);
    eepByteOut(eepColorIndex,0x00);
    eepByteOut(eepUserModeIndex,0x0a);
    eepByteOut(eepInitFlag,0x69);
	}

}

⌨️ 快捷键说明

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