TI中文支持网
TI专业的中文技术问题搜集分享网站

MSP430FR2433的TA0R计数器问题

Hi TI team:

1、在使用MSP430FR2433的TA0R不计数,发现如果执行延时函数,TA0R能够正常计时,但是其他的语句无法让TA0R计时;

2、想了解下在主频配置或者定时器初始化有什么不一样的地方?现在用的是16M主频,对输入时钟进行了8分频,8s中断唤醒一次

3、又测试发现如果定时器时钟源选择ACLK只有经过延时函数定时器可以正常计时,其他语句指令不计时,时钟源选择SMCLK时,所有指令都可以正常计时。附件是测试程序。Test.txt

Susan Yang:

您的源码是不是不全?编译后有很多未定义

请给出完整代码,我会在测试后回复

Maureen Hong:

回复 Susan Yang:

Susan:
主频配置或者定时器初始化和flash型单片机有什么不一样的地方?

Susan Yang:

回复 Maureen Hong:

这个建议您看一下移植指南内的 7.2 Clock System 以及 8.5 Timer and IR Modulation Logic

file.elecfans.com/…/o4YBAFnLh0OAMZjZAANywuLNynU627.pdf

Maureen Hong:

回复 Susan Yang:

您这边测试跑例程是否会有出现同样情况。

Susan Yang:

回复 Maureen Hong:

我测试了下例程 MSP430FR243x Demo – Timer0_A3, PWM TA0.1-2, Up Mode, 32KHz ACLK ,可以计数的·

Maureen Hong:

回复 Susan Yang:

Susan:时钟源为SMCLK的可以正常计数,时钟源为ACLK时计数有问题。可以测试ACLK为时钟源的嘛

Susan Yang:

回复 Maureen Hong:

测试的是 MSP430F55xx_ta0_04.c                              Timer0_A5, Toggle P1.0, Overflow ISR, 32kHz ACLK

也是可以计数的。请您使用例程测试一下

Maureen Hong:

回复 Susan Yang:

Susan: 我拿例程测试时单步执行还是无法计数;您可以将您测试例程发我一下。另外我测试程序如下。CHESHI.txt

Susan Yang:

回复 Maureen Hong:

对于MSP430,查看定时器寄存器的话,建议不要单步,您可以设置断点或者全速运行后暂停查看

测试例程如下

/* --COPYRIGHT--,BSD_EX* Copyright (c) 2014, Texas Instruments Incorporated* All rights reserved.** Redistribution and use in source and binary forms, with or without* modification, are permitted provided that the following conditions* are met:** *Redistributions of source code must retain the above copyright*notice, this list of conditions and the following disclaimer.** *Redistributions in binary form must reproduce the above copyright*notice, this list of conditions and the following disclaimer in the*documentation and/or other materials provided with the distribution.** *Neither the name of Texas Instruments Incorporated nor the names of*its contributors may be used to endorse or promote products derived*from this software without specific prior written permission.** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.**********************************************************************************MSP430 CODE EXAMPLE DISCLAIMER** MSP430 code examples are self-contained low-level programs that typically* demonstrate a single peripheral function or device feature in a highly* concise manner. For this the code may rely on the device's power-on default* register values and settings such as the clock configuration and care must* be taken when combining code from several examples to avoid potential side* effects. Also see www.ti.com/grace for a GUI- and www.ti.com/msp430ware* for an API functional library-approach to peripheral configuration.** --/COPYRIGHT--*/
//******************************************************************************
//MSP430FR24xx Demo - Timer0_A3, Toggle P1.0, Overflow ISR, 32kHz ACLK
//
//Description: Toggle P1.0 using software and the Timer0_A overflow ISR.
//In this example an ISR triggers when TA overflows. Inside the ISR P1.0
//is toggled. Toggle rate is exactly 0.5Hz. Proper use of the TAIV interrupt
//vector generator is demonstrated.
//
//ACLK = TACLK = 32768Hz, MCLK = SMCLK = 8MHz/2
//
//
//MSP430FR2433
//-----------------
///|\||
//| ||
//--|RST|
//||
//|P1.0|--> LED
//
//
//Wei Zhao
//Texas Instruments Inc.
//Jan 2014
//Built with IAR Embedded Workbench v6.20 & Code Composer Studio v6.0.1
//******************************************************************************
#include <msp430.h>int main(void)
{WDTCTL = WDTPW | WDTHOLD;// Stop WDT// Configure clock__bis_SR_register(SCG0);// disable FLLCSCTL3 = SELREF__REFOCLK;// Set REFOCLK as FLL reference sourceCSCTL0 = 0;// clear DCO and MOD registersCSCTL1 &= ~(DCORSEL_7);// Clear DCO frequency select bits firstCSCTL1 |= DCORSEL_3;// Set DCOCLK = 8MHzCSCTL2 = FLLD_1 + 121;// FLLD = 1, by default, DCODIV = DCO/2 = 4MHz__delay_cycles(3);__bic_SR_register(SCG0);// enable FLLwhile(CSCTL7 & (FLLUNLOCK0 | FLLUNLOCK1));// Poll until FLL is lockedCSCTL4 = SELMS__DCOCLKDIV | SELA__REFOCLK;// set ACLK = REFOCLK = 32768Hz, DCOCLK as MCLK and SMCLK sourceCSCTL5 |= DIVM0 | DIVS0;// SMCLK = MCLK = DCODIV = 4MHz// Configure GPIOP1DIR |= BIT0;P1OUT |= BIT0;// Disable the GPIO power-on default high-impedance mode to activate// previously configured port settingsPM5CTL0 &= ~LOCKLPM5;// Configure Timer_ATA0CTL = TASSEL_1 | MC_2 | TACLR | TAIE;// ACLK, count mode, clear TAR, enable interrupt__bis_SR_register(LPM3_bits | GIE);// Enter LPM3, enable interrupts__no_operation();// For debugger
}// Timer0_A3 Interrupt Vector (TAIV) handler
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=TIMER0_A1_VECTOR
__interrupt void TIMER0_A1_ISR(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(TIMER0_A1_VECTOR))) TIMER0_A1_ISR (void)
#else
#error Compiler not supported!
#endif
{switch(__even_in_range(TA0IV,TA0IV_TAIFG)){case TA0IV_NONE:break;// No interruptcase TA0IV_TACCR1:break;// CCR1 not usedcase TA0IV_TACCR2:break;// CCR2 not usedcase TA0IV_TAIFG:P1OUT ^= BIT0;// overflowbreak;default:break;}
}

Maureen Hong:

回复 Susan Yang:

Susan:谢谢。之前用FXX的单片机可以单步调试可以看得到。这个是FR系列和FXX系列的区别么。

赞(0)
未经允许不得转载:TI中文支持网 » MSP430FR2433的TA0R计数器问题
分享到: 更多 (0)