www.pudn.com > uCOS+GUI.rar > InitClock.C


/* 
********************************************************************************************************* 
* 文件: InitClock.C 
* 描述: 对系统时钟进行初始化. 
* 编写: 深思 (001-12345@sohu.com). 
********************************************************************************************************* 
*/ 
#include "44b0x.h" 
#include "Defines.h" 
 
#if      Fin==8000000 
    #define  MDIV  92                               // Fin = 8 MHz, Fout = 50 MHz. 
    #define  PDIV  6 
    #define  SDIV  1 
#elif    Fin==10000000 
    #define  MDIV  92                               // Fin = 10 MHz, Fout = 50 MHz. 
    #define  PDIV  8 
    #define  SDIV  1 
#else 
    #error   "no define input clk" 
#endif 
 
/* 
********************************************************************************************************* 
* 描述: 初始化系统时钟. 
********************************************************************************************************* 
*/ 
void InitClock (void) 
{ 
    LOCKTIME = 0x0fff; 
    PLLCON   = (MDIV << 12) + (PDIV << 4) + SDIV; 
    CLKCON   = 0x7ff8;                                  // All on Clock generator. 
} 
 
/* 
********************************************************************************************************* 
*       END 
********************************************************************************************************* 
*/