/*
* TA_CAP.C
*
* Created on: 2013-7-30
* Author: Administrator
*/
#include<msp430f5529.h>
//
unsigned new_cap =0;
unsigned old_cap =0;
unsigned cap_diff =0;
unsigned int diff_array[16];
unsigned int capture_array[16];
unsigned char index =0;
unsigned char count =0;
//
void main(void)
{
volatile unsigned int i;
WDTCTL = WDTPW + WDTHOLD;
for (i=0;i<20000;i++)
{}
//配置端口
P8DIR |=0X02; //P8.1输出
P8OUT &=~0X02; //P8.1取反输出
P1SEL |=BIT0 + BIT1; //P1.1为模块功能,即TA0,P1.0为模块功能,即ACLK信号输出
P1DIR =BIT0;
//配置时钟源
UCSCTL5 |=DIVA_3; //ACLK信号8分频
//配置定时器
TA0CCTL0 = CM_1 + SCS + CCIS_0 + CAP + CCIE;
//上升沿捕获+同步+CCI0A(P1.1)+捕获 模式+捕获模式使能
TA0CTL = TASSEL_2 + MC_2;
//选SMCLK为定时器时钟信号+连续计数模式
_BIS_SR(LPM0_bits + GIE);
}
//进入中断服务程序
#pragma vector = TIMER0_A0_VECTOR
__interrupt void TIMER0_A0_ISR(void)
{
new_cap = TA0CCR0;
cap_diff = new_cap - old_cap;
diff_array[index] = cap_diff;
capture_array[index++] = new_cap;
if (index == 16)
{
index = 0;
P8OUT ^= BIT1;
}
old_cap = new_cap;
count++;
if (count == 32)
{
count = 0;
_nop();
}
}
这是参考一个教程例子的,网络上有说可以忽略这些警告,但是为什么出现这样的警告,怎么解决呢?期待得到大家的指导!谢谢!~~

