最近根据12C5410AD的芯片手册按照例程写一个程序打算做小车的测速,但是无论如何都触发不了中断,请各位大侠指教,源码很简单如下
#include<STC12C5410AD.h>
sbit Led = P2^2;
sbit EPCAI = IE^6;
void PCA_isr()interrupt 6 using 2
{
CCF0 = 0;
Led = !Led;
}
void main()
{
CCON = 0;
CL = 0;
CH = 0;
CMOD = 0x01;
CCAPM0 = 0x31; //寄存器定义为触发中断
CR = 1; //开始计数
EPCAI = 1; //开PCA的中断
EA = 1; //开总中断
while(1);
}
之前以为是工作组的interrupt 6和7的问题,但是怎么改也无法触发中断 |