浮名此生分享 http://blog.sciencenet.cn/u/hailangww 工学博士

博文

[转载]锁相环初始化

已有 935 次阅读 2022-9-27 09:41 |系统分类:科研笔记|文章来源:转载

void InitPll(Uint16 val)

{

   volatile Uint16 iVol;


   if (SysCtrlRegs.PLLCR.bit.DIV != val)

   {


      EALLOW;

      SysCtrlRegs.PLLCR.bit.DIV = val;    //CLKIN=30*10/2=150MHZ

      EDIS;


   // Optional: Wait for PLL to lock.

   // During this time the CPU will switch to OSCCLK/2 until the PLL is

   // stable.  Once the PLL is stable the CPU will switch to the new PLL value.

   //

   // This switch time is 131072 CLKIN cycles as of Rev C silicon.

   //

   // Code is not required to sit and wait for the PLL to lock.

   // However, if the code does anything that is timing critical,

   // and requires the correct clock be locked, then it is best to

   // wait until this switching has completed.


   // If this function is run from waitstated memory, then the loop count can

   // be reduced as long as the minimum switch time is still met.


   // iVol is volatile so the compiler will not optimize this loop out

   //

   // The watchdog should be disabled before this loop, or fed within

   // the loop.


      DisableDog();


   // Wait lock cycles.

   // Note,  This loop is tuned to 0-waitstate RAM memory.  If this

   // function is run from wait-stated memory such as Flash or XINTF,

   // then the number of times through the loop can be reduced

   // accordingly.

      for(iVol= 0; iVol< ( (131072/2)/12 ); iVol++)

      {


      }

   }

}

转自《C2000手册》



https://m.sciencenet.cn/blog-54347-1356999.html

上一篇:[转载]初始化系统控制寄存器II
下一篇:[转载]初始化外设时钟

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-6-2 20:02

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部