资源简介
ADI公司的无线收发芯片,程序中,频点直接输入即可,调用很方便。该芯片是性价比比较高的芯片,目前广泛应用。
代码片段和文件信息
#include “ADF7020.h“
/*-----------------------------------------------------------------------------
** Abstract: write a long int data to ADF7020-1
** Parameters: long int data
** Returns: None
** Author: Alexander.Hong
**-----------------------------------------------------------------------------*/
void Adf7020WriteWord( INT32U longdata )
{
INT8U i;
//--------------IO direction define--------------------
ADF7020_SCLK_OUTPUT;
ADF7020_SLE_OUTPUT;
ADF7020_SDATA_OUTPUT;
//------------------write 32bit data----------------
ADF7020_SLE_LOW;
NOP;NOP;NOP;NOP;
for ( i = 0; i < 32; i++ )
{
ADF7020_SCLK_LOW;
NOP;NOP;NOP;NOP;
if ( longdata & 0x80000000 )
{
ADF7020_SDATA_HIGH;
}
else
{
ADF7020_SDATA_LOW;
}
NOP;NOP;
ADF7020_SCLK_HIGH ;
NOP;NOP;NOP;NOP;
longdata <<= 1;
}
//------------end write----------------------
ADF7020_SLE_HIGH;
NOP;NOP;NOP;NOP;
NOP;NOP;NOP;NOP;
ADF7020_SLE_LOW
}
/*-----------------------------------------------------------------------------
** Abstract: select the frequency
** Parameters: the frquency ID
** Returns: None
** Author: Alexander.Hong
**-----------------------------------------------------------------------------*/
void ChannelSelect( INT8U channel )
{
INT8U i;
for ( i = 0; i < 7; i++ )
{
Adf7020WriteWord (cChannelTab[channel][i]);
}
}
/*-----------------------------------------------------------------------------
** Abstract: set the frequency of ADF7020-1
** Parameters:frquency work state
** Returns: None
** Author: Alexander.Hong
**-----------------------------------------------------------------------------*/
void ChannelSelect1( float frequency INT8U TX_RX )
{
union Union_LongByteDef Reg32 ;
float value;
INT8U integer_n;
INT32U fractional_n;
value = frequency / XTAL_FREQUENCY;
integer_n = (INT8U) value;
value -= (float) integer_n;
value *= 327680;
fractional_n = (INT32U) value;
if ( (fractional_n % 10) > 4 )
{
fractional_n += 10;
}
fractional_n /= 10;
//--------15bit fractional-n-------------
Reg32.LongByte = fractional_n << 4;
//--------8-bit integer-n-------------
Reg32.CharByte[2] |= integer_n << 3;
Reg32.CharByte[3] = integer_n >> 5;
//--------MUXOUT-------------
Reg32.BIT.b31 = 0;
Reg32.BIT.b30 = 1;
Reg32.BIT.b29 = 1;
//--------PLL enable-------------
Reg32.BIT.b28 = 1;
//--------Tx/Rx------------- 1:RX 0:TX
if ( TX_RX )
{
Reg32.BIT.b27 = 0;
}
Adf7020WriteWord (Reg32.LongByte);
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2847 2007-11-27 11:57 ADF7020.c
文件 5647 2007-11-27 15:01 ADF7020.h
----------- --------- ---------- ----- ----
8494 2
- 上一篇:test2_DXF_cc.rar
- 下一篇:saber 开关电源仿真模型
评论
共有 条评论