Circuit Diagram:
code show as below:
Keywords:MCU
Reference address:MCU interrupt experiment 2
code show as below:
#include
#include
sbit p1_0 = P1^0;
sbit p1_1 = P1^1;
void delay (void) {
int a = 500;
while(a--) _nop_();
}
void LED_01() interrupt 0 using 1 {
delay();
if (INT0 == 0) {
p1_0 = !p1_0;
while (INT0 == 0);
}
}
void LED_02() interrupt 2 using 1 {
delay ();
if (INT1 == 0) {
p1_1 = !p1_1;
while (INT1 == 0);
}
}
void main () {
p1_0 = 0;
p1_1 = 0;
EA = 1;
EX0 = 1;
EX1 = 1;
while(1);
}
Previous article:MCU interrupt experiment 3
Next article:MCU interrupt experiment 1
Recommended ReadingLatest update time:2024-11-16 23:36
51 single chip microcomputer realizes 8x8LED light array to dynamically display moving text
I use the Puzhong Technology 51 single-chip microcomputer, other brands are also OK, but you need to change the serial port Without further ado, here is the code. //test1.h #include"reg51.h" #include"intrins.h" typedef unsigned char u8; typedef unsigned int u16; sbit SRCLK=P3^6; sbit RCLK =P3^5; sbit
[Microcontroller]
Timing Analysis of Power-on Reset and Reset Delay of 80C51 MCU
The power-on reset (POR) of the 80C51 microcontroller is essentially a power-on delay reset, which means that the microcontroller is locked in the reset state during the power-on delay period. Why is it necessary to add a certain delay time every time the microcontroller is powered on? The analysis is as follows.
[Industrial Control]
Do I need to buy a development board for self-study of microcontroller? How do beginners use microcontroller development boards?
It can be said that 99% of the old engineers who are engaged in microcontroller development, or the new microcontroller software engineers, have bought development boards, or have been using development boards to engage in microcontroller development. Some people may question this statement. If you question it, then y
[Microcontroller]
The difference between the two models of single-chip microcomputers: AT89C51 and AT89C52
There are two models of single chip microcomputers. The main difference is the capacity. The at89c51 supports a maximum of 4KB of program, while the at89c52 supports a maximum of 8KB of program. AT89C51 Introduction: AT89C51 is a low-voltage, high-performance CMOS 8-bit microprocessor with 4K bytes of FLASH memory (
[Microcontroller]
Microcontroller beginner's guide (9) Using a universal soldering board to build an experimental circuit
In this article, we will continue the topic of the previous article and explain another way to build your own circuit: using a universal soldering board to build a circuit. Before that, let's first popularize some basic knowledge.
Circuit Board
First, let's learn about circuit boards. As mentioned earlier, breadboar
[Microcontroller]
How to set parity check for serial communication of 51 single chip microcomputer
Usually, the format of a frame of serial communication is 8-n-1, that is, 8 bits of data, no parity, and 1 stop bit.
Sometimes, in order to improve accuracy, you need to add an "odd" or "even" check bit.
For high-level languages, it is very simple to do this. Just change the format command "8-n-1" to "8-P-1" or "8-O-
[Microcontroller]
MCU-based intelligent injection device can realize intelligent iontophoresis therapy
Iontophoresis is a treatment method that allows drugs to penetrate the human body through the skin. Drugs absorbed through the skin are charged mixtures that flow through the skin driven by an electric current. To inject the appropriate dose of drug, the current passing through the skin must be effectively controlle
[Medical Electronics]
Microcontrollers that combine Hi-Fi, intelligence and USB multi-channel features – ushering in a new era of digital audio
With the continuous integration of many technological breakthroughs and new streaming services, and the growing prosperity of the smart home and smart speaker markets, consumers' demand for audio is no longer limited to sound quality itself, but more about pursuing high-quality life experience and convenient smart i
[Analog Electronics]
- Popular Resources
- Popular amplifiers
- Wireless Sensor Network Technology and Applications (Edited by Mou Si, Yin Hong, and Su Xing)
- Modern Electronic Technology Training Course (Edited by Yao Youfeng)
- Modern arc welding power supply and its control
- Small AC Servo Motor Control Circuit Design (by Masaru Ishijima; translated by Xue Liang and Zhu Jianjun, by Masaru Ishijima, Xue Liang, and Zhu Jianjun)
Recommended Content
Latest Microcontroller Articles
He Limin Column
Microcontroller and Embedded Systems Bible
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
MoreSelected Circuit Diagrams
MorePopular Articles
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
MoreDaily News
- 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
Guess you like
- Teacher maychang's new work - interesting video about the history of electronic technology: the debate between AC and DC
- Detailed description of the debugging document of the NUCLEO-G431RB+IHM08-V4 three-resistor FOC (5.4.1 library) motor control board
- Pybricks: MicroPython for LEGO
- STM32 environment construction under MDK compiler
- [RVB2601 Creative Application Development] 6 score display, score +1 after eliminating letters
- The problem of connecting a resistor in series with a MOS and then connecting it in parallel with another resistor
- Interference Analysis and Countermeasures in High-Frequency PCB Design
- TI - MCU - MSP430 User Guide 13 -> Timer module
- Li Bai knew how to curse the Japanese in the Tang Dynasty
- Understanding characteristic impedance