51 MCU-Interrupt

Publisher:幸福时光Latest update time:2015-04-09 Source: cechina Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere



  



  



  
#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_: 
Reference address:51 MCU-Interrupt

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]
Practical analysis of 8051 microcontroller (taking STC89C52RC as an example) | 09 - LED dot matrix display of numbers
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 Interrupt
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 MCU C Language Tutorial (I) Create the first project
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]
51 single chip simple waveform generator (sine wave, sawtooth wave, triangle wave)
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]
Design and implementation of microwave radiation counting control unit based on 51 single chip microcomputer
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]
Realizing DC motor speed regulation through 51 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]
51 MCU Review 001
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]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号