老来多遗忘 发表于 2012-12-5 10:39:13

关于nsp430固件库使用问题

我在使用MSP430F5xx_6xx的driverlib时在调用#include "timer_a.c"时会报错,错误如下:

Error: identifier "OFS_TAxCTL" is undefined F:\driverlib\MSP430F5xx_6xx\timer_a.c 79
Error: identifier "OFS_TAxCTL" is undefined F:\driverlib\MSP430F5xx_6xx\timer_a.c 183
。。。。。。。。

此类错误有十几个,把#include "timer_a.c“屏蔽就ok了,请问大家是什么问题? 源程序如下

#include "debug.h"
#include <msp430f5529.h>
#include "inc/hw_memmap.h"
#include "ucs.h"
#include "ucs.c"
#include "pmm.h"
#include "pmm.c"
#include "wdt_a.h"
#include "wdt_a.c"
#include "gpio.h"
#include "gpio.c"
#include "sfr.h"
#include "sfr.c"
#include "timer_a.h"
#include "timer_a.c"
#define TIMER_A_PERIOD 32768

//*****************************************************************************
//
//Target frequency for MCLK in kHz
//
//*****************************************************************************
#define UCS_MCLK_DESIRED_FREQUENCY_IN_KHZ   12000

//*****************************************************************************
//
//MCLK/FLLRef Ratio
//
//*****************************************************************************
#define UCS_MCLK_FLLREF_RATIO   366

//*****************************************************************************
//
//Variable to store current Clock values
//
//*****************************************************************************
unsigned long clockValue = 0;

//*****************************************************************************
//
//Variable to store status of Oscillator fault flags
//
//*****************************************************************************
unsigned int status;
void main(void)
{
   

   //Stop WDT
    WDT_A_hold(WDT_A_BASE);

    //Set VCore = 1 for 12MHz clock
   PMM_setVCore(PMM_BASE,
       PMM_CORE_LEVEL_1
      );

    //Set P8.0 ,P8.1to output direction
    GPIO_setAsOutputPin(
      GPIO_PORT_P8,
      GPIO_PIN0+GPIO_PIN1
      );


    //Set DCO FLL reference = XT1CLK
UCS_clockSignalInit(
      UCS_BASE,
      UCS_FLLREF,
      UCS_XT1CLK_SELECT,
      UCS_CLOCK_DIVIDER_1
      );
    //Set ACLK = REFO
    UCS_clockSignalInit(
      UCS_BASE,
      UCS_ACLK,
         UCS_XT1CLK_SELECT,
      UCS_CLOCK_DIVIDER_1
      );

    //Set Ratio and Desired MCLK Frequency 12MHzand initialize DCO
   UCS_initFLLSettle(
      UCS_BASE,
      UCS_MCLK_DESIRED_FREQUENCY_IN_KHZ,
      UCS_MCLK_FLLREF_RATIO
      );
   
    // Enable global oscillator fault flag
    SFR_enableInterrupt(SFR_BASE,
                        SFR_OSCILLATOR_FAULT_INTERRUPT
                        );
   
TIMER_A_configureUpDownMode(
      TIMER_A1_BASE,
      TIMER_A_CLOCKSOURCE_ACLK,
      TIMER_A_CLOCKSOURCE_DIVIDER_1,
      TIMER_A_PERIOD,
      TIMER_A_TAIE_INTERRUPT_ENABLE,
      TIMER_A_CAPTURECOMPARE_INTERRUPT_DISABLE,
      TIMER_A_DO_CLEAR
      );

    TIMER_A_startCounter(
                TIMER_A1_BASE,
                TIMER_A_UPDOWN_MODE
                );

    // Enable global interrupt
    __bis_SR_register(GIE);   

   //Start timer in up down mode
   
    //Enter LPM3
    __bis_SR_register(LPM3_bits);

    //For debugger
    __no_operation();
    //Verify if the Clock settings are as expected
    clockValue = UCS_getSMCLK(UCS_BASE);
    clockValue = UCS_getMCLK(UCS_BASE);
    clockValue = UCS_getACLK(UCS_BASE);
   
while (1)                                 // Test LED
{
   
   P8OUT = (BIT2);
      P8OUT = (BIT1);
   
}
}

/*#pragma vector=TIMER1_A0_VECTOR
__interrupt void TIMER1_A0_ISR(void)
{
   P8OUT ^= (BIT2);
      P8OUT ^= (BIT1);
LPM3_EXIT;                     
}
*/

老来多遗忘 发表于 2012-12-5 15:52:48

哪位大哥指点一下? 我问TI代理的技术支持,他没用过

geniuskim 发表于 2012-12-5 16:44:15

看看你的头文件,OFS_TAxCTL有没有定义,或者程序里最后x有没有被替换成数字。

另外有时候头文件总变来变去的,很是烦人,而且变来变去也不一定没错误。

tns9728 发表于 2012-12-5 21:30:08

不如把timer_a.c贴出来看看{:lol:}
页: [1]
查看完整版本: 关于nsp430固件库使用问题