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.
在使用MSP430F5XX的库,发现定时器demo中没有系统时钟的初始化代码,上来就是配置定时器的参数,这是怎么回事?
void main(void)
{
//Stop WDT
WDT_A_hold(WDT_A_BASE);
//Set P1.0 to output direction
GPIO_setAsOutputPin(
GPIO_PORT_P1,
GPIO_PIN0
);
//Start timer in continuous mode sourced by ACLK
Timer_A_clearTimerInterrupt(TIMER_A1_BASE);
Timer_A_initContinuousModeParam param = {0};
param.clockSource = TIMER_A_CLOCKSOURCE_ACLK;
param.clockSourceDivider = TIMER_A_CLOCKSOURCE_DIVIDER_1;
param.timerInterruptEnable_TAIE = TIMER_A_TAIE_INTERRUPT_ENABLE;
param.timerClear = TIMER_A_DO_CLEAR;
param.startTimer = true;
Timer_A_initContinuousMode(TIMER_A1_BASE, ¶m);
//Enter LPM0, enable interrupts
__bis_SR_register(LPM0_bits + GIE);
//For debugger
__no_operation();
}您可以看一下ucs.h内的说明
//! This function initializes each of the clock signals. The user must ensure
//! that this function is called for each clock signal. If not, the default
//! state is assumed for the particular clock signal. Refer MSP430Ware
//! documentation for UCS module or Device Family User's Guide for details of
//! default clock signal states.
//*****************************************************************************
//
//! \brief Initializes a clock signal
//!
//! This function initializes each of the clock signals. The user must ensure
//! that this function is called for each clock signal. If not, the default
//! state is assumed for the particular clock signal. Refer MSP430Ware
//! documentation for UCS module or Device Family User's Guide for details of
//! default clock signal states.
//!
//! \param selectedClockSignal selected clock signal
//! Valid values are:
//! - \b UCS_ACLK
//! - \b UCS_MCLK
//! - \b UCS_SMCLK
//! - \b UCS_FLLREF
//! \param clockSource is clock source for the selectedClockSignal
//! Valid values are:
//! - \b UCS_XT1CLK_SELECT
//! - \b UCS_VLOCLK_SELECT
//! - \b UCS_REFOCLK_SELECT
//! - \b UCS_DCOCLK_SELECT
//! - \b UCS_DCOCLKDIV_SELECT
//! - \b UCS_XT2CLK_SELECT
//! \param clockSourceDivider selected the clock divider to calculate
//! clocksignal from clock source.
//! Valid values are:
//! - \b UCS_CLOCK_DIVIDER_1 [Default]
//! - \b UCS_CLOCK_DIVIDER_2
//! - \b UCS_CLOCK_DIVIDER_4
//! - \b UCS_CLOCK_DIVIDER_8
//! - \b UCS_CLOCK_DIVIDER_12 - [Valid only for UCS_FLLREF]
//! - \b UCS_CLOCK_DIVIDER_16
//! - \b UCS_CLOCK_DIVIDER_32 - [Not valid for UCS_FLLREF]
//!
//! Modified bits of \b UCSCTL5 register, bits of \b UCSCTL4 register and bits
//! of \b UCSCTL3 register.
//!
//! \return None
//
//*****************************************************************************
extern void UCS_initClockSignal(uint8_t selectedClockSignal,
uint16_t clockSource,
uint16_t clockSourceDivider);我指的是这个,默认的bitValue是啥含义?
//! - \b TIMER_A_OUTPUTMODE_OUTBITVALUE [Default]
//! - \b TIMER_A_OUTPUTMODE_SET
//! - \b TIMER_A_OUTPUTMODE_TOGGLE_RESET
//! - \b TIMER_A_OUTPUTMODE_SET_RESET
//! - \b TIMER_A_OUTPUTMODE_TOGGLE
//! - \b TIMER_A_OUTPUTMODE_RESET
//! - \b TIMER_A_OUTPUTMODE_TOGGLE_SET
//! - \b TIMER_A_OUTPUTMODE_RESET_SET
uint16_t compareOutputMode;