如题,使用CC2530测量外部频率的时候总是没有反应,引用的LCD头文件是例程里面的
#include <ioCC2530.h>
#include "LCD.h"
#define uchar unsigned char
#define uint unsigned int
typedef struct FREQ
{
uchar start;
uint timer;
uint int_Count;
uint T;
}FREQ;
FREQ freq={0,0};
void InitT3(void);
void InitExtern(void);
void display_freq(void);
void InitT3()
{
T3IE |= 1;
T3CTL |= 0x08; //中断使能
T3CTL |= 0xE0; //128分频,即125KHz,|| 1110 0000,
T3CTL &= ~0x03; //正计数/倒计数,从0x0000到0xffff反复计数
T3CTL |= 0x10; //启动定时器
EA=1;
}
void InitExtern()
{
P0IEN |= 0x2;//设置引脚P0_1为外部中断模式
PICTL |= 0x2;//设置外部中断下降沿中断
IEN1 |= 0x20;//使能P0端口中断
P0IFG |= 0x00;//中断标志清零
EA = 1; //中断总开关
}
#pragma vector = T3_VECTOR
__interrupt void T3_ISR(void)
{
if(freq.start)
{
freq.timer++;
}
else {
freq.timer = 0;
}
}
#pragma vector = P0INT_VECTOR __interrupt void P0_ISR(void) {
if(freq.start)
{
freq.int_Count++; //开始统计下跳沿
}
else
{
freq.int_Count=0;
} }
void main(void)
{
InitT3();
InitExtern();
freq.start = 1;
while(1)
{
if(freq.timer >= 490)
{
freq.T=freq.timer/freq.int_Count;
freq.int_Count=0;
freq.timer=0; }
display_freq(); //显示周期的值
}
}
VV:
请问具体问题在哪