MSP430 DriverLib for MSP430FR5xx_6xx Devices  2.21.00.08
 All Data Structures Functions Variables Modules Pages
timer_b

Functions

void Timer_B_startCounter (uint16_t baseAddress, uint16_t timerMode)
 Starts Timer_B counter. More...
 
void Timer_B_initContinuousMode (uint16_t baseAddress, Timer_B_initContinuousModeParam *param)
 Configures Timer_B in continuous mode. More...
 
void Timer_B_initUpMode (uint16_t baseAddress, Timer_B_initUpModeParam *param)
 Configures Timer_B in up mode. More...
 
void Timer_B_initUpDownMode (uint16_t baseAddress, Timer_B_initUpDownModeParam *param)
 Configures Timer_B in up down mode. More...
 
void Timer_B_initCaptureMode (uint16_t baseAddress, Timer_B_initCaptureModeParam *param)
 Initializes Capture Mode. More...
 
void Timer_B_initCompareMode (uint16_t baseAddress, Timer_B_initCompareModeParam *param)
 Initializes Compare Mode. More...
 
void Timer_B_enableInterrupt (uint16_t baseAddress)
 Enable Timer_B interrupt. More...
 
void Timer_B_disableInterrupt (uint16_t baseAddress)
 Disable Timer_B interrupt. More...
 
uint32_t Timer_B_getInterruptStatus (uint16_t baseAddress)
 Get Timer_B interrupt status. More...
 
void Timer_B_enableCaptureCompareInterrupt (uint16_t baseAddress, uint16_t captureCompareRegister)
 Enable capture compare interrupt. More...
 
void Timer_B_disableCaptureCompareInterrupt (uint16_t baseAddress, uint16_t captureCompareRegister)
 Disable capture compare interrupt. More...
 
uint32_t Timer_B_getCaptureCompareInterruptStatus (uint16_t baseAddress, uint16_t captureCompareRegister, uint16_t mask)
 Return capture compare interrupt status. More...
 
void Timer_B_clear (uint16_t baseAddress)
 Reset/Clear the Timer_B clock divider, count direction, count. More...
 
uint8_t Timer_B_getSynchronizedCaptureCompareInput (uint16_t baseAddress, uint16_t captureCompareRegister, uint16_t synchronized)
 Get synchronized capturecompare input. More...
 
uint8_t Timer_B_getOutputForOutputModeOutBitValue (uint16_t baseAddress, uint16_t captureCompareRegister)
 Get output bit for output mode. More...
 
uint16_t Timer_B_getCaptureCompareCount (uint16_t baseAddress, uint16_t captureCompareRegister)
 Get current capturecompare count. More...
 
void Timer_B_setOutputForOutputModeOutBitValue (uint16_t baseAddress, uint16_t captureCompareRegister, uint8_t outputModeOutBitValue)
 Set output bit for output mode. More...
 
void Timer_B_outputPWM (uint16_t baseAddress, Timer_B_outputPWMParam *param)
 Generate a PWM with Timer_B running in up mode. More...
 
void Timer_B_stop (uint16_t baseAddress)
 Stops the Timer_B. More...
 
void Timer_B_setCompareValue (uint16_t baseAddress, uint16_t compareRegister, uint16_t compareValue)
 Sets the value of the capture-compare register. More...
 
void Timer_B_clearTimerInterrupt (uint16_t baseAddress)
 Clears the Timer_B TBIFG interrupt flag. More...
 
void Timer_B_clearCaptureCompareInterrupt (uint16_t baseAddress, uint16_t captureCompareRegister)
 Clears the capture-compare interrupt flag. More...
 
void Timer_B_selectCounterLength (uint16_t baseAddress, uint16_t counterLength)
 Selects Timer_B counter length. More...
 
void Timer_B_selectLatchingGroup (uint16_t baseAddress, uint16_t groupLatch)
 Selects Timer_B Latching Group. More...
 
void Timer_B_initCompareLatchLoadEvent (uint16_t baseAddress, uint16_t compareRegister, uint16_t compareLatchLoadEvent)
 Selects Compare Latch Load Event. More...
 
uint16_t Timer_B_getCounterValue (uint16_t baseAddress)
 Reads the current timer count value. More...
 

Detailed Description

Function Documentation

void Timer_B_clear ( uint16_t  baseAddress)

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

