The main steps for timer initialization configuration are:
1. Setting of rTCFG0 and rTCFG1
Timer
0000
0001
0010
0011
01xx
For example: rTCFG0
2.
For example: rTCNTB0
3. Setting of rTCON
For example: rTCON
4. Clear the IRQ or FIQ interrupt, such as calling the ClearPending(BIT_TIMER0) function.
#define
The definition of the ClearPending function in the header file 2440addr.h is:
__inline
{
register
rSRCPND
rINTPND
i
}
__inline
{
register
rSUBSRCPND
i
5. Setting of rEXTINTx (P301), rEINTPEND (P306), and rEINTMASK (P305)
rEXTINT1
rEXTINT1
rEINTPEND
rEINTMASK
In addition, ClearPending (BIT_EINT1 | BIT_EINT2 | BIT_EINT8_23) should be used to clear the interrupt pending register. Note that
6. Setting of rINTMOD (P386), optional
7. rPRIORITY (P390) setting, optional
8. Set the interrupt program entry, such as pISR_TIMER0
The macro definition of pISR_EINT8_23
#define
Enable external interrupt EnableIrq(BIT_EINT0|BIT_EINT2|BIT_EINT8_23);
This macro is defined in 2440addr.h and its prototype is
#define EnableIrq(bit) rINTMSK
#define EnableSubIrq(bit) rINTSUBMSK
At this point, all interrupt and timer initialization work is completed!
10. Write an interrupt service routine
static
_irq is a C keyword that tells the compiler that this program is an interrupt program so that special processing can be done. In an interrupt program, the main things to do are:
(1) Clear the interrupt source pending register, such as ClearPending (BIT_EINT8_23);
(2) For external interrupts, the relevant bits of the EINTPEND register must be cleared, such as
(3) Complete the functions of interrupt characteristics. For example, key interrupt service program
static
{
U8
}
Timer initialization
void
{
}
static
{
ClearPending(BIT_TIMER0);
}
Previous article:ARM9 S3C2440—GPIO initialization settings
Next article:ARM9 S3C2440-ADC and touch screen control detailed explanation
Recommended ReadingLatest update time:2024-11-23 05:17
- 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
- Embedded development system
- DSP CMD file connector command file
- I heard that RISC-V is a big hit now?
- Can someone help me convert the PCB format (allegro->altium)?
- Simulation and MCU source code of sawtooth wave generated by DAC0832
- Hardware and software design of wireless driving recorder based on MCU
- Watch the video and win a JD card | Tektronix Oscilloscope Video Learning Center is now online!
- Show off your prizes [Review of SGP40]
- Teradata says IT departments face new challenges
- Now that the galvanometer has been repaired, what can I DIY with it?