MSP430 DriverLib for MSP430FR2xx_4xx Devices  2.10.00.09
 All Data Structures Functions Variables Modules Pages
timer_a

Functions

void Timer_A_startCounter (uint16_t baseAddress, uint16_t timerMode)
 Starts Timer_A counter. More...
 
void Timer_A_initContinuousMode (uint16_t baseAddress, Timer_A_initContinuousModeParam *param)
 Configures Timer_A in continuous mode. More...
 
void Timer_A_initUpMode (uint16_t baseAddress, Timer_A_initUpModeParam *param)
 Configures Timer_A in up mode. More...
 
void Timer_A_initUpDownMode (uint16_t baseAddress, Timer_A_initUpDownModeParam *param)
 Configures Timer_A in up down mode. More...
 
void Timer_A_initCaptureMode (uint16_t baseAddress, Timer_A_initCaptureModeParam *param)
 Initializes Capture Mode. More...
 
void Timer_A_initCompareMode (uint16_t baseAddress, Timer_A_initCompareModeParam *param)
 Initializes Compare Mode. More...
 
void Timer_A_enableInterrupt (uint16_t baseAddress)
 Enable timer interrupt. More...
 
void Timer_A_disableInterrupt (uint16_t baseAddress)
 Disable timer interrupt. More...
 
uint32_t Timer_A_getInterruptStatus (uint16_t baseAddress)
 Get timer interrupt status. More...
 
void Timer_A_enableCaptureCompareInterrupt (uint16_t baseAddress, uint16_t captureCompareRegister)
 Enable capture compare interrupt. More...
 
void Timer_A_disableCaptureCompareInterrupt (uint16_t baseAddress, uint16_t captureCompareRegister)
 Disable capture compare interrupt. More...
 
uint32_t Timer_A_getCaptureCompareInterruptStatus (uint16_t baseAddress, uint16_t captureCompareRegister, uint16_t mask)
 Return capture compare interrupt status. More...
 
void Timer_A_clear (uint16_t baseAddress)
 Reset/Clear the timer clock divider, count direction, count. More...
 
uint8_t Timer_A_getSynchronizedCaptureCompareInput (uint16_t baseAddress, uint16_t captureCompareRegister, uint16_t synchronized)
 Get synchronized capturecompare input. More...
 
uint8_t Timer_A_getOutputForOutputModeOutBitValue (uint16_t baseAddress, uint16_t captureCompareRegister)
 Get output bit for output mode. More...
 
uint16_t Timer_A_getCaptureCompareCount (uint16_t baseAddress, uint16_t captureCompareRegister)
 Get current capturecompare count. More...
 
void Timer_A_setOutputForOutputModeOutBitValue (uint16_t baseAddress, uint16_t captureCompareRegister, uint8_t outputModeOutBitValue)
 Set output bit for output mode. More...
 
void Timer_A_outputPWM (uint16_t baseAddress, Timer_A_outputPWMParam *param)
 Generate a PWM with timer running in up mode. More...
 
void Timer_A_stop (uint16_t baseAddress)
 Stops the timer. More...
 
void Timer_A_setCompareValue (uint16_t baseAddress, uint16_t compareRegister, uint16_t compareValue)
 Sets the value of the capture-compare register. More...
 
void Timer_A_clearTimerInterrupt (uint16_t baseAddress)
 Clears the Timer TAIFG interrupt flag. More...
 
void Timer_A_clearCaptureCompareInterrupt (uint16_t baseAddress, uint16_t captureCompareRegister)
 Clears the capture-compare interrupt flag. More...
 
uint16_t Timer_A_getCounterValue (uint16_t baseAddress)
 Reads the current timer count value. More...
 

Detailed Description

Function Documentation

void Timer_A_clear ( uint16_t  baseAddress)

Reset/Clear the timer clock divider, count direction, count.

Parameters
baseAddressis the base address of the TIMER_A module.

Modified bits of TAxCTL register.

Returns
None
void Timer_A_clearCaptureCompareInterrupt ( uint16_t  baseAddress,
uint16_t  captureCompareRegister 
)

Clears the capture-compare interrupt flag.

