This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2530多通道外部中断

Other Parts Discussed in Thread: CC2530

尊敬的工程师:

       问一个关于CC2530多通道外部中断问题。配置P0_0和P0_6同时为外部中断,两个中断都是由外部定时触发。每个中断触发之后,记录当前时间(读取timer1相应寄存器),两个中断的间隔约为200us。中断函数代码如下。

       调试时存在问题是:P0_0能够读取正确时间,P0_6中断触发后读的时间不正确。

       问题原因是什么呢?P0_0和P0_6不独立;还是两次中断间隔太短;还是读timer时间有问题。

       希望能够得到回复。

#pragma vector = P0INT_VECTOR
__interrupt void P0_ISR(void)
{
if(P0IFG>0)
{
uint16_t TL,TH;
uint16_t THL;
if(P0IFG&0x01)
{
P0IFG&=~0x01;
TL=T1CNTL;
TH=T1CNTH;
THL = (TH<<8)+TL;
}
if(P0IFG&0x40)
{
P0IFG&=~0x40;
TL=T1CNTL;
TH=T1CNTH;
THL = (TH<<8)+TL;
}
}
IRCON&=~0x20;
}