LPC1768 clock

Publisher:捡漏来了Latest update time:2021-01-05 Source: eefocusKeywords:LPC1768 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

A phase-locked loop and CPU clock.

CPU clock = PLL 0 output / CPU clock configuration register pre-division value, that is: Fcpu = Fcco / CCLKCFG + 1. The phase-locked loop can multiply the external clock to a higher frequency. The PLL0 output frequency is:

Fcco = (2xMxFin)/N;

M=MSEL0+1, N=NSEL0+1. MSEL0 and NSEL0 are the low word and high word of PLL0CFG_Val respectively. The value range of N is 1~32, while the value of M is 6~512 at higher oscillator frequencies (over 1MHz).

After obtaining the PLL0 output value, the CPU clock can be obtained through the CPU clock configuration register.

In this system_lpc17xx.c file, just modify the macro definition value of #define PLL0CFG_Val 0x00050063.

For example: 00050063 In this state, PLL0 outputs 400MHz.

M = 0x63 (hexadecimal) + 1 = 100 (decimal);

N = 0x05 + 1 =  6;

Fcco = 2X12x100/6 = 400M

Fcpu=Fcco/2^(CCLKCFG+1)=400M/4=100M.

The frequency division value CCLKSEL can only be 0 and an odd value (1, 3, 5, ..., 255). CCLK is obtained from the output signal of PLL0 and is divided by CCLKSEL+1.


2. Timer clock: The timer can use PC and PR to re-divide

Pre-scaling factor: LPC_TIM1->PR

Timer count frequency = Fcclk/LPC_TIM1->PR

Reload value: LPC_TIM0->MR0

The time required for an interrupt = reload value/timer counting frequency.

http://blog.csdn.net/aquakguo0he1/article/details/8513923

void delayMs(uint8_t timer_num, uint32_t delayInMs)
{
  if ( timer_num == 0 )
  {
        LPC_TIM0->TCR = 0x02;                /* reset timer */
        LPC_TIM0->PR  = 0x00;                /* set prescaler to zero */
        LPC_TIM0->MR0 = delayInMs * (9000000 / 1000-1);
        LPC_TIM0->IR  = 0xff;                /* reset all interrrupts */
        LPC_TIM0->MCR = 0x04;                /* stop timer on match */
        LPC_TIM0->TCR = 0x01;                /* start timer */

        /* wait until delay time has elapsed */
        while (LPC_TIM0->TCR & 0x01);
  }
  else if ( timer_num == 1 )
  {
        LPC_TIM1->TCR = 0x02;                /* reset timer */
        LPC_TIM1->PR  = 0x00;                /* set prescaler to zero */
        LPC_TIM1->MR0 = delayInMs * (9000000 / 1000-1);
        LPC_TIM1->IR  = 0xff;                /* reset all interrrupts */
        LPC_TIM1->MCR = 0x04;                /* stop timer on match */
        LPC_TIM1->TCR = 0x01;                /* start timer */

        /* wait until delay time has elapsed */
        while (LPC_TIM1->TCR & 0x01);
  }
  return;
}


Two Systick:

2.1 Clock source: CPU provides P3.26 (STCLK)

2.2 10ms dedicated interrupt. If you want to generate interrupts cyclically, you must load STRELOAD regularly. The default time interval is in STCALIB

2.3 Bare metal dedicated timing timer


Keywords:LPC1768 Reference address:LPC1768 clock

Previous article:LPC1768 Interrupt
Next article:Design and implementation of interface between AD7656 analog-to-digital converter and LPC2210 ARM controller

Recommended ReadingLatest update time:2024-11-16 21:54

C51 MCU uses timer T0 interrupt to realize electronic clock
The above is the circuit schematic The following is the program source code: /******************************************************************************** Function description: Use timer T0 to realize electronic clock ********************************************************************/ #include"reg52.h
[Microcontroller]
C51 MCU uses timer T0 interrupt to realize electronic clock
Proteus—AVR microcontroller (ATMEGA16 microcontroller) system clock and clock option settings
Before setting it up, I have to talk about the information in the ATMEGA16 datasheet, of course, about the system clock and clock options. 1. System clock and clock options (here we mainly introduce the principle, and 3 will introduce how to set it. In fact, if you know 1, then the following 2 and 3 will be quite simp
[Microcontroller]
Proteus—AVR microcontroller (ATMEGA16 microcontroller) system clock and clock option settings
Introduction to the clock calendar chip DS12C887
1 Device Characteristics     The DS12C887 real-time clock chip is rich in functions and can be used to directly replace the clock calendar chip DS12887 on the IBM PC. At the same time, its pins are also compatible with MC146818B and DS12887.     Since DS12C887 can automatically generate time information such as centur
[Microcontroller]
Introduction to the clock calendar chip DS12C887
stm8s003 usage experience_clock (CLK)
This article introduces the clock (CLK) of stm8s003MCU. A few days ago, I used the official library to develop a program, and directly used the library function to configure the clock and TIMER. There were some things I didn't understand. Today, I read the datasheet carefully and have a better understanding. Because
[Microcontroller]
stm8s003 usage experience_clock (CLK)
MCU clock and different bytes different instruction timing (ALE)
First, paste the structure and circuit of the clock:   Understand what is a machine cycle and an instruction cycle:   The timing of various different bytes and different cycle instructions (important):        
[Microcontroller]
MCU clock and different bytes different instruction timing (ALE)
STM8与汇编语言(13)--修改CPU的时钟
在有些单片机的应用系统中,并不需要CPU运行在多高的频率。在低频率下运行,芯片的功耗会大大下降。因此希望单片机能提供这个功能,STM8单片机确实有这个功能,并且修改也非常方便。 下面的实验程序首先将CPU的运行时钟设置在8MHZ,然后快速闪烁LED指示灯。接着,通过修改主时钟的分频系数和CPU时钟的分频系数,将CPU时钟频率设置在500KHZ,然后再慢速闪烁LED指示灯。通过观察LED指示灯的闪烁频率,可以看到,同样的循环代码,由于CPU时钟频率的改变,闪烁频率和时间长短都发生了变化。 同样还是利用ST的开发工具,生成一个汇编程序的框架,然后修改其中的main.asm,修改后的代码如下。 stm8/       #
[Microcontroller]
STM8S CPU main clock
Clock source after STM8S is powered on:   /* Public functions ----------------------------------------------------------*/ /** * @addtogroup CLK_Public_Functions * @{ */ /** * @brief Deinitializes the CLK peripheral registers to their default reset * values. * @param None * @retval None * @par Warning: * Resetting th
[Microcontroller]
STM8S CPU main clock
MAX2470/MAX2471 for MIMO Transceiver Reference Clock Coupling
Basic Operation of the MAX2470/MAX2471 The MAX2470/MAX2471 are flexible, low-cost, high reverse-transmission isolated buffer amplifiers that are ideal for discrete or module-based VCO designs. Both feature 50Ω differential outputs that can drive one differential (balanced) load or two independent single-ended (
[Analog Electronics]
MAX2470/MAX2471 for MIMO Transceiver Reference Clock Coupling
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号