Parameters
baseAddressis the base address of the TIMER_B module.

Modified bits of TBxCTL register.

Returns
None
void Timer_B_clearCaptureCompareInterrupt ( uint16_t  baseAddress,
uint16_t  captureCompareRegister 
)

Clears the capture-compare interrupt flag.

Parameters
baseAddressis the base address of the TIMER_B module.
captureCompareRegisterselects the capture compare register being used. Refer to datasheet to ensure the device has the capture compare register being used. Valid values are:
  • TIMER_B_CAPTURECOMPARE_REGISTER_0
  • TIMER_B_CAPTURECOMPARE_REGISTER_1
  • TIMER_B_CAPTURECOMPARE_REGISTER_2
  • TIMER_B_CAPTURECOMPARE_REGISTER_3
  • TIMER_B_CAPTURECOMPARE_REGISTER_4
  • TIMER_B_CAPTURECOMPARE_REGISTER_5
  • TIMER_B_CAPTURECOMPARE_REGISTER_6

Modified bits are CCIFG of TBxCCTLn register.

Returns
None
void Timer_B_clearTimerInterrupt ( uint16_t  baseAddress)

Clears the Timer_B TBIFG interrupt flag.

Parameters
baseAddressis the base address of the TIMER_B module.

Modified bits are TBIFG of TBxCTL register.

Returns
None
void Timer_B_disableCaptureCompareInterrupt ( uint16_t  baseAddress,
uint16_t  captureCompareRegister 
)

Disable capture compare interrupt.

Parameters
baseAddressis the base address of the TIMER_B module.
captureCompareRegisterselects the capture compare register being used. Refer to datasheet to ensure the device has the capture compare register being used. Valid values are:
  • TIMER_B_CAPTURECOMPARE_REGISTER_0
  • TIMER_B_CAPTURECOMPARE_REGISTER_1
  • TIMER_B_CAPTURECOMPARE_REGISTER_2
  • TIMER_B_CAPTURECOMPARE_REGISTER_3
  • TIMER_B_CAPTURECOMPARE_REGISTER_4
  • TIMER_B_CAPTURECOMPARE_REGISTER_5
  • TIMER_B_CAPTURECOMPARE_REGISTER_6

Modified bits of TBxCCTLn register.

Returns
None
void Timer_B_disableInterrupt ( uint16_t  baseAddress)

Disable Timer_B interrupt.

Parameters
baseAddressis the base address of the TIMER_B module.

Modified bits of TBxCTL register.

Returns
None
void Timer_B_enableCaptureCompareInterrupt ( uint16_t  baseAddress,
uint16_t  captureCompareRegister 
)

Enable capture compare interrupt.

Parameters
baseAddressis the base address of the TIMER_B module.
captureCompareRegisterselects the capture compare register being used. Refer to datasheet to ensure the device has the capture compare register being used. Valid values are:
  • TIMER_B_CAPTURECOMPARE_REGISTER_0
  • TIMER_B_CAPTURECOMPARE_REGISTER_1
  • TIMER_B_CAPTURECOMPARE_REGISTER_2
  • TIMER_B_CAPTURECOMPARE_REGISTER_3
  • TIMER_B_CAPTURECOMPARE_REGISTER_4
  • TIMER_B_CAPTURECOMPARE_REGISTER_5
  • TIMER_B_CAPTURECOMPARE_REGISTER_6

Modified bits of TBxCCTLn register.

Returns
None
void Timer_B_enableInterrupt ( uint16_t  baseAddress)

Enable Timer_B interrupt.

Enables Timer_B interrupt. Does not clear interrupt flags.

Parameters
baseAddressis the base address of the TIMER_B module.

Modified bits of TBxCTL register.

Returns
None
uint16_t Timer_B_getCaptureCompareCount ( uint16_t  baseAddress,
uint16_t  captureCompareRegister 
)

Get current capturecompare count.

Parameters
baseAddressis the base address of the TIMER_B module.
captureCompareRegisterselects the capture compare register being used. Refer to datasheet to ensure the device has the capture compare register being used. Valid values are:
  • TIMER_B_CAPTURECOMPARE_REGISTER_0
  • TIMER_B_CAPTURECOMPARE_REGISTER_1
  • TIMER_B_CAPTURECOMPARE_REGISTER_2
  • TIMER_B_CAPTURECOMPARE_REGISTER_3
  • TIMER_B_CAPTURECOMPARE_REGISTER_4
  • TIMER_B_CAPTURECOMPARE_REGISTER_5
  • TIMER_B_CAPTURECOMPARE_REGISTER_6
