资源简介
程序配置参考时钟,输出,自动配置寄存器
int lmx2572_set_ref(uint32_t ref_freq, bool doubler, int pre_R, int multiplier, int R);
int lmx2572_set_freq(float freq);
代码片段和文件信息
#include “LMX2572.h“
#include “LMX2572_default.h“
#include
#include
uint32_t pfd_freq;
uint16_t regs[126];
void lmx2572_write_reg(uint8_t address uint16_t data)
{
// cs->write(0);
// spi->txrx(address&0x7f);
// spi->txrx((data>>8)&0xff);
// spi->txrx(data&0xff);
// cs->write(1);
}
uint16_t lmx2572_read_reg(uint8_t address)
{
uint16_t value;
// cs->write(0);
// spi->txrx((address&0x7f) | 0x80);
// value = spi->txrx(0) << 8;
// value |= spi->txrx(0);
// cs->write(1);
return value;
}
bool lmx2572_is_locked()
{
uint16_t reg110 = lmx2572_read_reg(110);
return ((reg110>>9)&0x3) == 0x02;
}
int LMX2572_init(void)
{
memcpy(regs LMX2572_default_regs sizeof(regs));
for(int i=0; i<=126; i++)
lmx2572_write_reg(i regs[i]);
return 0;
}
int lmx2572_set_ref(uint32_t ref_freq bool doubler int pre_R int multiplier int R)
{
// note:multiplier *8-31 is allowed but not recommended
// also use doubler instead of multiplier 2
//
if(doubler)
ref_freq *= 2;
pre_R &= 0xfff; // 12bit pre-R;
multiplier &= 0x1f; // 5bit multiplier
R &= 0xff; // 8bit R
pfd_freq = ref_freq * multiplier / pre_R / R;
regs[11] = 0xB008 | (R<<4);
regs[10] = 0x1078 | (multiplier<<7);
regs[9] = 0x4;
if (doubler)
regs[9] |= 0x1000;
if (pfd_freq > 100000000)
regs[9] |= 0x4000;
for(int i=9; i<=11; i++)
lmx2572_write_reg(i regs[i]);
return 0;
}
int lmx2572_set_output(bool enable int power)
{
// B disabled
power &= 0x3f;
regs[44] = 0xA2 | (power << 8);
if (!enable)
regs[44] |= 0x40;
lmx2572_write_reg(44 regs[44]);
return 0;
}
int lmx2572_set_freq(float freq)
{
int div = 0;
uint32_t denum = 1000;
int divider_tbl[9] = {0 0 1 3 5 7 9 12 14};// strange divider table of R75
uint64_t vco_freq = (uint64_t)(freq*1000000);// allowed vco range: 3.2G to 6.4G
while (vco_freq<3200000000)
{
div ++;
vco_freq *= 2;
}
if (div > 8)
return -1;
int N = vco_freq/pfd_freq;
int FRAC = (vco_freq - N * (uint64_t)pfd_freq) * denum / pfd_freq;
printf(“vco :%ld\r\n“pfd_freq);
printf(“div :%d\r\n“div*2);
printf(“vco :%lld\r\n“vco_freq);
printf(“N :%d\r\n“N);
printf(“FRAC:%d\r\n“FRAC);
regs[34] = ((N>>16)&0x7) | 0x10;
regs[36] = N;
regs[38] = denum>>16;
regs[39] = denum;
regs[42] = FRAC>>16;
regs[43] = FRAC;
regs[45] = (div == 0) ? 0xCE22 : 0xC622;
regs[75] = 0x0800 | (divider_tbl[div]<<6);
lmx2572_write_reg(75 regs[75]);
lmx2572_write_reg(45 regs[45]);
lmx2572_write_reg(39 regs[39]);
lmx2572_write_reg(38 regs[38]);
lmx2572_write_reg(43 regs[43]);
lmx2572_write_reg(42 regs[42]);
lmx2572_write_reg(36 regs[36]);
lmx2572_write_reg(34 regs[34]); // write N last
lmx2572_write_reg(0 regs[0]); // FCAL_EN
return 0;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 35328 2020-11-04 20:54 LMX2572LP\Debug\LMX2572LP.exe
文件 257824 2020-11-04 20:54 LMX2572LP\Debug\LMX2572LP.ilk
文件 568320 2020-11-04 20:54 LMX2572LP\Debug\LMX2572LP.pdb
文件 1130 2020-11-04 20:54 LMX2572LP\LMX2572LP\Debug\cl.command.1.tlog
文件 21186 2020-11-04 20:54 LMX2572LP\LMX2572LP\Debug\CL.read.1.tlog
文件 1326 2020-11-04 20:54 LMX2572LP\LMX2572LP\Debug\CL.write.1.tlog
文件 2 2020-11-04 20:54 LMX2572LP\LMX2572LP\Debug\li
文件 2 2020-11-04 20:54 LMX2572LP\LMX2572LP\Debug\li
文件 2 2020-11-04 20:54 LMX2572LP\LMX2572LP\Debug\li
文件 2 2020-11-04 20:54 LMX2572LP\LMX2572LP\Debug\li
文件 2 2020-11-04 20:54 LMX2572LP\LMX2572LP\Debug\li
文件 2 2020-11-04 20:54 LMX2572LP\LMX2572LP\Debug\li
文件 2 2020-11-04 20:54 LMX2572LP\LMX2572LP\Debug\li
文件 2 2020-11-04 20:54 LMX2572LP\LMX2572LP\Debug\li
文件 2 2020-11-04 20:54 LMX2572LP\LMX2572LP\Debug\li
文件 2 2020-11-04 20:54 LMX2572LP\LMX2572LP\Debug\li
文件 2 2020-11-04 20:54 LMX2572LP\LMX2572LP\Debug\li
文件 2 2020-11-04 20:54 LMX2572LP\LMX2572LP\Debug\li
文件 2 2020-11-04 20:54 LMX2572LP\LMX2572LP\Debug\li
文件 2 2020-11-04 20:54 LMX2572LP\LMX2572LP\Debug\li
文件 2 2020-11-04 20:54 LMX2572LP\LMX2572LP\Debug\li
文件 2 2020-11-04 20:54 LMX2572LP\LMX2572LP\Debug\li
文件 1336 2020-11-04 20:54 LMX2572LP\LMX2572LP\Debug\li
文件 2652 2020-11-04 20:54 LMX2572LP\LMX2572LP\Debug\li
文件 648 2020-11-04 20:54 LMX2572LP\LMX2572LP\Debug\li
文件 13556 2020-11-04 20:54 LMX2572LP\LMX2572LP\Debug\LMX2572.obj
文件 74 2020-11-04 20:54 LMX2572LP\LMX2572LP\Debug\LMX2572LP.lastbuildstate
文件 2069 2020-11-04 20:54 LMX2572LP\LMX2572LP\Debug\LMX2572LP.log
文件 26980 2020-11-04 20:54 LMX2572LP\LMX2572LP\Debug\main.obj
文件 510976 2020-11-04 20:54 LMX2572LP\LMX2572LP\Debug\vc110.idb
............此处省略17个文件信息
- 上一篇:广工 移动智能实验
- 下一篇:ReFox X 破解版
相关资源
- 习题解答:Probability Statistics and Rand
- Mathematical Statistics: Basic Ideas and Selec
- Probability Statistics and Random Processes fo
- lingo12注册汉化包.zip
- Linear.Models.with.R(Texts.in.Statistical.Sc
- Tools for Computational Finance.pdf
- Probability and Statistics (4th Edition) 概
- 《Multivariate Statistics- Exercises and Solu
- 传输线矩阵法Transmission-Line Modeling (
- Probability Statistics and Random Processes fo
- An infinite descent into pure mathematics10923
- 声学手册,Master handbook of Acoustics(
- Mathematical Methods of Statistics - Cramer 经典
- Numerical mathematics (2nd Edition Springer
- 中文分词词库整理
- mathematical statistics and data analysis 2ed (
- Getting Started with Kudu Perform Fast Analyti
-
me
taheuristics From Design to Implementatio - Introduction to Probability Models (11th)
- cpp-CppRoboticscpp实现机器人算法包括定
- Data.Analytics.with.Hadoop.An.Introduction.for
- Modern_Robotics_Mechanics Planning and Control
- Probability and Statistics (4th Edition)
- MODERN ROBOTICS MECHANICS PLANNING AND CONTROL
- Infragistics_Ultimate_2017
- Bioinformatics生物信息学:序列和基因组
- mathematics and its history (文字原版)
- Indroduction_to_Mathematica_Statistics.HoggMcK
- Matrix Algebra Theory Computations and Applica
- Sampling:Design and Analysis
评论
共有 条评论