Interrupt priority from high to low
51 single-chip microcomputer: INT0 (P3.2), TIMER0, INT1 (P3.3), TIMER1, serial port interrupt (P3.0, P3.1)
52 single chip microcomputer:TIMER2
External interrupt falling edge trigger
Internal timer: TMOD register (M1M0)
M1 M0 method
0 0 0 13 bits
0 1 1 16 bits
1 0 2 8 auto
1 1 3 Two 8-bit
Serial port {RI->while(RI!)
TI->while(TI!)}
When an interrupt occurs while executing an instruction, execute this instruction first and then handle the interrupt.
The way the microcontroller exchanges information with the outside world: polling, interrupt, DMA
2451 53 interrupt sources
Program initial address: 0x30000000
Interrupt vector address: 0x00000000
Interrupt Mode:
IRQ: Normal trigger interrupt mode
FIQ: Fast interrupt mode (used in emergency situations, high priority)
register:
SRCPND1 first identification register, 32 bits, corresponding to the interrupt request, this position is 1, the default value is 0
INTMSK mask register, 32 bits, the corresponding interrupt is masked and this position is 1, the default is 1
INTPND tail mark register, 32 bits, same as the first mark register
SUBSRCPND sub-identification register, 32 bits,
INTSUBMSK Sub-mask register, 32 bits,
PRIORITY priority register, 28 bits,
INTMOD mode register, 32 bits, all set to 0 by default, 0 represents IRQ mode, 1 represents FIQ
(Not blocked)->INTMODE (IRQ)->PRIORITY (10, 12, 28)->INTPND (10 position 1)->INTOFFSET (set to 10)->TIMR0 interrupt service function (ISR)->INTPND, SRCPND, SUBSRCPN
Clear the 10th interrupt flag
1. Default priority order
2. No blocking
3.IRQ Mode
Timer interrupt:
51 single chip microcomputer:
Clock cycle: 1/110592M = 1.09us, 1/12M
Mechanical cycle: 12*1.09us,
2 mechanical cycles = 1 beat
Instruction cycle = several mechanical cycles (>=1)
T0, 1, 16-bit TH0 (high 8 bits); add count->65535 overflow
2^16 - 1 = 65535
12M Mechanical cycle 1us
65.535ms
Timing 50ms
TH0 = (65535-50000)/256; //high 8 bits
TL0 = (65535-50000)%256; //low 8 bits
2451:
PWM: Duty cycle High level time
register:
TCFG: Prescaler register, 32 bits
TCON: Timer control register, 22 bits
TCNTB: Count Register
TCMPB: Compare Register
TCNTO: Observing TCNTB
Simple timer initialization steps:
1. Configure the pre-scaling factor (199)
2. Configure the frequency division coefficient (8)
3. Configure the initial value of the count (41250)
4. Configure as automatic reload function (TCON)
5. Update initial value (TCON)
6. Start the timer (TCON)
7. Clear bit (Update initial value control bit) (TCON)
Previous article:ARM Study Notes---Serial Port
Next article:ARM Notes: ADC Converter
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
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
- Microchip Accelerates Real-Time Edge AI Deployment with NVIDIA Holoscan Platform
- Microchip Accelerates Real-Time Edge AI Deployment with NVIDIA Holoscan Platform
- Melexis launches ultra-low power automotive contactless micro-power switch chip
- Melexis launches ultra-low power automotive contactless micro-power switch chip
- 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
- Apple faces class action lawsuit from 40 million UK iCloud users, faces $27.6 billion in claims
- Apple faces class action lawsuit from 40 million UK iCloud users, faces $27.6 billion in claims
- The US asked TSMC to restrict the export of high-end chips, and the Ministry of Commerce responded
- The US asked TSMC to restrict the export of high-end chips, and the Ministry of Commerce responded
- CircuitPython 5.0.0 Alpha 5 released
- EEWORLD University Hall----Live Replay: Beineng International's New Glass Breakage Detection Solution
- Why do pirates wear eye patches? It turns out it’s not because they’re missing an eye!
- Solar Calculator Disassembly
- Overview of MCU bus, three-bus structure of MCU
- ESP8266 Zero-knowledge Tutorial: Using the WiFiScan Library
- Happy Goddess Day~~~~
- PCB development history
- Why open source hardware needs open source software
- UCC24624 Synchronous Rectifier Controller Improves LLC Resonant Converter Efficiency