📄 main.c
字号:
//====================================================================
//filename :main.c
//description :set the pll.get the mdiv and the pdiv,the sdiv
// always is "1"
//author :kaka,sn.kaka@yahoo.com
// The PLL set for S3C44B0X
//====================================================================
#include <stdio.h>
#define f_out 66 //change the value for yourself
//the frequency out that you want
#define f_in 8 //the frequency in
//change the value for yourself
int mdiv,pdiv;
void main(void)
{
float f,a,b,flag,fout,fin;
fout=f_out;
fin=f_in;
a=(fin/2-2);
b=(fin-2);
printf("<----------------------->\n");
printf("<---PLL set for 44B0X--->\n");
printf("<--- Author kaka --->\n");
printf("<---sn.kaka@yahoo.com--->\n");
printf("<----------------------->\n");
printf("PLLout is=%fMhz,Fin is=%fMhz \n",fout,fin);
printf("========================================== \n");
while(f!=fout)
{
if((a<pdiv) &(pdiv<b))
{
flag=1;
}
pdiv++;
if(flag==1)
{
for(mdiv=0;mdiv<1024;mdiv++)
{
f=((mdiv+8)*fin)/((pdiv+2)*2);
if((int)f==fout)
{
printf("Mdiv=%d,Pdiv=%d ",mdiv,pdiv);
printf("The PLLout is %fMhz \n",f);
printf("========================================== \n");
}
}
}
flag=0;
}
while(1);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -