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.

MSP430F5529: msp430f5529

Part Number: MSP430F5529

#include <msp430.h>
#include "oled.h"
#include "type.h"
#include "bmp.h"//配置IIC
#include"stdint.h"
#include<stdio.h>
#include<stdlib.h>
/**
 * main.c
 */
int  overflow_counter;
int DETA_counter;
int input_one_capture;
int capflag;
int input_one_counter;
int sample_times;
int avarge_period;
int f;
float f2;
int f3;
//void InitSys();
int main(void)
{
    WDTCTL = WDTPW | WDTHOLD;   // stop watchdog timer
    OLED_Init();
    P2SEL |= BIT4;//(p2.4为捕捉频率口)
          TA2CTL = TACLR;     TA2CTL=TASSEL_2+ID_0+MC_2+TAIE;     TA2CCTL1=CCIE +CAP +CCIS_0 +CM_1 + SCS;
          OLED_Clear();
          while(1){
          f=(int)1/(avarge_period*0.000001);
                 f2=f*0.05;
                 f3=f+f2;
                 OLED_ShowString(20,1,"fget=",20);
                 OLED_ShowNum(30,4,avarge_period,8,20);
          __bis_SR_register(LPM0_bits +GIE);
          }

}
#pragma vector=TIMER2_A1_VECTOR
__interrupt void TIMER2_A1_ISR(void)
{
    switch(TA2IV)
{
    case 2:  sample_times = 0;
              avarge_period= overflow_counter*65536-input_one_capture+TA2CCR1;
              input_one_capture = TA2CCR1;
              input_one_counter = DETA_counter;
              overflow_counter=0;
              capflag++;
break;
    case 4:
        break;
    case 6:
        break;
    case 8:
        break;
    case 10:
        break;
    case 12:
        break;
    case 14:overflow_counter++;
        DETA_counter++;
        break;

}
}
我使用MSP430f5529定时器测周法去做一个测量频率的功能,当输入频率过高时IIC屏幕不可以正常显示