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

Functions

void RTC_B_startClock (uint16_t baseAddress)
 Starts the RTC. More...
 
void RTC_B_holdClock (uint16_t baseAddress)
 Holds the RTC. More...
 
void RTC_B_setCalibrationFrequency (uint16_t baseAddress, uint16_t frequencySelect)
 Allows and Sets the frequency output to RTCCLK pin for calibration measurement. More...
 
void RTC_B_setCalibrationData (uint16_t baseAddress, uint8_t offsetDirection, uint8_t offsetValue)
 Sets the specified calibration for the RTC. More...
 
void RTC_B_initCalendar (uint16_t baseAddress, Calendar *CalendarTime, uint16_t formatSelect)
 Initializes the settings to operate the RTC in calendar mode. More...
 
Calendar RTC_B_getCalendarTime (uint16_t baseAddress)
 Returns the Calendar Time stored in the Calendar registers of the RTC. More...
 
void RTC_B_configureCalendarAlarm (uint16_t baseAddress, RTC_B_configureCalendarAlarmParam *param)
 Sets and Enables the desired Calendar Alarm settings. More...
 
void RTC_B_setCalendarEvent (uint16_t baseAddress, uint16_t eventSelect)
 Sets a single specified Calendar interrupt condition. More...
 
void RTC_B_definePrescaleEvent (uint16_t baseAddress, uint8_t prescaleSelect, uint8_t prescaleEventDivider)
 Sets up an interrupt condition for the selected Prescaler. More...
 
uint8_t RTC_B_getPrescaleValue (uint16_t baseAddress, uint8_t prescaleSelect)
 Returns the selected prescaler value. More...
 
void RTC_B_setPrescaleValue (uint16_t baseAddress, uint8_t prescaleSelect, uint8_t prescaleCounterValue)
 Sets the selected prescaler value. More...
 
void RTC_B_enableInterrupt (uint16_t baseAddress, uint8_t interruptMask)
 Enables selected RTC interrupt sources. More...
 
void RTC_B_disableInterrupt (uint16_t baseAddress, uint8_t interruptMask)
 Disables selected RTC interrupt sources. More...
 
uint8_t RTC_B_getInterruptStatus (uint16_t baseAddress, uint8_t interruptFlagMask)
 Returns the status of the selected interrupts flags. More...
 
void RTC_B_clearInterrupt (uint16_t baseAddress, uint8_t interruptFlagMask)
 Clears selected RTC interrupt flags. More...
 
uint16_t RTC_B_convertBCDToBinary (uint16_t baseAddress, uint16_t valueToConvert)
 Convert the given BCD value to binary format. More...
 
uint16_t RTC_B_convertBinaryToBCD (uint16_t baseAddress, uint16_t valueToConvert)
 Convert the given binary value to BCD format. More...
 

Detailed Description

Function Documentation

void RTC_B_clearInterrupt ( uint16_t  baseAddress,
uint8_t  interruptFlagMask 
)

Clears selected RTC interrupt flags.

This function clears the RTC interrupt flag is cleared, so that it no longer asserts.

Parameters
baseAddressis the base address of the RTC_B module.
interruptFlagMaskis a bit mask of the interrupt flags to be cleared. Mask value is the logical OR of any of the following:
  • RTC_B_TIME_EVENT_INTERRUPT - asserts when counter overflows in counter mode or when Calendar event condition defined by defineCalendarEvent() is met.
  • RTC_B_CLOCK_ALARM_INTERRUPT - asserts when alarm condition in Calendar mode is met.
  • RTC_B_CLOCK_READ_READY_INTERRUPT - asserts when Calendar registers are settled.
  • RTC_B_PRESCALE_TIMER0_INTERRUPT - asserts when Prescaler 0 event condition is met.
  • RTC_B_PRESCALE_TIMER1_INTERRUPT - asserts when Prescaler 1 event condition is met.
  • RTC_B_OSCILLATOR_FAULT_INTERRUPT - asserts if there is a problem with the 32kHz oscillator, while the RTC is running.
Returns
None
void RTC_B_configureCalendarAlarm ( uint16_t  baseAddress,
RTC_B_configureCalendarAlarmParam param 
)

Sets and Enables the desired Calendar Alarm settings.

This function sets a Calendar interrupt condition to assert the RTCAIFG interrupt flag. The condition is a logical and of all of the parameters. For example if the minutes and hours alarm is set, then the interrupt will only assert when the minutes AND the hours change to the specified setting. Use the RTC_B_ALARM_OFF for any alarm settings that should not be apart of the alarm condition.

