- UID
- 863306
|
本帖最后由 feitiandadao 于 2012-1-31 10:16 编辑
stm8的外部中断经常进入两次,有源代码void, 在, include
本帖最后由 xt3203 于 2012-1-19 10:54 编辑
#include"stm8s105s4.h"
#define uint unsigned int
#define uchar unsigned char
_Bool LED1 @PA_ODR: 6;
_Bool LED2 @PA_ODR: 5;
_Bool LED3 @PA_ODR: 4;
_Bool K1 @PD_IDR: 4;
void EXTI_INIT(void)
{
EXTI_CR1 = 0x80;
}
void IO_INIT(void)
{
PA_DDR=0X70;
PA_CR1=0x70;
PD_CR1=0x10;
PD_CR2=0x10;
}
main()
{
_asm("sim");
EXTI_INIT();
IO_INIT();
_asm("rim");
LED1 = 1;
LED2 = 0;
LED3 = 1;
while (1);
}
@far @interrupt void KEY(void)
{
if(!K1) PA_ODR ^=0x70;
while(!K1);
}
在中断里把那几个LED取反一下而已,却发现中断经常进入两次,请问各位大哥怎么回事呀? |
|
|