keil 51 使用C语言的中断向量(Keil 51 USES the C language interrupt vector)
keil 51 使用C语言的中断向量(Keil 51 USES the C language interrupt vector)
The vector position of the interrupt source
Interrupt source Keil interrupt number vector address
High priority 6 0x0033
External interrupt 0 0 0x0003
The timer 0 overflow 1 0x000B
External interrupt 1 2 0x0013
Timer 1 overflow 3 0x001B
A serial port 4 0 x0023
Timer 2 overflow 5 0x002B
The DMA 7 0 x003b
Hardware breakpoint 8 0x0043
JTAG 9 0 x004b
Software breakpoint 10 0x0053
Monitor timer 12 0x0063
The extension of C language on the 8051 single chip microcomputer (the usage of interrupt and using keywords) (2008-06-26 14:12:36) is reprinted in the label: interruptusingc language it
The extension of C language on the 8051 single chip microcomputer (interrupt, using keywords)
Direct access to registers and ports
define
SFR P0 0 x80
SFR P1 0 x81
SFR ADCON; 0 xde
Sbit EA 0 x9f
operation
ADCON = 0 x08;
P1 = 0 XFF;
Io_status = P0;
EA = 1;
After using the interrupt 1 keyword, the interrupt vector is automatically generated
You can't share local variables with other "the background loop code" in the ISR
Because the connector will reuse the location of these variables in RAM, they will have different meanings depending on the different functions that are currently being used
Multiplexing variables will be important to RAM limited 51. So, these functions want to execute in a certain order and not be interrupted.
Timer0_int () interrupt 1 using 2
{
Unsigned char temp1;
Unsigned char temp2;
The executable C statements;
}
The "interrupt" statement says that the vector is generated in (8 * n + 3), where n is the number after the interrupt parameter
Here, the LJMP timer0_int is generated in the code area of 08H
"Using" tells the compiler to switch register Banks on entry to an interrupt routine.
This "context" switch is the fastest way of providing a fresh registerbank for an interrupt routine 's local data and is to be preferred to stacking registers for very time - critical routines. Note that interrupts of the sa