Parameters
baseAddressis the base address of the TIMER_A module.
captureCompareRegisterselects the Capture-compare register being used. Valid values are:
  • TIMER_A_CAPTURECOMPARE_REGISTER_0
  • TIMER_A_CAPTURECOMPARE_REGISTER_1
  • TIMER_A_CAPTURECOMPARE_REGISTER_2

Modified bits are CCIFG of TAxCCTLn register.

Returns
None
void Timer_A_clearTimerInterrupt ( uint16_t  baseAddress)

Clears the Timer TAIFG interrupt flag.

Parameters
baseAddressis the base address of the TIMER_A module.

Modified bits are TAIFG of TAxCTL register.

Returns
None
void Timer_A_disableCaptureCompareInterrupt ( uint16_t  baseAddress,
uint16_t  captureCompareRegister 
)

Disable capture compare interrupt.

Parameters
baseAddressis the base address of the TIMER_A module.
captureCompareRegisteris the selected capture compare register Valid values are:
  • TIMER_A_CAPTURECOMPARE_REGISTER_0
  • TIMER_A_CAPTURECOMPARE_REGISTER_1
  • TIMER_A_CAPTURECOMPARE_REGISTER_2

Modified bits of TAxCCTLn register.

Returns
None
void Timer_A_disableInterrupt ( uint16_t  baseAddress)

Disable timer interrupt.

Parameters
baseAddressis the base address of the TIMER_A module.

Modified bits of TAxCTL register.

Returns
None
void Timer_A_enableCaptureCompareInterrupt ( uint16_t  baseAddress,
uint16_t  captureCompareRegister 
)

Enable capture compare interrupt.

Does not clear interrupt flags

Parameters
baseAddressis the base address of the TIMER_A module.
captureCompareRegisteris the selected capture compare register Valid values are:
  • TIMER_A_CAPTURECOMPARE_REGISTER_0
  • TIMER_A_CAPTURECOMPARE_REGISTER_1
  • TIMER_A_CAPTURECOMPARE_REGISTER_2

Modified bits of TAxCCTLn register.

Returns
None
void Timer_A_enableInterrupt ( uint16_t  baseAddress)

Enable timer interrupt.

Does not clear interrupt flags

Parameters
baseAddressis the base address of the TIMER_A module.

Modified bits of TAxCTL register.

Returns
None
uint16_t Timer_A_getCaptureCompareCount ( uint16_t  baseAddress,
uint16_t  captureCompareRegister 
)

Get current capturecompare count.

Parameters
baseAddressis the base address of the TIMER_A module.
captureCompareRegisterValid values are:
  • TIMER_A_CAPTURECOMPARE_REGISTER_0
  • TIMER_A_CAPTURECOMPARE_REGISTER_1
  • TIMER_A_CAPTURECOMPARE_REGISTER_2
Returns
Current count as an uint16_t
uint32_t Timer_A_getCaptureCompareInterruptStatus ( uint16_t  baseAddress,
uint16_t  captureCompareRegister,
uint16_t  mask 
)

Return capture compare interrupt status.

Parameters
baseAddressis the base address of the TIMER_A module.
captureCompareRegisteris the selected capture compare register Valid values are:
  • TIMER_A_CAPTURECOMPARE_REGISTER_0
  • TIMER_A_CAPTURECOMPARE_REGISTER_1
  • TIMER_A_CAPTURECOMPARE_REGISTER_2
maskis the mask for the interrupt status Mask value is the logical OR of any of the following:
  • TIMER_A_CAPTURE_OVERFLOW
  • TIMER_A_CAPTURECOMPARE_INTERRUPT_FLAG
Returns
Logical OR of any of the following:
  • Timer_A_CAPTURE_OVERFLOW
  • Timer_A_CAPTURECOMPARE_INTERRUPT_FLAG
    indicating the status of the masked interrupts
uint16_t Timer_A_getCounterValue ( uint16_t  baseAddress)

Reads the current timer count value.

Reads the current count value of the timer. There is a majority vote system in place to confirm an accurate value is returned. The TIMER_A_THRESHOLD #define in the corresponding header file can be modified so that the votes must be closer together for a consensus to occur.

Parameters
baseAddressis the base address of the TIMER_A module.
Returns
Majority vote of timer count value
uint32_t Timer_A_getInterruptStatus ( uint16_t  baseAddress)

Get timer interrupt status.

