Register Name
describe
Function
default value
EXTINT
External interrupt flag register
Set or check the interrupt flag
0x00
EXTMODE
External Interrupt Mode Register
Set level trigger or edge trigger
0x00
EXTPOLAR
External interrupt polarity register
Set to high/low level or rising/falling edge trigger
0x00
PINSEL4
Pin Function Select Register
Select the function of the P2 pin
0x00
Because the experiment uses the interrupt mode instead of the query mode to test the interrupt, and because there is a button connected to the P2.10 port, this button is used to make a simple interrupt experiment. Because the falling edge trigger is selected, a register is also involved: IO2IntEnF. The function of this register is to enable the falling edge interrupt function of the P2 port. Because it is just an experiment, the circuit is very simple, and the circuit diagram used in the previous two times is still used, as shown below:
Figure 1-1 LED indicator circuit
There is another circuit, which is actually connecting a light touch button to the P2.10 port to trigger an external interrupt. I won't show the diagram here. Well, since the experiment is simple, the interrupt program is given below. If you are interested in the main program, you can refer to the attachment, which contains the complete engineering artifacts created by Real MDK4.10:
#include "includes.h"
volatile uint32_t eint0_counter = 8;
void EINT0_IRQHandler (void)
{
}
uint32_t EINTInit( void )
{
}
This program has only two functions, one is the interrupt handling function, which is not difficult to understand, so I won't summarize it here. Regarding the interrupt initialization function, the previous ones are all about setting the related interrupt registers. You can look at the LPC1768 manual for details on how to set the registers, which are explained in detail. I won't summarize it here. Regarding the void NVIC_EnableIRQ(IRQn_Type IRQn) function, it is defined in core_cm3.h. In fact, it sets the interrupt enable register ISER. As you can see from the name, its function is to enable interrupts. This time, the external interrupt did not use the query method. The principle of the query method is to set the interrupt, enable the interrupt, and then the main program keeps querying the interrupt bit to see if there is an interrupt, and then execute the corresponding measures. Relatively speaking, the query method consumes more software system resources, but the program is not too difficult. The other external interrupts are similar.
Previous article:Cortex-M3 Learning Log (IV) -- UART0 Experiment
Next article:Cortex-M3 Learning Log (Part 2) - Button Experiment
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- 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
- EEWORLD University ---- SimpleLink? Wi-Fi ??? CC3220 Project Introduction
- [Question and answer post] Jianchi CDK FAQ
- About the dynamic load response of the switching power supply, the oscillation phenomenon of the D-pole waveform of the MOS, and the delay problem of output voltage switching
- MotionDRV DC servo drive PID parameter tuning
- Which one is better among ceramic antenna, PCB antenna and IPEX antenna?
- Get accurate, fast and stable analog voltage from digital PWM signal
- EEWorld invites you to dismantle (fifth issue) - Gosund CP5 Pro smart power strip dismantling report
- Is the vibration direction and wave propagation direction similar to the rhythm of the Humen Bridge?
- How to get started with Renesas MCU?
- Shanghai ACM32F070 Development Board Review 1. Unboxing