Silicon C8051F340之时钟系统

一、背景
        做个记录,以备下次快速开发。

二、正文
        C8051F340有一个可编程内部高频振荡器、一个可编程内部低频振荡器、一个外部振荡器驱动电路
   和一个4倍时钟乘法器。其中可编程内部高频振荡器在系统复位后被默认为系统时钟。其值为12MHZ。震荡 图如下:

        时钟配置例程如下,设置内部时钟为4倍时钟乘法器提供12MHz时钟。4倍时钟乘法器输出经1/2分频
    后用作系统时钟。
        void Sysclk_Init(void)
        {
            OSCICN |= 0x03;             // Configure internal oscillator for
                                        // its maximum frequency and enable
                                        // missing clock detector
        
            CLKMUL  = 0x00;             // Select internal oscillator as
                                        // input to clock multiplier
            
            CLKMUL |= 0x80;             // Enable clock multiplier
            Delay();                    // Delay for clock multiplier to begin
            CLKMUL |= 0xC0;             // Initialize the clock multiplier
            Delay();                    // Delay for clock multiplier to begin
            while(!(CLKMUL & 0x20));    // Wait for multiplier to lock
            CLKSEL  = 0x02;             // Set sys clock to clkmul / 2
        }
        

三、参考链接
    C8051振荡器相关事项解答
        http://blog.sina.com.cn/s/blog_6e230f0201012pzv.html        

    至此,记录完毕。

记录时间:2016-11-25
记录地点:深圳WZ
原文地址:https://www.cnblogs.com/ChYQ/p/6102504.html