Parameters
baseAddressis the base address of the TIMER_A module.
Returns
One of the following:
  • Timer_A_INTERRUPT_NOT_PENDING
  • Timer_A_INTERRUPT_PENDING
    indicating the Timer_A interrupt status
uint8_t Timer_A_getOutputForOutputModeOutBitValue ( uint16_t  baseAddress,
uint16_t  captureCompareRegister 
)

Get output bit for output mode.

Parameters
baseAddressis the base address of the TIMER_A module.
captureCompareRegisterValid values are:
  • TIMER_A_CAPTURECOMPARE_REGISTER_0
  • TIMER_A_CAPTURECOMPARE_REGISTER_1
  • TIMER_A_CAPTURECOMPARE_REGISTER_2
Returns
One of the following:
  • Timer_A_OUTPUTMODE_OUTBITVALUE_HIGH
  • Timer_A_OUTPUTMODE_OUTBITVALUE_LOW
uint8_t Timer_A_getSynchronizedCaptureCompareInput ( uint16_t  baseAddress,
uint16_t  captureCompareRegister,
uint16_t  synchronized 
)

Get synchronized capturecompare input.

Parameters
baseAddressis the base address of the TIMER_A module.
captureCompareRegisterValid values are:
  • TIMER_A_CAPTURECOMPARE_REGISTER_0
  • TIMER_A_CAPTURECOMPARE_REGISTER_1
  • TIMER_A_CAPTURECOMPARE_REGISTER_2
synchronizedValid values are:
  • TIMER_A_READ_SYNCHRONIZED_CAPTURECOMPAREINPUT
  • TIMER_A_READ_CAPTURE_COMPARE_INPUT
Returns
One of the following:
  • Timer_A_CAPTURECOMPARE_INPUT_HIGH
  • Timer_A_CAPTURECOMPARE_INPUT_LOW
void Timer_A_initCaptureMode ( uint16_t  baseAddress,
Timer_A_initCaptureModeParam param 
)

Initializes Capture Mode.

Parameters
baseAddressis the base address of the TIMER_A module.
paramis the pointer to struct for capture mode initialization.

Modified bits of TAxCCTLn register.

Returns
None

References Timer_A_initCaptureModeParam::captureInputSelect, Timer_A_initCaptureModeParam::captureInterruptEnable, Timer_A_initCaptureModeParam::captureMode, Timer_A_initCaptureModeParam::captureOutputMode, Timer_A_initCaptureModeParam::captureRegister, and Timer_A_initCaptureModeParam::synchronizeCaptureSource.

void Timer_A_initCompareMode ( uint16_t  baseAddress,
Timer_A_initCompareModeParam param 
)

Initializes Compare Mode.

Parameters
baseAddressis the base address of the TIMER_A module.
paramis the pointer to struct for compare mode initialization.

Modified bits of TAxCCRn register and bits of TAxCCTLn register.

Returns
None

References Timer_A_initCompareModeParam::compareInterruptEnable, Timer_A_initCompareModeParam::compareOutputMode, Timer_A_initCompareModeParam::compareRegister, and Timer_A_initCompareModeParam::compareValue.

void Timer_A_initContinuousMode ( uint16_t  baseAddress,
Timer_A_initContinuousModeParam param 
)

Configures Timer_A in continuous mode.

Parameters
baseAddressis the base address of the TIMER_A module.
paramis the pointer to struct for continuous mode initialization.

Modified bits of TAxCTL register.

Returns
None

References Timer_A_initContinuousModeParam::clockSource, Timer_A_initContinuousModeParam::clockSourceDivider, Timer_A_initContinuousModeParam::startTimer, Timer_A_initContinuousModeParam::timerClear, and Timer_A_initContinuousModeParam::timerInterruptEnable_TAIE.

void Timer_A_initUpDownMode ( uint16_t  baseAddress,
Timer_A_initUpDownModeParam param 
)

Configures Timer_A in up down mode.

Parameters
baseAddressis the base address of the TIMER_A module.
paramis the pointer to struct for up-down mode initialization.

Modified bits of TAxCTL register, bits of TAxCCTL0 register and bits of TAxCCR0 register.

Returns
None