Returns
Current count as uint16_t
uint32_t Timer_B_getCaptureCompareInterruptStatus ( uint16_t  baseAddress,
uint16_t  captureCompareRegister,
uint16_t  mask 
)

Return capture compare interrupt status.

Parameters
baseAddressis the base address of the TIMER_B module.
captureCompareRegisterselects the capture compare register being used. Refer to datasheet to ensure the device has the capture compare register being used. Valid values are:
  • TIMER_B_CAPTURECOMPARE_REGISTER_0
  • TIMER_B_CAPTURECOMPARE_REGISTER_1
  • TIMER_B_CAPTURECOMPARE_REGISTER_2
  • TIMER_B_CAPTURECOMPARE_REGISTER_3
  • TIMER_B_CAPTURECOMPARE_REGISTER_4
  • TIMER_B_CAPTURECOMPARE_REGISTER_5
  • TIMER_B_CAPTURECOMPARE_REGISTER_6
maskis the mask for the interrupt status Mask value is the logical OR of any of the following:
  • TIMER_B_CAPTURE_OVERFLOW
  • TIMER_B_CAPTURECOMPARE_INTERRUPT_FLAG
Returns
Logical OR of any of the following:
  • Timer_B_CAPTURE_OVERFLOW
  • Timer_B_CAPTURECOMPARE_INTERRUPT_FLAG
    indicating the status of the masked interrupts
uint16_t Timer_B_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_B_THRESHOLD #define in the associated 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 module.
Returns
Majority vote of timer count value
uint32_t Timer_B_getInterruptStatus ( uint16_t  baseAddress)

Get Timer_B interrupt status.

Parameters
baseAddressis the base address of the TIMER_B module.
Returns
One of the following:
  • Timer_B_INTERRUPT_NOT_PENDING
  • Timer_B_INTERRUPT_PENDING
    indicating the status of the Timer_B interrupt
uint8_t Timer_B_getOutputForOutputModeOutBitValue ( uint16_t  baseAddress,
uint16_t  captureCompareRegister 
)

Get output bit for output mode.

Parameters
baseAddressis the base address of the TIMER_B module.
captureCompareRegisterselects the capture compare register being used. Refer to datasheet to ensure the device has the capture compare register being used. Valid values are:
  • TIMER_B_CAPTURECOMPARE_REGISTER_0
  • TIMER_B_CAPTURECOMPARE_REGISTER_1
  • TIMER_B_CAPTURECOMPARE_REGISTER_2
  • TIMER_B_CAPTURECOMPARE_REGISTER_3
  • TIMER_B_CAPTURECOMPARE_REGISTER_4
  • TIMER_B_CAPTURECOMPARE_REGISTER_5
  • TIMER_B_CAPTURECOMPARE_REGISTER_6
Returns
One of the following:
  • Timer_B_OUTPUTMODE_OUTBITVALUE_HIGH
  • Timer_B_OUTPUTMODE_OUTBITVALUE_LOW
uint8_t Timer_B_getSynchronizedCaptureCompareInput ( uint16_t  baseAddress,
uint16_t  captureCompareRegister,
uint16_t  synchronized 
)

Get synchronized capturecompare input.

Parameters
baseAddressis the base address of the TIMER_B module.
captureCompareRegisterselects the capture compare register being used. Refer to datasheet to ensure the device has the capture compare register being used. Valid values are:
  • TIMER_B_CAPTURECOMPARE_REGISTER_0
  • TIMER_B_CAPTURECOMPARE_REGISTER_1
  • TIMER_B_CAPTURECOMPARE_REGISTER_2
  • TIMER_B_CAPTURECOMPARE_REGISTER_3
  • TIMER_B_CAPTURECOMPARE_REGISTER_4
  • TIMER_B_CAPTURECOMPARE_REGISTER_5
  • TIMER_B_CAPTURECOMPARE_REGISTER_6
synchronizedselects the type of capture compare input Valid values are:
  • TIMER_B_READ_SYNCHRONIZED_CAPTURECOMPAREINPUT
  • TIMER_B_READ_CAPTURE_COMPARE_INPUT
