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

📄 fq1236.h

📁 PHILIPS FQ1286高频头c51驱动程序
💻 H
字号:
//fq1216 driver

#define fq1216_rf   0xc0
#define fq1216_if   0x86

#define UP_IF   4575 //for fq1236 //3890 for fq1216 
#define DN_IF   3980

#define MIN_IPF   4800    // 48 MHZ
#define MAX_IPF   140000  // 1400 MHZ

#define MAX_CH_NO   30     

unsigned char pdivider_lo;
unsigned char pdivider_hi;

unsigned long in_freq = 18425;
unsigned long lo_freq;

unsigned char digit5;
unsigned char digit4;
unsigned char digit3;
unsigned char digit2;
unsigned char digit1;
unsigned char digit0;
unsigned char fine_value = 20;
unsigned char digit_pos = 20;

void init_fq1216(void)
{

    lo_freq = in_freq + fine_value*5 - 100;
	digit5  = lo_freq/100000 + 0x30;
	lo_freq = lo_freq%100000;
    digit4  = lo_freq/10000 + 0x30;
	lo_freq = lo_freq%10000;
    digit3  = lo_freq/1000 + 0x30;
	lo_freq = lo_freq%1000;
    digit2  = lo_freq/100 + 0x30;
	lo_freq = lo_freq%100;
    digit1  = lo_freq/10 + 0x30;
	lo_freq = lo_freq%10;
    digit0  = (lo_freq&0xff) + 0x30;

}

void wr_fq1216_rf(void)
{   
    lo_freq = in_freq + UP_IF;
	lo_freq = lo_freq + fine_value*5 - 100;
	lo_freq = lo_freq*16/100;   
    pdivider_lo = lo_freq&0xff;
    pdivider_hi = ((lo_freq>>8)&0xff);
	i2c_data = pdivider_lo;	
	i2c_write(fq1216_rf,pdivider_hi);
    if(in_freq < 15800)
	{
       i2c_data = 0x41;
	   i2c_write(fq1216_rf,0x86);
    }
    else if(in_freq < 44200)
	{
       i2c_data = 0x42;
	   i2c_write(fq1216_rf,0x86);
    }
	else
	{
       i2c_data = 0x44;
	   i2c_write(fq1216_rf,0x86);
    }

	i2c_data = 0xa0;
	i2c_write_without_subaddr(fq1216_rf);
}

void wr_fq1216_if_i(void)
{  
    i2c_data = 0x56;
	i2c_write(fq1216_if,0x00);

    i2c_data = 0x30;//0x30;//0x70;
	i2c_write(fq1216_if,0x01);
//    i2c_data = 0x70;//0x70;
//	i2c_write_without_subaddr(fq1216_if);

    i2c_data = 0x44;//0x44;//0x4a;
	i2c_write(fq1216_if,0x02);
//    i2c_data = 0x4a;//0x4a;
//	i2c_write_without_subaddr(fq1216_if);
}

void wr_fq1216_if_dk(void)
{  
    i2c_data = 0x56;
	i2c_write(fq1216_if,0x00);

    i2c_data = 0x70;//0x30;//0x70;
	i2c_write(fq1216_if,0x01);
//    i2c_data = 0x70;//0x70;
//	i2c_write_without_subaddr(fq1216_if);

    i2c_data = 0x4b;//0x44;//0x4a;
	i2c_write(fq1216_if,0x02);
//    i2c_data = 0x4a;//0x4a;
//	i2c_write_without_subaddr(fq1216_if);
}

void rd_fq1216_if(void)
{
    i2c_data = 0xff;
//	i2c_read_without_subaddr(fq1216_if,0x00);
	i2c_read_without_subaddr(fq1216_if);
}

⌨️ 快捷键说明

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