Parameters
baseAddressis the base address of the RTC_B module.
paramis the pointer to struct for calendar alarm configuration.
Returns
None

References RTC_B_configureCalendarAlarmParam::dayOfMonthAlarm, RTC_B_configureCalendarAlarmParam::dayOfWeekAlarm, RTC_B_configureCalendarAlarmParam::hoursAlarm, and RTC_B_configureCalendarAlarmParam::minutesAlarm.

uint16_t RTC_B_convertBCDToBinary ( uint16_t  baseAddress,
uint16_t  valueToConvert 
)

Convert the given BCD value to binary format.

This function converts BCD values to binary format. This API uses the hardware registers to perform the conversion rather than a software method.

Parameters
baseAddressis the base address of the RTC_B module.
valueToConvertis the raw value in BCD format to convert to Binary.
Modified bits are BCD2BIN of BCD2BIN register.
Returns
The binary version of the input parameter
uint16_t RTC_B_convertBinaryToBCD ( uint16_t  baseAddress,
uint16_t  valueToConvert 
)

Convert the given binary value to BCD format.

This function converts binary values to BCD format. This API uses the hardware registers to perform the conversion rather than a software method.

Parameters
baseAddressis the base address of the RTC_B module.
valueToConvertis the raw value in Binary format to convert to BCD.
Modified bits are BIN2BCD of BIN2BCD register.
Returns
The BCD version of the valueToConvert parameter
void RTC_B_definePrescaleEvent ( uint16_t  baseAddress,
uint8_t  prescaleSelect,
uint8_t  prescaleEventDivider 
)

Sets up an interrupt condition for the selected Prescaler.

This function sets the condition for an interrupt to assert based on the individual prescalers.

Parameters
baseAddressis the base address of the RTC_B module.
prescaleSelectis the prescaler to define an interrupt for. Valid values are:
  • RTC_B_PRESCALE_0
  • RTC_B_PRESCALE_1
prescaleEventDivideris a divider to specify when an interrupt can occur based on the clock source of the selected prescaler. (Does not affect timer of the selected prescaler). Valid values are:
  • RTC_B_PSEVENTDIVIDER_2 [Default]
  • RTC_B_PSEVENTDIVIDER_4
  • RTC_B_PSEVENTDIVIDER_8
  • RTC_B_PSEVENTDIVIDER_16
  • RTC_B_PSEVENTDIVIDER_32
  • RTC_B_PSEVENTDIVIDER_64
  • RTC_B_PSEVENTDIVIDER_128
  • RTC_B_PSEVENTDIVIDER_256
    Modified bits are RTxIP of RTCPSxCTL register.
Returns
None
void RTC_B_disableInterrupt ( uint16_t  baseAddress,
uint8_t  interruptMask 
)

Disables selected RTC interrupt sources.

This function disables the selected RTC interrupt source. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor.

Parameters
baseAddressis the base address of the RTC_B module.
interruptMaskis a bit mask of the interrupts to disable. Mask value is the logical OR of any of the following:
  • RTC_B_TIME_EVENT_INTERRUPT - asserts when counter overflows in counter mode or when Calendar event condition defined by defineCalendarEvent() is met.
  • RTC_B_CLOCK_ALARM_INTERRUPT - asserts when alarm condition in Calendar mode is met.
  • RTC_B_CLOCK_READ_READY_INTERRUPT - asserts when Calendar registers are settled.
  • RTC_B_PRESCALE_TIMER0_INTERRUPT - asserts when Prescaler 0 event condition is met.
  • RTC_B_PRESCALE_TIMER1_INTERRUPT - asserts when Prescaler 1 event condition is met.
  • RTC_B_OSCILLATOR_FAULT_INTERRUPT - asserts if there is a problem with the 32kHz oscillator, while the RTC is running.
Returns
None
void RTC_B_enableInterrupt ( uint16_t  baseAddress,
uint8_t  interruptMask 
)

Enables selected RTC interrupt sources.

This function enables the selected RTC interrupt source. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor. Does not clear interrupt flags.

