C51 interrupt function format

Publisher:AmybabyLatest update time:2018-11-30 Source: eefocusKeywords:C51 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

C51 Keil compiler interrupt function syntax definition:


void function name() interrupt n using m


The C51 compiler allows 0 to 31 interrupts. The interrupts and interrupt addresses provided by the C51 controller are as follows:


Interrupt number Interrupt source Interrupt address


0 EXTERNAL 0 0003H


1 TIMER/COUNTER 0 000BH


2 EXTERNAL 1 0013H


3 TIMER/COUNTER 1 001BH


4 SERIAL PORT 0023H


Interrupt function writing rules:


Parameter passing is not possible


No return value


In any case, the interrupt function cannot be called directly


You can use using to specify the register group currently used in the interrupt function definition. 


void function name() intrrupt n using m 


R0~R7 are divided into 4 groups m: 0, 1, 2, 3


Keywords:C51 Reference address:C51 interrupt function format

Previous article:Watchdog in-depth analysis
Next article:Interrupt function and interrupt handling function

Recommended ReadingLatest update time:2024-11-16 16:56

C51---Oscilloscope---2ms square wave
/* //Query mode, output square wave #include sbit p1_0=P1^0; void main() { p1_0=1; TMOD=0x01; //Select timer 0, working mode 1 TH0=(65535-1000)/256; TL0=(65536-1000)%256; TR0=1; //Start timer 0 p1_0=0; while(1) { if(TF0==1) { p1_0=~p1_0; TF0=0; // Clear the interrupt flag TH0=(65535-1000)/256; T
[Microcontroller]
C51---Oscilloscope---2ms square wave
C51 menu programming example
/* Module :Kbdmenu.c Date:------ Usage:P10~P12 use to DownKey,UpKey,CRKey */ #i nclude  #i nclude #define SIZE_OF_KEYBD_MENU 20 //Menu length float KeyFuncIndex=0; //flying KeyFuncIndexNew=0; void (*KeyFuncPtr)(); //Key function pointer typedef struct { uchar KeyStateIndex; //Current state index number uchar KeyDnSta
[Microcontroller]
How does keil c51 start the c program?
Assembly starts from org 0000h, so how does keil c51 start the main() function? keil c51 has a startup program startup.a51, which is always compiled and linked with the c program. Let’s see how it and the main() function are compiled;   //The main function is as follows; void main(void) { while (1) This is an uncondit
[Microcontroller]
C51 program for breathing light
During this year's Spring Festival, I saw a lot of popular lights on the streets, which were very beautiful. Today, when I was reading a book about single-chip microcomputers, I saw an example of making a breathing light. After thinking about it, I found that the meteor light is made of many breathing lights. I look
[Microcontroller]
C51 MCU_Waveform Generator
Course design content and requirements: Task: Use the microcontroller and DAC0832 chip to generate sawtooth waves and square waves, and display the frequency of the generated waves on the digital tube. Design requirements: 1. Electronic simulation and test circuits. 2. Complete the course design report independe
[Microcontroller]
C51 MCU_Waveform Generator
Keil c51 C program delay time
If you want a very precise delay, you can use a timer. The timing of C language is difficult to calculate. You can use the software simulation in KEIL to see how long it takes to run your subroutine. This is the clearest way. Of course, if your programming ability has reached a relatively high level, it is another mat
[Microcontroller]
Learning experience of addressing mode of single chip microcomputer C51 assembly instruction
1. Register addressing Instruction example: MOV A, R0 This instruction function: Send the content in register R0 to accumulator A Detailed description: Assuming that the content in R0 is the hexadecimal number 20H, then after executing this instruction, the content in accumulator A is 20H, which is the decimal n
[Microcontroller]
Microcontroller Teaching Based on Keil C51 Integrated Development Environment
1. Introduction The reform and practice of MCU teaching is a kind of teaching activity to better enable students to transform the theoretical knowledge of MCU they have learned into practical abilities to adapt to social development and employment needs. Nowadays, one of the main tasks of vocational education i
[Microcontroller]
Microcontroller Teaching Based on Keil C51 Integrated Development Environment
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号