各位大哥帮我看下,义隆153单片机,定时器计数溢出无法进入中断,哪里配置不对呢?
#include "interrupt_vector.h"
#include "EM78P153A.h"
#define LED PORT6
void delay(unsigned short);
void main(void)
{
unsigned int i;
WDTCR=0;
TCC = 0;
P6CR = 0Xf0;
// IMR = 0x01;
_asm{
MOV A, @0x01 ; 允许计数器中断
IOW 0xf
ENI ; 开中断
}
ISR = 0;
_asm
{
mov a,@0x04
contw
}
while(1)
{
for(i=7;i>0;i--)
{
LED = i;
delay(60000);
}
}
}
void delay(unsigned short i)
{
unsigned short j;
for(j=0;j<60000;j++)
{
for(;i>0;i--)
{
;
}
}
}
void _intcall interrupt(void) @ int
{
ISR = 0;
_asm
{
reti //Tell Compiler to recover common registers here.
//Don't remove or duplicate this instruction in this function
}
} |