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

📄 t101_util.c

📁 T112 MCU源程码,用于T112外接MCU篇程,用来驱动模拟屏
💻 C
字号:
/****************************************************************************
* File: T101_Util.c                                                         *
* Description: Define T10x chip control policy                              *
* History:     2005/08/12                                                   *
*                                                                           *
* 		Copyright 2005 (c) Terawins Inc.                            *
****************************************************************************/

/****************************************************************************
*                               Include File                                *
****************************************************************************/
#include <reg51.h>
#include "common.h"
#include "SYSTEM.H"
#include "struct.h"
#include "twowire.h"
#include "OSDDRAW.H"
#include "T101_Util.h"
#include "TW10xReg.h"
#include "top18.h"
#include "tcon.c"
#include "felt50.c"
#include "felt54.c"
#include "pal50.c"
#include "pal54.c"
#include "ntsc50.c"
#include "ntsc54.c"


extern uCHAR 	idata 	m_cStandard;
extern uCHAR 	idata 	m_cBuff;
extern uCHAR	row_num;
 
/****************************************************************************
*                   (0x15,0)   Public Function                              *
****************************************************************************/

	void Init_pal(void)						
	{
		uCHAR RegIndex,RegAdr;
		RegIndex=0;
		RegAdr=stInitT10xP0_PAL[0].ucRegAdr;
		while (RegAdr != 0xFF)					
		{
			I2CWriteByte(TW101,RegAdr,stInitT10xP0_PAL[RegIndex].ucRegVal);
			RegAdr=stInitT10xP0_PAL[++RegIndex].ucRegAdr;
		}
		RegIndex=0;
		RegAdr=stInitT10xP2_PAL[0].ucRegAdr;
		while (RegAdr != 0xFF)		
		{
			I2CWriteByte(TW101+4,RegAdr,stInitT10xP2_PAL[RegIndex].ucRegVal);
			RegAdr=stInitT10xP2_PAL[++RegIndex].ucRegAdr;
		}
	}	
	void Init_ntsc(void)					
	{
		uCHAR RegIndex,RegAdr;
		RegIndex=0;
		RegAdr=stInitT10xP0_NTSC[0].ucRegAdr;
		while (RegAdr != 0xFF)					
		{
			I2CWriteByte(TW101,RegAdr,stInitT10xP0_NTSC[RegIndex].ucRegVal);
			RegAdr=stInitT10xP0_NTSC[++RegIndex].ucRegAdr;
		}
		RegIndex=0;
		RegAdr=stInitT10xP2_NTSC[0].ucRegAdr;
		while (RegAdr != 0xFF)		
		{
			I2CWriteByte(TW101+4,RegAdr,stInitT10xP2_NTSC[RegIndex].ucRegVal);
			RegAdr=stInitT10xP2_NTSC[++RegIndex].ucRegAdr;
		}
	}   
	     
	void Init(void)								
	{
		uCHAR RegIndex,RegAdr;
		twdDelay1(50);
		RegIndex=0;
		RegAdr=stInitT10xP0[0].ucRegAdr;
		while (RegAdr != 0xFF)				
		{
			if(RegAdr==0x15)
				WriteTPG051( 0x15, 0x00);
			else
				I2CWriteByte(TW101,RegAdr,stInitT10xP0[RegIndex].ucRegVal);
			RegAdr=stInitT10xP0[++RegIndex].ucRegAdr;
		}	
		RegIndex=0;
		RegAdr=stInitT10xP2[0].ucRegAdr;
		while (RegAdr != 0xFF)		
		{
			if(RegAdr==0x14)
				WriteTPG051( 0x14, 0x00);
			else
				I2CWriteByte(TW101+4,RegAdr,stInitT10xP2[RegIndex].ucRegVal);
			RegAdr=stInitT10xP2[++RegIndex].ucRegAdr;
		}
		RegIndex=0;
		RegAdr=stInitT10xP1[0].ucRegAdr;
		while (RegAdr != 0xFF)		
		{
			I2CWriteByte(TW101+2,RegAdr,stInitT10xP1[RegIndex].ucRegVal);
			RegAdr=stInitT10xP1[++RegIndex].ucRegAdr;
		}
		if(row_num==1)
			Init_pal();
		else
			Init_ntsc();	
		I2CWriteByte(TW101, 0xe2, 0x11);		
	}
	
	void InitT10x(void)						///制式判断处理
	{	
		switch(m_cBuff)
		{
			case S_NTSC:
					Init_ntsc();
					break;
			case S_PAL:
					Init_pal();
					break;
		}	
		I2CWriteByte(TW101, 0xe2, 0x11);
	}       
	        
	void DetectSignalStd(void)				////涉及到m_cStandard & m_cChroma两个参数,探测标准信号
	{
		m_cBuff=m_cStandard;				
		if(I2CReadByte(0x54, 0x3A)&0x06)		// Judge vlock and hlock
		{	
			if(I2CReadByte(TW101,0x59) <= 0xd6)	
				{
					m_cBuff=S_NTSC; 
				} 
			else 
				{
					m_cBuff=S_PAL; 
				}
			if((m_cStandard!=m_cBuff))
			{	// signal std was changed,and output timing must be set again
				m_cStandard=m_cBuff;						    
				InitT10x();
	    	}	
		}
	}



⌨️ 快捷键说明

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