PIC microcontroller interrupt module introduction:
PIC16F87X series microcontrollers can receive up to 14 interrupt sources. The interrupt controller register INTCON marks the request of each interrupt source, sets the mask bit for each interrupt, and sets the global mask bit for all interrupts.
The interrupts of the PIC16F87X series include: TMR0 overflow interrupt (TOIF), external interrupt (INTF), port B change interrupt (RBIF), parallel slave port interrupt (PSPIF), A/D conversion interrupt, USART asynchronous receive interrupt (RCIF) and asynchronous transmit interrupt (TXIF), synchronous serial port interrupt (SSPIF), CCP1 interrupt (CCPIIF), TMR2 interrupt (TMR2IF), TMR1 interrupt, CCP1 interrupt (CCP2), E2PROM write interrupt (EEIF), and bus collision interrupt (BCLIF).
Each interrupt is processed in a query mode, that is, when the CPU port responds to an interrupt, it is necessary to first query the interrupt flag bit to determine which interrupt generated the interrupt request, and then execute the corresponding interrupt service program.
The RB0/INT external interrupt still follows the interrupt principle of the PIC16F87X microcontroller. When an interrupt occurs, an interrupt flag is generated, and the CPU queries and identifies the interrupt. According to this principle, multiple external interrupt sources can be expanded, and the CPU queries the interrupt flag to identify the interrupt after responding to the interrupt.
The external interrupt on the RB0/INT pin is edge-triggered, either rising or falling, which is determined by the INTEDG bit (D6) of the selection register OPTION_REG. When INTEDG = 1, the rising edge is selected; when INTEDG = 0, the falling edge is selected. Once a valid edge is detected on the pin, the INTF bit (D1 of INTCON) is set to 1. This interrupt is enabled or disabled by the interrupt control bit INTE.
To prevent the same interrupt from being executed in an infinite loop, the INTF bit must be cleared to 0 by software in the interrupt service routine before re-enabling the interrupt. If the INTE bit is set to 1 before entering the sleep state, the INT interrupt can wake up the CPU in the sleep state. The state of the GIE bit determines whether the processor jumps to the interrupt vector after being woken up.
When the counter TMR0 of timer TIMER0 overflows (i.e. changes from FFH to 00H), the hardware will automatically set the TGIF position to 1. The interrupt can be controlled by setting the TOIE bit to open or close the interrupt.
When the CPU responds to RB7 and RB4 interrupts, there are two situations: the first is called "short pulse", that is, the pin level returns to the original state during the CPU response to the interrupt, and the CPU will not generate a false interrupt in this case. The second is called "wide pulse", that is, the pin level returns to the original state after the CPU responds to the interrupt, and the process of returning to the original state also generates an interrupt request, which is a false interrupt phenomenon.
Once there is a level change on the D7~D4 pins of port B, the RBIF position is set to 1. This interrupt can be controlled by setting the RBIE bit to control whether the interrupt is open.
The above is the detailed introduction of the PIC microcontroller interrupt module.
Previous article:Based on PIC microcontroller and 16-bit serial D/A conversion principle
Next article:Working principle of PIC microcontroller's 4×4 row-column keyboard
- Popular Resources
- Popular amplifiers
- Molex leverages SAP solutions to drive smart supply chain collaboration
- Pickering Launches New Future-Proof PXIe Single-Slot Controller for High-Performance Test and Measurement Applications
- CGD and Qorvo to jointly revolutionize motor control solutions
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Nidec Intelligent Motion is the first to launch an electric clutch ECU for two-wheeled vehicles
- Bosch and Tsinghua University renew cooperation agreement on artificial intelligence research to jointly promote the development of artificial intelligence in the industrial field
- GigaDevice unveils new MCU products, deeply unlocking industrial application scenarios with diversified products and solutions
- Advantech: Investing in Edge AI Innovation to Drive an Intelligent Future
- CGD and QORVO will revolutionize motor control solutions
- 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?
- New breakthrough! Ultra-fast memory accelerates Intel Xeon 6-core processors
- New breakthrough! Ultra-fast memory accelerates Intel Xeon 6-core processors
- Consolidating vRAN sites onto a single server helps operators reduce total cost of ownership
- Consolidating vRAN sites onto a single server helps operators reduce total cost of ownership
- 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!
- [Shanghai Hangxin ACM32F070 development board evaluation] 3. Run the TouchKeyTool tool
- ST BLE online seminar: Principle analysis and application of ST BLE multi-connection technology
- Double gift for booking and viewing: KEE's latest courses in 2020
- What are the causes of IGBT damage in variable frequency power supply?
- AD620 instrumentation amplifier instructions
- Use Verilog to change the background color of ID photos
- Ask about DDR2 initialization problem
- Design and Application of Serial Communication Interface between TMS320F24x and PC
- Learn about the LSM6DSV16X 6-axis sensor with charge change detection
- LC78602NE Download