keil c语言中断怎么写,keil 51 使用C语言的中断向量(Keil 51 USES the C language interrupt vector).doc...

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值