Parameters
baseAddressis the base address of the RTC_B module.
interruptMaskis a bit mask of the interrupts to enable. Mask value is the logical OR of any of the following:
  • RTC_B_TIME_EVENT_INTERRUPT - asserts when counter overflows in counter mode or when Calendar event condition defined by defineCalendarEvent() is met.
  • RTC_B_CLOCK_ALARM_INTERRUPT - asserts when alarm condition in Calendar mode is met.
  • RTC_B_CLOCK_READ_READY_INTERRUPT - asserts when Calendar registers are settled.
  • RTC_B_PRESCALE_TIMER0_INTERRUPT - asserts when Prescaler 0 event condition is met.
  • RTC_B_PRESCALE_TIMER1_INTERRUPT - asserts when Prescaler 1 event condition is met.
  • RTC_B_OSCILLATOR_FAULT_INTERRUPT - asserts if there is a problem with the 32kHz oscillator, while the RTC is running.
Returns
None
Calendar RTC_B_getCalendarTime ( uint16_t  baseAddress)

Returns the Calendar Time stored in the Calendar registers of the RTC.

This function returns the current Calendar time in the form of a Calendar structure. The RTCRDY polling is used in this function to prevent reading invalid time.

Parameters
baseAddressis the base address of the RTC_B module.
Returns
A Calendar structure containing the current time.

References Calendar::DayOfMonth, Calendar::DayOfWeek, Calendar::Hours, Calendar::Minutes, Calendar::Month, Calendar::Seconds, and Calendar::Year.

uint8_t RTC_B_getInterruptStatus ( uint16_t  baseAddress,
uint8_t  interruptFlagMask 
)

Returns the status of the selected interrupts flags.

This function returns the status of the interrupt flag for the selected channel.

Parameters
baseAddressis the base address of the RTC_B module.
interruptFlagMaskis a bit mask of the interrupt flags to return the status of. Mask value is the logical OR of any of the following:
  • RTC_B_TIME_EVENT_INTERRUPT - asserts when counter overflows in counter mode or when Calendar event condition defined by defineCalendarEvent() is met.
  • RTC_B_CLOCK_ALARM_INTERRUPT - asserts when alarm condition in Calendar mode is met.
  • RTC_B_CLOCK_READ_READY_INTERRUPT - asserts when Calendar registers are settled.
  • RTC_B_PRESCALE_TIMER0_INTERRUPT - asserts when Prescaler 0 event condition is met.
  • RTC_B_PRESCALE_TIMER1_INTERRUPT - asserts when Prescaler 1 event condition is met.
  • RTC_B_OSCILLATOR_FAULT_INTERRUPT - asserts if there is a problem with the 32kHz oscillator, while the RTC is running.
Returns
Logical OR of any of the following:
  • RTC_B_TIME_EVENT_INTERRUPT asserts when counter overflows in counter mode or when Calendar event condition defined by defineCalendarEvent() is met.
  • RTC_B_CLOCK_ALARM_INTERRUPT asserts when alarm condition in Calendar mode is met.
  • RTC_B_CLOCK_READ_READY_INTERRUPT asserts when Calendar registers are settled.
  • RTC_B_PRESCALE_TIMER0_INTERRUPT asserts when Prescaler 0 event condition is met.
  • RTC_B_PRESCALE_TIMER1_INTERRUPT asserts when Prescaler 1 event condition is met.
  • RTC_B_OSCILLATOR_FAULT_INTERRUPT asserts if there is a problem with the 32kHz oscillator, while the RTC is running.
    indicating the status of the masked interrupts
uint8_t RTC_B_getPrescaleValue ( uint16_t  baseAddress,
uint8_t  prescaleSelect 
)

Returns the selected prescaler value.

This function returns the value of the selected prescale counter register. Note that the counter value should be held by calling RTC_B_holdClock() before calling this API.

Parameters
baseAddressis the base address of the RTC_B module.
prescaleSelectis the prescaler to obtain the value of. Valid values are:
  • RTC_B_PRESCALE_0
  • RTC_B_PRESCALE_1
Returns
The value of the specified prescaler count register
void RTC_B_holdClock ( uint16_t  baseAddress)

Holds the RTC.

This function sets the RTC main hold bit to disable RTC functionality.

Parameters
baseAddressis the base address of the RTC_B module.
Returns
None
void RTC_B_initCalendar ( uint16_t  baseAddress,
Calendar CalendarTime,
uint16_t  formatSelect 
)

Initializes the settings to operate the RTC in calendar mode.

This function initializes the Calendar mode of the RTC module. To prevent potential erroneous alarm conditions from occurring, the alarm should be disabled by clearing the RTCAIE, RTCAIFG and AE bits with APIs: RTC_B_disableInterrupt(), RTC_B_clearInterrupt() and RTC_B_configureCalendarAlarm() before calendar initialization.