Returns
One of the following:
  • Timer_B_CAPTURECOMPARE_INPUT_HIGH
  • Timer_B_CAPTURECOMPARE_INPUT_LOW
void Timer_B_initCaptureMode ( uint16_t  baseAddress,
Timer_B_initCaptureModeParam param 
)

Initializes Capture Mode.

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

Modified bits of TBxCCTLn register.

Returns
None

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

void Timer_B_initCompareLatchLoadEvent ( uint16_t  baseAddress,
uint16_t  compareRegister,
uint16_t  compareLatchLoadEvent 
)

Selects Compare Latch Load Event.

Parameters
baseAddressis the base address of the TIMER_B module.
compareRegisterselects the compare register being used. Refer to datasheet to ensure the device has the compare register being used. Valid values are:
  • TIMER_B_CAPTURECOMPARE_REGISTER_0
  • TIMER_B_CAPTURECOMPARE_REGISTER_1
  • TIMER_B_CAPTURECOMPARE_REGISTER_2
  • TIMER_B_CAPTURECOMPARE_REGISTER_3
  • TIMER_B_CAPTURECOMPARE_REGISTER_4
  • TIMER_B_CAPTURECOMPARE_REGISTER_5
  • TIMER_B_CAPTURECOMPARE_REGISTER_6
compareLatchLoadEventselects the latch load event Valid values are:
  • TIMER_B_LATCH_ON_WRITE_TO_TBxCCRn_COMPARE_REGISTER [Default]
  • TIMER_B_LATCH_WHEN_COUNTER_COUNTS_TO_0_IN_UP_OR_CONT_MODE
  • TIMER_B_LATCH_WHEN_COUNTER_COUNTS_TO_0_IN_UPDOWN_MODE
  • TIMER_B_LATCH_WHEN_COUNTER_COUNTS_TO_CURRENT_COMPARE_LATCH_VALUE

Modified bits are CLLD of TBxCCTLn register.

Returns
None
void Timer_B_initCompareMode ( uint16_t  baseAddress,
Timer_B_initCompareModeParam param 
)

Initializes Compare Mode.

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

Modified bits of TBxCCTLn register and bits of TBxCCRn register.

Returns
None

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

void Timer_B_initContinuousMode ( uint16_t  baseAddress,
Timer_B_initContinuousModeParam param 
)

Configures Timer_B in continuous mode.

This API does not start the timer. Timer needs to be started when required using the Timer_B_startCounter API.

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

Modified bits of TBxCTL register.

Returns
None

References Timer_B_initContinuousModeParam::clockSource, Timer_B_initContinuousModeParam::clockSourceDivider, Timer_B_initContinuousModeParam::startTimer, Timer_B_initContinuousModeParam::timerClear, and Timer_B_initContinuousModeParam::timerInterruptEnable_TBIE.

void Timer_B_initUpDownMode ( uint16_t  baseAddress,
Timer_B_initUpDownModeParam param 
)

Configures Timer_B in up down mode.

This API does not start the timer. Timer needs to be started when required using the Timer_B_startCounter API.

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

Modified bits of TBxCTL register, bits of TBxCCTL0 register and bits of TBxCCR0 register.

Returns
None

References Timer_B_initUpDownModeParam::captureCompareInterruptEnable_CCR0_CCIE, Timer_B_initUpDownModeParam::clockSource, Timer_B_initUpDownModeParam::clockSourceDivider, Timer_B_initUpDownModeParam::startTimer, Timer_B_initUpDownModeParam::timerClear, Timer_B_initUpDownModeParam::timerInterruptEnable_TBIE, and Timer_B_initUpDownModeParam::timerPeriod.

void Timer_B_initUpMode ( uint16_t  baseAddress,
Timer_B_initUpModeParam param 
)

Configures Timer_B in up mode.

This API does not start the timer. Timer needs to be started when required using the Timer_B_startCounter API.

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

Modified bits of TBxCTL register, bits of TBxCCTL0 register and bits of TBxCCR0 register.

Returns
None

