In addition to the system tick timer and the general timer, LPC1768 also introduces a timer called the repetitive timer RIT. This timer can only be used for timing operations and has an interrupt. I personally feel that this seems to be a timer designed for delay functions.
So what process is followed when using this timer?
First, turn on the clock
Second, we need to determine the timer's frequency division value from pclk, which depends on another register
Third, turn off the timer first
Fourth set register comparison value
Fifth, clear or mask some specific comparison mask bits
Finally, turn on the interrupt and start the timer
#define RIT_INT_POSITION 0
#define RIT_ENCLR_POSITION 1
#define RIT_ENBR_POSITION 2
#define RIT_EN_POSITION 3
void RitInit(u32 count)
{
LPC_SC->PCONP |=(1<<16); //Turn on the clock sys, divide by four to 25M
LPC_RIT->RICTRL &= ~(1<<3);
LPC_RIT->RICOMPVAL = count;
// LPC_RIT->RIMASK = count;
LPC_RIT->RIMASK = 0x80000000;
LPC_RIT->RICOUNTER = 0;
NVIC_EnableIRQ(RIT_IRQn); /* enable irq in nvic */
LPC_RIT->RICTRL = (1< } Finally, we need to respond to the interrupt in rit's interrupt function, as follows void RIT_IRQHandler() { u8 state = LPC_RIT->RICTRL; if(state&0x01) //An interrupt occurs { RitStop(); LPC_RIT->RICOUNTER = 0; LPC_RIT->RICTRL |= 0x01; // Clear interrupt RIT_INT_CALLBACK; RitStart(); } }
Previous article:SPI communication of LPC1768
Next article:LPC1768 serial port usage
- Popular Resources
- Popular amplifiers
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- STMicroelectronics discloses its 2027-2028 financial model and path to achieve its 2030 goals
- 2024 China Automotive Charging and Battery Swapping Ecosystem Conference held in Taiyuan
- State-owned enterprises team up to invest in solid-state battery giant
- The evolution of electronic and electrical architecture is accelerating
- The first! National Automotive Chip Quality Inspection Center established
- BYD releases self-developed automotive chip using 4nm process, with a running score of up to 1.15 million
- GEODNET launches GEO-PULSE, a car GPS navigation device
- Should Chinese car companies develop their own high-computing chips?
- Infineon and Siemens combine embedded automotive software platform with microcontrollers to provide the necessary functions for next-generation SDVs
- Continental launches invisible biometric sensor display to monitor passengers' vital signs
- (Transistor + MOS) & (MOS + MOS) combination circuit
- [BearPi-Hongmeng-BearPi-HM Nano] Building a development environment
- [XMC4800 Relax EtherCAT Kit Review]
- Multisim simulates the switching power supply. The maximum output voltage is sufficient, but the maximum output current is not enough. What should I do?
- I am looking for the electronic version of "Mentor Xpedition Engineering from Scratch: High-Speed PCB Design"!
- Award-winning live broadcast: TI's new generation Sitara AM62 processor revolutionizes human-computer interaction - product introduction and related resources
- The list of materials for the 2022 provincial competition has been released. What do you think?
- Share WB-Alibaba Cloud IoT Device Simulator
- Electromagnetic compatibility of modular power supplies and linear power supplies in the same combination
- Which crystals can be used with the MSP430?