#include <reg52.h>
#include <intrins.h>
unsigned int dd, i;
void key() interrupt 0{
if(i == 0)
P2 = dd;
else{
dd = _roll_(dd,1);
P2 = dd;
}
i++;
}
void main(){
EA = 1; //Interrupt enable general control bit enabled
EX0 = 1; //External interrupt 0 interrupt enable bit
IT0 = 1; //0 means low level trigger, 1 means falling edge trigger
TR0 = 1; //1 means the timer/counter is working
dd = 0xfe;
i = 0;
while(1);
}
// By circularly shifting left, each time the INT0 interrupt is triggered, one light turns on.
//Definition of _crol_:
Previous article:51 MCU-Timer
Next article:51 MCU-button
Recommended ReadingLatest update time:2024-11-16 16:48
Practical analysis of 8051 microcontroller (taking STC89C52RC as an example) | 09 - LED dot matrix display of numbers
1 LED dot matrix LED dot matrix is a display device composed of light-emitting diodes. It can be seen everywhere in our daily electrical appliances and is widely used in bus station announcers, advertising screens, etc. The 8*8 dot matrix is usually used more often, and then multiple 8*8 dot matrices can be used t
[Microcontroller]
51 MCU Interrupt
51 MCU interrupt principle The concept of interruption: When the CPU is processing an event A, another event B occurs and requests the CPU to process it quickly (interrupt occurs). Then the CPU will suspend the current work (event A) and execute event B (interrupt response and interrupt service). After event B is comp
[Microcontroller]
51 MCU C Language Tutorial (I) Create the first project
Learning single-chip microcomputers is not an easy task. First, you need to buy expensive programmers and simulators, and second, you need to learn programming languages. There are also many types of single-chip microcomputers, which is a headache. Among the many single-chip microcomputers, the 51 architecture chip
[Microcontroller]
51 single chip simple waveform generator (sine wave, sawtooth wave, triangle wave)
The following is the source code of the simple waveform generator of 51 single-chip microcomputer: #include AT89X52.h #include math.h #define ADDR1 0x2c //MAX5820LEUA sbit key_sin=P1^0; sbit key_tran=P1^2; sbit key_tooth=P1^4; sbit SCL = P2 ^ 0; sbit SDA = P2 ^ 1; unsigned char code sin = //sine table
[Microcontroller]
Design and implementation of microwave radiation counting control unit based on 51 single chip microcomputer
Microwave radiometer is a microwave receiver that uses microwaves for remote sensing and thus detects ground objects. It is widely used in detecting the atmosphere, ocean, vegetation and soil. As an important part of the microwave radiometer, the data processing and control unit undertakes all the driving and contro
[Microcontroller]
Realizing DC motor speed regulation through 51 microcontroller
1. Project background and purpose With the widespread use of various industrial production equipment and mechanical equipment, the research and application of DC motor speed regulation technology has attracted more and more attention and has broad application prospects. This project uses the 51 microcontroller to real
[Microcontroller]
51 MCU Review 001
1. Change the font and keyword color settings of Keil Uvision3: Modify the order as follows 1 Open edit 2 Open edit configuration at the bottom 3 Open colars
4 Select 8051 edit c file to modify the size and keyword coloring issues of the C language. From http://zhidao.baidu.com/question/137561189.html 2. Bit de
[Microcontroller]
Optimization Method of Soft Clock Design in MCS-51 Single Chip Microcomputer
0 Introduction
With the popularization of microcomputer applications, microcomputer measurement and control systems with MCS-51 single-chip microcomputer as the core can be seen everywhere. To meet user requirements, these systems usually have the function of digital display clock. Since MCS-51 contains two ti
[Microcontroller]
- Popular Resources
- Popular amplifiers
- MCU C language programming and Proteus simulation technology (Xu Aijun)
- 100 Examples of Microcontroller C Language Applications (with CD-ROM, 3rd Edition) (Wang Huiliang, Wang Dongfeng, Dong Guanqiang)
- Fundamentals and Applications of Single Chip Microcomputers (Edited by Zhang Liguang and Chen Zhongxiao)
- Single chip microcomputer control technology (Li Shuping, Wang Yan, Zhu Yu, Zhang Xiaoyun)
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
- What does the accuracy and resolution of a servo encoder affect?
- MSP430G2553 clock system configuration considerations
- 【Running posture training shoes】No.005-Posture recognition and step frequency calculation
- 【TMS320 frequency measurement】Newbie's second post! TMS320F28379D Launchpad environment configuration
- CC1310 switching rate method
- Experience in using arrays, strnpy functions, and atoi functions in DSP projects
- Continuous integration plus self-shielding-5G RF focus
- The location of the essence chapter affects its use
- Small base stations help 5G connections and fill wireless coverage "gaps"!
- [Zhongke Bluexun AB32VG1 RISC-V board "run into" RTT evaluation] ADC