Parameters
baseAddressis the base address of the RTC_B module.
CalendarTimeis the pointer to the structure containing the values for the Calendar to be initialized to. Valid values should be of type pointer to Calendar and should contain the following members and corresponding values: Seconds between 0-59 Minutes between 0-59 Hours between 0-23 DayOfWeek between 0-6 DayOfMonth between 1-31 Year between 0-4095 NOTE: Values beyond the ones specified may result in erratic behavior.
formatSelectis the format for the Calendar registers to use. Valid values are:
  • RTC_B_FORMAT_BINARY [Default]
  • RTC_B_FORMAT_BCD
    Modified bits are RTCBCD of RTCCTL1 register.
Returns
None

References Calendar::DayOfMonth, Calendar::DayOfWeek, Calendar::Hours, Calendar::Minutes, Calendar::Month, Calendar::Seconds, and Calendar::Year.

void RTC_B_setCalendarEvent ( uint16_t  baseAddress,
uint16_t  eventSelect 
)

Sets a single specified Calendar interrupt condition.

This function sets a specified event to assert the RTCTEVIFG interrupt. This interrupt is independent from the Calendar alarm interrupt.

Parameters
baseAddressis the base address of the RTC_B module.
eventSelectis the condition selected. Valid values are:
  • RTC_B_CALENDAREVENT_MINUTECHANGE - assert interrupt on every minute
  • RTC_B_CALENDAREVENT_HOURCHANGE - assert interrupt on every hour
  • RTC_B_CALENDAREVENT_NOON - assert interrupt when hour is 12
  • RTC_B_CALENDAREVENT_MIDNIGHT - assert interrupt when hour is 0
    Modified bits are RTCTEV of RTCCTL register.
Returns
None
void RTC_B_setCalibrationData ( uint16_t  baseAddress,
uint8_t  offsetDirection,
uint8_t  offsetValue 
)

Sets the specified calibration for the RTC.

This function sets the calibration offset to make the RTC as accurate as possible. The offsetDirection can be either +4-ppm or -2-ppm, and the offsetValue should be from 1-63 and is multiplied by the direction setting (i.e. +4-ppm * 8 (offsetValue) = +32-ppm). Please note, when measuring the frequency after setting the calibration, you will only see a change on the 1Hz frequency.

Parameters
baseAddressis the base address of the RTC_B module.
offsetDirectionis the direction that the calibration offset will go. Valid values are:
  • RTC_B_CALIBRATION_DOWN2PPM - calibrate at steps of -2
  • RTC_B_CALIBRATION_UP4PPM - calibrate at steps of +4
    Modified bits are RTCCALS of RTCCTL2 register.
offsetValueis the value that the offset will be a factor of; a valid value is any integer from 1-63.
Modified bits are RTCCAL of RTCCTL2 register.
Returns
None
void RTC_B_setCalibrationFrequency ( uint16_t  baseAddress,
uint16_t  frequencySelect 
)

Allows and Sets the frequency output to RTCCLK pin for calibration measurement.

This function sets a frequency to measure at the RTCCLK output pin. After testing the set frequency, the calibration could be set accordingly.

Parameters
baseAddressis the base address of the RTC_B module.
frequencySelectis the frequency output to RTCCLK. Valid values are:
  • RTC_B_CALIBRATIONFREQ_OFF [Default] - turn off calibration output
  • RTC_B_CALIBRATIONFREQ_512HZ - output signal at 512Hz for calibration
  • RTC_B_CALIBRATIONFREQ_256HZ - output signal at 256Hz for calibration
  • RTC_B_CALIBRATIONFREQ_1HZ - output signal at 1Hz for calibration
    Modified bits are RTCCALF of RTCCTL3 register.
Returns
None
void RTC_B_setPrescaleValue ( uint16_t  baseAddress,
uint8_t  prescaleSelect,
uint8_t  prescaleCounterValue 
)

Sets the selected prescaler value.

This function sets the prescale counter value. Before setting the prescale counter, it should be held by calling RTC_B_holdClock().

Parameters
baseAddressis the base address of the RTC_B module.
prescaleSelectis the prescaler to set the value for. Valid values are:
  • RTC_B_PRESCALE_0
  • RTC_B_PRESCALE_1
prescaleCounterValueis the specified value to set the prescaler to. Valid values are any integer between 0-255
Modified bits are RTxPS of RTxPS register.
Returns
None
void RTC_B_startClock ( uint16_t  baseAddress)

Starts the RTC.

This function clears the RTC main hold bit to allow the RTC to function.

Parameters
baseAddressis the base address of the RTC_B module.
Returns
None

Copyright 2015, Texas Instruments Incorporated