References Timer_B_initUpModeParam::captureCompareInterruptEnable_CCR0_CCIE, Timer_B_initUpModeParam::clockSource, Timer_B_initUpModeParam::clockSourceDivider, Timer_B_initUpModeParam::startTimer, Timer_B_initUpModeParam::timerClear, Timer_B_initUpModeParam::timerInterruptEnable_TBIE, and Timer_B_initUpModeParam::timerPeriod.

void Timer_B_outputPWM ( uint16_t  baseAddress,
Timer_B_outputPWMParam param 
)

Generate a PWM with Timer_B running in up mode.

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

Modified bits of TBxCCTLn register, bits of TBxCTL register, bits of TBxCCTL0 register and bits of TBxCCR0 register.

Returns
None

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

void Timer_B_selectCounterLength ( uint16_t  baseAddress,
uint16_t  counterLength 
)

Selects Timer_B counter length.

Parameters
baseAddressis the base address of the TIMER_B module.
counterLengthselects the value of counter length. Valid values are:
  • TIMER_B_COUNTER_16BIT [Default]
  • TIMER_B_COUNTER_12BIT
  • TIMER_B_COUNTER_10BIT
  • TIMER_B_COUNTER_8BIT

Modified bits are CNTL of TBxCTL register.

Returns
None
void Timer_B_selectLatchingGroup ( uint16_t  baseAddress,
uint16_t  groupLatch 
)

Selects Timer_B Latching Group.

Parameters
baseAddressis the base address of the TIMER_B module.
groupLatchselects the latching group. Valid values are:
  • TIMER_B_GROUP_NONE [Default]
  • TIMER_B_GROUP_CL12_CL23_CL56
  • TIMER_B_GROUP_CL123_CL456
  • TIMER_B_GROUP_ALL

Modified bits are TBCLGRP of TBxCTL register.

Returns
None
void Timer_B_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_B module.
compareRegisterselects the compare register being used. Refer to datasheet to ensure the device has the compare register being used. Valid values are:
  • TIMER_B_CAPTURECOMPARE_REGISTER_0
  • TIMER_B_CAPTURECOMPARE_REGISTER_1
  • TIMER_B_CAPTURECOMPARE_REGISTER_2
  • TIMER_B_CAPTURECOMPARE_REGISTER_3
  • TIMER_B_CAPTURECOMPARE_REGISTER_4
  • TIMER_B_CAPTURECOMPARE_REGISTER_5
  • TIMER_B_CAPTURECOMPARE_REGISTER_6
compareValueis the count to be compared with in compare mode

Modified bits of TBxCCRn register.

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

Set output bit for output mode.

Parameters
baseAddressis the base address of the TIMER_B module.
captureCompareRegisterselects the capture compare register being used. Refer to datasheet to ensure the device has the capture compare register being used. Valid values are:
  • TIMER_B_CAPTURECOMPARE_REGISTER_0
  • TIMER_B_CAPTURECOMPARE_REGISTER_1
  • TIMER_B_CAPTURECOMPARE_REGISTER_2
  • TIMER_B_CAPTURECOMPARE_REGISTER_3
  • TIMER_B_CAPTURECOMPARE_REGISTER_4
  • TIMER_B_CAPTURECOMPARE_REGISTER_5
  • TIMER_B_CAPTURECOMPARE_REGISTER_6
outputModeOutBitValuethe value to be set for out bit Valid values are:
  • TIMER_B_OUTPUTMODE_OUTBITVALUE_HIGH
  • TIMER_B_OUTPUTMODE_OUTBITVALUE_LOW

Modified bits of TBxCCTLn register.

Returns
None
void Timer_B_startCounter ( uint16_t  baseAddress,
uint16_t  timerMode 
)

Starts Timer_B counter.

This function assumes that the timer has been previously configured using Timer_B_initContinuousMode, Timer_B_initUpMode or Timer_B_initUpDownMode.

Parameters
baseAddressis the base address of the TIMER_B module.
timerModeselects the mode of the timer Valid values are:
  • TIMER_B_STOP_MODE
  • TIMER_B_UP_MODE
  • TIMER_B_CONTINUOUS_MODE [Default]
  • TIMER_B_UPDOWN_MODE

Modified bits of TBxCTL register.

Returns
None
void Timer_B_stop ( uint16_t  baseAddress)

Stops the Timer_B.

Parameters
baseAddressis the base address of the TIMER_B module.

Modified bits of TBxCTL register.

Returns
None

Copyright 2015, Texas Instruments Incorporated