51單片機(jī)驅(qū)動(dòng)TEA5767調(diào)頻收音機(jī)芯片C程序
完整的源代碼下載地址:http://www.51hei.com/bbs/dpj-19294-1.html下面是程序的主要部分:
本文引用地址:http://m.butianyuan.cn/article/201611/323741.htm /*----------- TEA5767 驅(qū)動(dòng)-----------*/
/*------ 外部晶振為 12MHz-------*/
/*--------最后修改2011.02.26-------*/
#include "STC12C5620AD.H"
#include "IIC.H"
#include "delay.h"
#include "Radio.H"
#include "Channel_Handle.H"
#define Max_Freq 108000
#define Min_Freq 87500
/**********************聲明外部變量**************************/
extern uchardataDisplay_FM[9]; //From Main.c
/********************** 定義變量**************************/
uchar TEA5767_Write_Data[5]={0x29,0x9e,0x40,0x12,0x40}; //要寫入TEA5767的數(shù)據(jù)
uchar TEA5767_Read_Data[5];
unsignedlongFrequency;
unsigned int PLL=0x299e;
/********************** TEA5767 寫入數(shù)據(jù)**************************/
void TEA5767_Write(void)
{
uchar i;
IIC_Start();
IIC_Write_Byte(0xc0); //TEA5767寫地址
if(!IIC_Test_ACK())
{
for(i=0;i<5;i++)
{
IIC_Write_Byte(TEA5767_Write_Data[i]);
IIC_ACK();
}
}
IIC_Stop();
}
評(píng)論