References Timer_A_initUpDownModeParam::captureCompareInterruptEnable_CCR0_CCIE, Timer_A_initUpDownModeParam::clockSource, Timer_A_initUpDownModeParam::clockSourceDivider, Timer_A_initUpDownModeParam::startTimer, Timer_A_initUpDownModeParam::timerClear, Timer_A_initUpDownModeParam::timerInterruptEnable_TAIE, and Timer_A_initUpDownModeParam::timerPeriod.

void Timer_A_initUpMode ( uint16_t  baseAddress,
Timer_A_initUpModeParam param 
)

Configures Timer_A in up mode.

Parameters
baseAddressis the base address of the TIMER_A module.
paramis the pointer to struct for up mode initialization.

Modified bits of TAxCTL register, bits of TAxCCTL0 register and bits of TAxCCR0 register.

Returns
None

References Timer_A_initUpModeParam::captureCompareInterruptEnable_CCR0_CCIE, Timer_A_initUpModeParam::clockSource, Timer_A_initUpModeParam::clockSourceDivider, Timer_A_initUpModeParam::startTimer, Timer_A_initUpModeParam::timerClear, Timer_A_initUpModeParam::timerInterruptEnable_TAIE, and Timer_A_initUpModeParam::timerPeriod.

void Timer_A_outputPWM ( uint16_t  baseAddress,
Timer_A_outputPWMParam param 
)

Generate a PWM with timer running in up mode.

Parameters
baseAddressis the base address of the TIMER_A module.
paramis the pointer to struct for PWM configuration.

Modified bits of TAxCTL register, bits of TAxCCTL0 register, bits of TAxCCR0 register and bits of TAxCCTLn register.

Returns
None

References Timer_A_outputPWMParam::clockSource, Timer_A_outputPWMParam::clockSourceDivider, Timer_A_outputPWMParam::compareOutputMode, Timer_A_outputPWMParam::compareRegister, Timer_A_outputPWMParam::dutyCycle, and Timer_A_outputPWMParam::timerPeriod.

void Timer_A_setCompareValue ( uint16_t  baseAddress,
uint16_t  compareRegister,
uint16_t  compareValue 
)

Sets the value of the capture-compare register.

Parameters
baseAddressis the base address of the TIMER_A module.
compareRegisterselects the Capture register being used. Refer to datasheet to ensure the device has the capture compare register being used. Valid values are:
  • TIMER_A_CAPTURECOMPARE_REGISTER_0
  • TIMER_A_CAPTURECOMPARE_REGISTER_1
  • TIMER_A_CAPTURECOMPARE_REGISTER_2
compareValueis the count to be compared with in compare mode

Modified bits of TAxCCRn register.

Returns
None
void Timer_A_setOutputForOutputModeOutBitValue ( uint16_t  baseAddress,
uint16_t  captureCompareRegister,
uint8_t  outputModeOutBitValue 
)

Set output bit for output mode.

Parameters
baseAddressis the base address of the TIMER_A module.
captureCompareRegisterValid values are:
  • TIMER_A_CAPTURECOMPARE_REGISTER_0
  • TIMER_A_CAPTURECOMPARE_REGISTER_1
  • TIMER_A_CAPTURECOMPARE_REGISTER_2
outputModeOutBitValueis the value to be set for out bit Valid values are:
  • TIMER_A_OUTPUTMODE_OUTBITVALUE_HIGH
  • TIMER_A_OUTPUTMODE_OUTBITVALUE_LOW

Modified bits of TAxCCTLn register.

Returns
None
void Timer_A_startCounter ( uint16_t  baseAddress,
uint16_t  timerMode 
)

Starts Timer_A counter.

This function assumes that the timer has been previously configured using Timer_A_initContinuousMode, Timer_A_initUpMode or Timer_A_initUpDownMode.

Parameters
baseAddressis the base address of the TIMER_A module.
timerModemode to put the timer in Valid values are:
  • TIMER_A_STOP_MODE
  • TIMER_A_UP_MODE
  • TIMER_A_CONTINUOUS_MODE [Default]
  • TIMER_A_UPDOWN_MODE

Modified bits of TAxCTL register.

Returns
None
void Timer_A_stop ( uint16_t  baseAddress)

Stops the timer.

Parameters
baseAddressis the base address of the TIMER_A module.

Modified bits of TAxCTL register.

Returns
None

Copyright 2015, Texas Instruments Incorporated