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

📄 tuner.c

📁 这是一个TDA7540的模版程序
💻 C
字号:
/***************************************************************************
Project  :   TDA7540 Jig board 
Compiler : ST7 HiCross C (HiWARE)
Module   :  tuner.c
Version  :  V 1.0
Created  :  
Author   :  Jerry HE / ST-ShenZhen
Description
         -  tuner basic service routine
Modified
	  - Jan.24th,2005    
***************************************************************************/

#include "system.h"

/*--------------------------------------------------------------------------
Routine :  TunerSettingLoad 
Input   : 
Output  :
Description 
        - Load tuner setting to register
--------------------------------------------------------------------------*/ 
void TunerSettingLoad()
{
      ReadTunerEEPROM(0,0, &I2c_EepBuff[0]);
      if(I2c_EepBuff[0]!=0x0c)
      {
         Eep_pll_cpump = y10010001;        
         Eep_pll_pcl = y10001100;   
         Eep_pll_pch = y00000111;                 
         Eep_tun_tunvolt1 = y00000000;            
         Eep_tun_tunvolt2 = y01001000;            
         Eep_pll_sampletime = y00010111;         
         Eep_pll_ewcentre = y01101111;            
         Eep_tun_amcontrol = y00000000;          
         Eep_tun_qualityiss = y01100000;          
         Eep_tun_qualdetAdj = y11001000;          
         Eep_tun_qualdetMul = y00100000;          
         Eep_tun_qualdetDev = y00000101;           
         Eep_tun_softmute = y11111000;            
         Eep_tun_adjmute = y11111001;            
         Eep_tun_vcoplldiv = y00100101;          
         Eep_tun_fmagc = y01001111;               
         Eep_tun_amagc = y00000000;               
         Eep_tun_fmdem = y10000001;               
         Eep_tun_smeter = y11100000;             
         Eep_tun_ifgainXtal = y10101111;          
         Eep_tun_ift1ift2 = y10001101;           
         Eep_tun_IQmixer = y11001111;            
         Eep_tun_amifNB = y00000000;              
         Eep_tun_sstop = y10000000;               
         Eep_str_amnoise = y11100111;             
         Eep_str_stringain = y00011100;           
         Eep_str_nb = y00100000;                   
         Eep_str_HiCut = y11101011;                
         Eep_str_blend = y11100101;              
         Eep_str_multipath = y01001011;           
         Eep_str_rolloff = y10000001;             
         Eep_str_afs = y11111101;                 
         Eep_str_amcornerfreq = y00000100;         
         Eep_test1 = 0x00;                    
         Eep_test2 = 0x00;                   
         Eep_test3  = 0x00;                 
         Eep_test4  = 0x00;                  
         Eep_test5  = 0x00;                 
         Eep_test6  = 0xFE;                  
         Eep_str_spike = y11111110;               

         Eep_TV2_Point1 = y01001000;         
         Eep_TV2_Point2  = y01001000;             
         Eep_TV2_Point3 = y01001000;              
         Eep_TV2_Point4  = y01001000;             
         Eep_TV2_Point5 = y01001000;        
         Eep_TV2_Point6  = y01001000;  

      } 
      else
      {
           ReadTunerEEPROM(0,7, &I2c_EepBuff[0]);
           WAIT_10ms();
           ReadTunerEEPROM(8,15, &I2c_EepBuff[8]);
	    WAIT_10ms();
	    ReadTunerEEPROM(16,23, &I2c_EepBuff[16]);
           WAIT_10ms();
	    ReadTunerEEPROM(24,31, &I2c_EepBuff[24]);
           WAIT_10ms();
           ReadTunerEEPROM(32,39, &I2c_EepBuff[32]);
	    WAIT_10ms();
	    ReadTunerEEPROM(40,47, &I2c_EepBuff[40]);
	    WAIT_10ms();
	    ReadTunerEEPROM(48,55, &I2c_EepBuff[48]);
	     WAIT_10ms();
      }
      I2C_SetParEep();
}

/*--------------------------------------------------------------------------
Routine :  TunerRegisterRefresh 
Input   : 
Output  :
Description 
        - Refresh the tuner register
--------------------------------------------------------------------------*/ 
void TunerRegisterRefresh()
{
	if (radio_band < MW1)
	{
		radio_tun_vcoplldiv &= 0xBF;		// select FM mode			
	}
	else
	{
		radio_tun_vcoplldiv |= 0x40;        // select AM mode
	}
	WriteTunerRegister(0,31);
	WAIT_10ms();
	WriteTunerRegister(32,39);
}

/*--------------------------------------------------------------------------
Routine :  WriteTunerRegister 
Input   : 
Output  :
Description 
        - Write into the tuner register
--------------------------------------------------------------------------*/ 
void WriteTunerRegister (unsigned char start, unsigned char end)
{
      unsigned char i;
  	I2Cm_Start ();
  	I2Cm_TxData(TUNER_ADR);
  	if(start==end)
		I2Cm_TxData(start);
	else
		I2Cm_TxData(start+AUTO_INC);
	for (i=start;i<=end; i++)
		I2Cm_TxData(Tun_Buff[i]);
	I2Cm_Stop();

}

/*** (c) 2005  STMicroelectronics ****************** END OF FILE ***/

⌨️ 快捷键说明

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