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
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
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Espressif ESP32-C3-DevKitM-1 review is coming soon. Let’s learn about this board first.
- After deleting a wire that was previously laid, AD09 got stuck.
- Canaan wants to record a video about K510. What kind of content do you hope to see? (Attached is the official information about K510)
- Share some difficult problems with the LM25116EN chip
- [RVB2601 Creative Application Development] Dynamically loading MBRE Postscript
- Distance of ESD tip discharge needle
- Bone Vibration Sensor LIS25BA-Anti-Wind Noise Example
- SensorTile.box Trial (3) Expert Mode Trial
- Introduction to CEDV Electricity Calculation Method
- [Anxinke UWB indoor positioning module NodeMCU-BU01] 04: Test results and problems of connecting to OLED screen