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

📄 tda7540原程序.txt

📁 收音机用的tda7540的源程序11111111111111111111111
💻 TXT
字号:
/*********************************************************
Project:  ST FST(TDA7540)
File name: radio.c
Description: 
Write/Modify: Perry Liang
Time:  2006-1-24- 15:35:37
*********************************************************/
#include "public.h"
#define M_RadioNewKey { if(F_InTASwitch||F_InEONTASwitch)break;\
      if(KeyCode!=L_AD_DISP)Radio.F_Scan=0;\
      BreakAFCheck();\
      if(System.DispMode.Current==DISPMODE_RDS)\
      {\
       System.DispMode.Requst=DISPMODE_RADIO;\
       RDSDispMode=RDSDISP_IDLE;\
      }\
      if(RDSDispTimer>1)RDSDispTimer=0;\
      if(AFTAShowTimer>1)AFTAShowTimer=1;}
      
typedef struct Band_conststuct {
unsigned int BandFreq;
unsigned int MemFreq[6];
unsigned char CurrentMem;
} BandConstStuct;
typedef struct Area_stuct {
BandConstStuct Band[5];
unsigned char FMStep;
unsigned char FMSeekStep;
unsigned int FMMaxFreq;
unsigned int FMMinFreq;
unsigned char FMStepOirt;
unsigned int FMMaxFreqOirt;
unsigned int FMMinFreqOirt;
unsigned char AMStepMW;
unsigned int AMMaxFreqMW;
unsigned int AMMinFreqMW;
unsigned char AMStepLW;
unsigned int AMMaxFreqLW;
unsigned int AMMinFreqLW;
unsigned char FMStepWB;
unsigned int FMMaxFreqWB;
unsigned int FMMinFreqWB;
} AreaStuct;
static const AreaStuct Area[]=
{
// USA
8750,8750,9010,9810,10610,10790,8750,0,
8750,8750,9670,10490,10690,10790,8750,0,
//162400, 162425, 162450, 162475, 162500, 162525
2400, 2400, 2425, 2450, 2475, 2500, 2525, 0,//Weather band
530,530,600,1000,1600,1720,530,0,
530,530,600,1000,1600,1720,530,0, 
20,20,10790,8750,
0,0,0,
10,1720,530,
0,0,0,
25,2550,2400,
// LATIN
8750,8750,9010,9810,10610,10800,8750,0,
8750,8750,8750,8750,8750,8750,8750,0,
//162400, 162425, 162450, 162475, 162500, 162525
2400, 2400, 2425, 2450, 2475, 2500, 2525, 0,//Weather band
520,520,600,1000,1400,1620,520,0,
520,520,520,520,520,520,520,0,
10,10,10800,8750,
0,0,0,
10,1620,520,
0,0,0,
25,2550,2400,
// EUROPE
8750,8750,9010,9810,10610,10800,9120,0,
8780,8780,9180,9390,9710,10300,10430,0,
8750,8750,8750,8750,8750,8750,8750,0,
522,522,603,999,1404,1620,522,0,
144,144,171,216,270,288,144,0,
5,10,10800,8750,
//5,5,10800,8750,
0,0,0,
9,1620,522,
  9,288,144,
0,0,0,
// OIRT
6500,6500,8750,9000,9800,10600,10800,0,
6500,6500,8750,9000,9800,10600,10800,0,
6500,6500,8750,9000,9800,10600,10800,0,
531,531,603,999,1404,1620,531,0,
144,144,171,216,270,288,144,0,
5,10,10800,8750,
3,7400,6500,
9,1620,522,
  9,288,144,
0,0,0,
  
  // JAPAN
7600,7600,7820,7900,8000,8500,9000,0,
7600,7600,7900,8200,8500,8800,9000,0,
7600,7600,7950,8250,8550,8850,9000,0,
531,531,603,999,1404,1620,531,0,
144,144,171,216,270,288,144,0,
5,10,9000,7600,
0,0,0,
9,1620,522,
  9,288,144,
0,0,0,
};
//This only for TDA7540 in test mode.
//Different setting based on different module type. In real application, load the setting from EEPROM provided by tuner maker.
static const unsigned char TunerDefaultSetting[]=
{
0xd1,0x60,0x08,0x80,0x1a,0x98,0x8f,0x00,0x61,0xd0,
0x20,0x4a,0x93,0x35,0x25,0x20,0x00,0xc0,0x36,0xc6,
0x00,0x07,0x04,0x60,0x46,0x9e,0xe7,0x79,0x7c,0xdc,
0x14,0x7d,0x79,0x00,0x00,0x00,0x00,0x00,0xfe,0xfe,
0xaf,0x94,0x8d,0x48,0x48,0x48,0xa6,0x9d,0x92,0x90,
};
/*********************************************
Function:  CheckIFC
Description: 
Write/Modify: Perry.Liang
Time:  2006-1-24- 15:39:26
*********************************************/
unsigned char CheckIFC(unsigned int times,unsigned int all)
{
unsigned int i,j;
for(i=0,j=0;i<all;i++)
{
  if(!Pin_SSTOP)
  {
   j++;
   if(j>=times)return(0);
  }
}
return(1);
}
/*********************************************
Function:  GetSMeter
Description: 
Write/Modify: Perry.Liang
Time:  2006-1-24- 15:39:21
*********************************************/
unsigned char GetSMeter (void)
{
unsigned int inttemp;
unsigned char temp;
   unsigned char i,max,min;
//F_ADDisable=1;
inttemp=0;
   for (i=0,max=0,min=255;i<5;i++)
   {
  temp=(GetADValue(AD_FSU)>>1);
  inttemp+=(int)temp;
  if(temp<min)min=temp;
  if(temp>max)max=temp;
   }   
   //F_ADDisable=0;
temp = (inttemp-min-max)/3;
   return(temp); 
}
/*********************************************
Function:  LoadArea
Description: 
Write/Modify: Perry.Liang
Time:  2006-1-24- 15:38:56
*********************************************/
void LoadArea(void)
{
unsigned char i,j;
for(i=0;i<5;i++)
{
  for(j=0;j<6;j++)
   Radio.Band.MemFreq[j]=Area[Radio.Area].Band.MemFreq[j];
  Radio.Band.BandFreq=Area[Radio.Area].Band.BandFreq;
  Radio.Band.CurrentMem=Area[Radio.Area].Band.CurrentMem;  
}
Radio.MaxFreq=Area[Radio.Area].FMMaxFreq;
Radio.MinFreq=Area[Radio.Area].FMMinFreq;
Radio.Step=Area[Radio.Area].FMStep;
Radio.SeekStep=Area[Radio.Area].FMSeekStep;
Radio.CurrentBand=0;
}
/*********************************************
Function:  ChangeTV2
Description: 
Write/Modify: Perry.Liang
Time:  2006-1-24- 15:38:55
*********************************************/
signed char ChangeTV2(unsigned char inputbuff)
{
if(inputbuff&0x80)
  return (inputbuff&0x7F);
else
  return (0-(inputbuff&0x7F));
}
/*********************************************
Function:  ChangeToTV2
Description: 
Write/Modify: Perry.Liang
Time:  2006-1-24- 15:38:54
*********************************************/
unsigned char ChangeToTV2(signed char inputbuff)
{
if(inputbuff&0x80)
  return (0x80-(inputbuff&0x7F));
else
  return ((inputbuff&0x7F)+0x80);
}

⌨️ 快捷键说明

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