MSP430 DriverLib for MSP430F5xx_6xx Devices  2.91.13.01
rtc_a

Functions

void RTC_A_startClock (uint16_t baseAddress)
 Starts the RTC. More...
 
void RTC_A_holdClock (uint16_t baseAddress)
 Holds the RTC. More...
 
void RTC_A_setCalibrationFrequency (uint16_t baseAddress, uint16_t frequencySelect)
 Allows and Sets the frequency output to RTCCLK pin for calibration measurement. More...
 
void RTC_A_setCalibrationData (uint16_t baseAddress, uint8_t offsetDirection, uint8_t offsetValue)
 Sets the specified calibration for the RTC. More...
 
void RTC_A_initCounter (uint16_t baseAddress, uint16_t clockSelect, uint16_t counterSizeSelect)
 Initializes the settings to operate the RTC in Counter mode. More...
 
void RTC_A_initCalendar (uint16_t baseAddress, Calendar *CalendarTime, uint16_t formatSelect)
 Initializes the settings to operate the RTC in calendar mode. More...
 
Calendar RTC_A_getCalendarTime (uint16_t baseAddress)
 Returns the Calendar Time stored in the Calendar registers of the RTC. More...
 
void RTC_A_configureCalendarAlarm (uint16_t baseAddress, RTC_A_configureCalendarAlarmParam *param)
 Sets and Enables the desired Calendar Alarm settings. More...
 
void RTC_A_setCalendarEvent (uint16_t baseAddress, uint16_t eventSelect)
 Sets a single specified Calendar interrupt condition. More...
 
uint32_t RTC_A_getCounterValue (uint16_t baseAddress)
 Returns the value of the Counter register. More...
 
void RTC_A_setCounterValue (uint16_t baseAddress, uint32_t counterValue)
 Sets the value of the Counter register. More...
 
void RTC_A_initCounterPrescale (uint16_t baseAddress, uint8_t prescaleSelect, uint16_t prescaleClockSelect, uint16_t prescaleDivider)
 Initializes the Prescaler for Counter mode. More...
 
void RTC_A_holdCounterPrescale (uint16_t baseAddress, uint8_t prescaleSelect)
 Holds the selected Prescaler. More...
 
void RTC_A_startCounterPrescale (uint16_t baseAddress, uint8_t prescaleSelect)
 Starts the selected Prescaler. More...
 
void RTC_A_definePrescaleEvent (uint16_t baseAddress, uint8_t prescaleSelect, uint8_t prescaleEventDivider)
 Sets up an interrupt condition for the selected Prescaler. More...
 
uint8_t RTC_A_getPrescaleValue (uint16_t baseAddress, uint8_t prescaleSelect)
 Returns the selected prescaler value. More...
 
void RTC_A_setPrescaleValue (uint16_t baseAddress, uint8_t prescaleSelect, uint8_t prescaleCounterValue)
 Sets the selected prescaler value. More...
 
void RTC_A_enableInterrupt (uint16_t baseAddress, uint8_t interruptMask)
 Enables selected RTC interrupt sources. More...
 
void RTC_A_disableInterrupt (uint16_t baseAddress, uint8_t interruptMask)
 Disables selected RTC interrupt sources. More...
 
uint8_t RTC_A_getInterruptStatus (uint16_t baseAddress, uint8_t interruptFlagMask)
 Returns the status of the selected interrupts flags. More...
 
void RTC_A_clearInterrupt (uint16_t baseAddress, uint8_t interruptFlagMask)
 Clears selected RTC interrupt flags. More...
 

Detailed Description

Function Documentation

§ RTC_A_clearInterrupt()

void RTC_A_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_A module.
interruptFlagMaskis a bit mask of the interrupt flags to be cleared. Mask value is the logical OR of any of the following:
  • RTC_A_TIME_EVENT_INTERRUPT - asserts when counter overflows in counter mode or when Calendar event condition defined by defineCalendarEvent() is met.
  • RTC_A_CLOCK_ALARM_INTERRUPT - asserts when alarm condition in Calendar mode is met.
  • RTC_A_CLOCK_READ_READY_INTERRUPT - asserts when Calendar registers are settled.
  • RTC_A_PRESCALE_TIMER0_INTERRUPT - asserts when Prescaler 0 event condition is met.
  • RTC_A_PRESCALE_TIMER1_INTERRUPT - asserts when Prescaler 1 event condition is met.
Returns
None

§ RTC_A_configureCalendarAlarm()

void RTC_A_configureCalendarAlarm ( uint16_t  baseAddress,
RTC_A_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_A_ALARM_OFF for any alarm settings that should not be apart of the alarm condition.

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

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

§ RTC_A_definePrescaleEvent()

void RTC_A_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_A module.
prescaleSelectis the prescaler to define an interrupt for. Valid values are:
  • RTC_A_PRESCALE_0
  • RTC_A_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_A_PSEVENTDIVIDER_2 [Default]
  • RTC_A_PSEVENTDIVIDER_4
  • RTC_A_PSEVENTDIVIDER_8
  • RTC_A_PSEVENTDIVIDER_16
  • RTC_A_PSEVENTDIVIDER_32
  • RTC_A_PSEVENTDIVIDER_64
  • RTC_A_PSEVENTDIVIDER_128
  • RTC_A_PSEVENTDIVIDER_256
    Modified bits are RTxIP of RTCPSxCTL register.
Returns
None

§ RTC_A_disableInterrupt()

void RTC_A_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_A module.
interruptMaskis a bit mask of the interrupts to disable. Mask value is the logical OR of any of the following:
  • RTC_A_TIME_EVENT_INTERRUPT - asserts when counter overflows in counter mode or when Calendar event condition defined by defineCalendarEvent() is met.
  • RTC_A_CLOCK_ALARM_INTERRUPT - asserts when alarm condition in Calendar mode is met.
  • RTC_A_CLOCK_READ_READY_INTERRUPT - asserts when Calendar registers are settled.
  • RTC_A_PRESCALE_TIMER0_INTERRUPT - asserts when Prescaler 0 event condition is met.
  • RTC_A_PRESCALE_TIMER1_INTERRUPT - asserts when Prescaler 1 event condition is met.
Returns
None

§ RTC_A_enableInterrupt()

void RTC_A_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_A module.
interruptMaskis a bit mask of the interrupts to enable. Mask value is the logical OR of any of the following:
  • RTC_A_TIME_EVENT_INTERRUPT - asserts when counter overflows in counter mode or when Calendar event condition defined by defineCalendarEvent() is met.
  • RTC_A_CLOCK_ALARM_INTERRUPT - asserts when alarm condition in Calendar mode is met.
  • RTC_A_CLOCK_READ_READY_INTERRUPT - asserts when Calendar registers are settled.
  • RTC_A_PRESCALE_TIMER0_INTERRUPT - asserts when Prescaler 0 event condition is met.
  • RTC_A_PRESCALE_TIMER1_INTERRUPT - asserts when Prescaler 1 event condition is met.
Returns
None

§ RTC_A_getCalendarTime()

Calendar RTC_A_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_A 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.

§ RTC_A_getCounterValue()

uint32_t RTC_A_getCounterValue ( uint16_t  baseAddress)

Returns the value of the Counter register.

This function returns the value of the counter register for the RTC_A module. It will return the 32-bit value no matter the size set during initialization. The RTC should be held before trying to use this function.

Parameters
baseAddressis the base address of the RTC_A module.
Returns
The raw value of the full 32-bit Counter Register.

§ RTC_A_getInterruptStatus()

uint8_t RTC_A_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_A 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_A_TIME_EVENT_INTERRUPT - asserts when counter overflows in counter mode or when Calendar event condition defined by defineCalendarEvent() is met.
  • RTC_A_CLOCK_ALARM_INTERRUPT - asserts when alarm condition in Calendar mode is met.
  • RTC_A_CLOCK_READ_READY_INTERRUPT - asserts when Calendar registers are settled.
  • RTC_A_PRESCALE_TIMER0_INTERRUPT - asserts when Prescaler 0 event condition is met.
  • RTC_A_PRESCALE_TIMER1_INTERRUPT - asserts when Prescaler 1 event condition is met.
Returns
Logical OR of any of the following:
  • RTC_A_TIME_EVENT_INTERRUPT asserts when counter overflows in counter mode or when Calendar event condition defined by defineCalendarEvent() is met.
  • RTC_A_CLOCK_ALARM_INTERRUPT asserts when alarm condition in Calendar mode is met.
  • RTC_A_CLOCK_READ_READY_INTERRUPT asserts when Calendar registers are settled.
  • RTC_A_PRESCALE_TIMER0_INTERRUPT asserts when Prescaler 0 event condition is met.
  • RTC_A_PRESCALE_TIMER1_INTERRUPT asserts when Prescaler 1 event condition is met.
    indicating the status of the masked interrupts

§ RTC_A_getPrescaleValue()

uint8_t RTC_A_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_A_holdClock() before calling this API.

Parameters
baseAddressis the base address of the RTC_A module.
prescaleSelectis the prescaler to obtain the value of. Valid values are:
  • RTC_A_PRESCALE_0
  • RTC_A_PRESCALE_1
Returns
The value of the specified prescaler count register

§ RTC_A_holdClock()

void RTC_A_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_A module.
Returns
None

§ RTC_A_holdCounterPrescale()

void RTC_A_holdCounterPrescale ( uint16_t  baseAddress,
uint8_t  prescaleSelect 
)

Holds the selected Prescaler.

This function holds the prescale counter from continuing. This will only work in counter mode, in Calendar mode, the RTC_A_holdClock() must be used. In counter mode, if using both prescalers in conjunction with the main RTC counter, then stopping RT0PS will stop RT1PS, but stopping RT1PS will not stop RT0PS.

Parameters
baseAddressis the base address of the RTC_A module.
prescaleSelectis the prescaler to hold. Valid values are:
  • RTC_A_PRESCALE_0
  • RTC_A_PRESCALE_1
Returns
None

§ RTC_A_initCalendar()

void RTC_A_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_A_disableInterrupt(), RTC_A_clearInterrupt() and RTC_A_configureCalendarAlarm() before calendar initialization.

Parameters
baseAddressis the base address of the RTC_A 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
Month between 1-12
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_A_FORMAT_BINARY [Default]
  • RTC_A_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.

§ RTC_A_initCounter()

void RTC_A_initCounter ( uint16_t  baseAddress,
uint16_t  clockSelect,
uint16_t  counterSizeSelect 
)

Initializes the settings to operate the RTC in Counter mode.

This function initializes the Counter mode of the RTC_A. Setting the clock source and counter size will allow an interrupt from the RTCTEVIFG once an overflow to the counter register occurs.

Parameters
baseAddressis the base address of the RTC_A module.
clockSelectis the selected clock for the counter mode to use. Valid values are:
  • RTC_A_CLOCKSELECT_ACLK [Default]
  • RTC_A_CLOCKSELECT_SMCLK
  • RTC_A_CLOCKSELECT_RT1PS - use Prescaler 1 as source to RTC
    Modified bits are RTCSSEL of RTCCTL1 register.
counterSizeSelectis the size of the counter. Valid values are:
  • RTC_A_COUNTERSIZE_8BIT [Default]
  • RTC_A_COUNTERSIZE_16BIT
  • RTC_A_COUNTERSIZE_24BIT
  • RTC_A_COUNTERSIZE_32BIT
    Modified bits are RTCTEV of RTCCTL1 register.
Returns
None

§ RTC_A_initCounterPrescale()

void RTC_A_initCounterPrescale ( uint16_t  baseAddress,
uint8_t  prescaleSelect,
uint16_t  prescaleClockSelect,
uint16_t  prescaleDivider 
)

Initializes the Prescaler for Counter mode.

This function initializes the selected prescaler for the counter mode in the RTC_A module. If the RTC is initialized in Calendar mode, then these are automatically initialized. The Prescalers can be used to divide a clock source additionally before it gets to the main RTC clock.

Parameters
baseAddressis the base address of the RTC_A module.
prescaleSelectis the prescaler to initialize. Valid values are:
  • RTC_A_PRESCALE_0
  • RTC_A_PRESCALE_1
prescaleClockSelectis the clock to drive the selected prescaler. Valid values are:
  • RTC_A_PSCLOCKSELECT_ACLK
  • RTC_A_PSCLOCKSELECT_SMCLK
  • RTC_A_PSCLOCKSELECT_RT0PS - use Prescaler 0 as source to Prescaler 1 (May only be used if prescaleSelect is RTC_A_PRESCALE_1)
    Modified bits are RTxSSEL of RTCPSxCTL register.
prescaleDivideris the divider for the selected clock source. Valid values are:
  • RTC_A_PSDIVIDER_2 [Default]
  • RTC_A_PSDIVIDER_4
  • RTC_A_PSDIVIDER_8
  • RTC_A_PSDIVIDER_16
  • RTC_A_PSDIVIDER_32
  • RTC_A_PSDIVIDER_64
  • RTC_A_PSDIVIDER_128
  • RTC_A_PSDIVIDER_256
    Modified bits are RTxPSDIV of RTCPSxCTL register.
Returns
None

§ RTC_A_setCalendarEvent()

void RTC_A_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_A module.
eventSelectis the condition selected. Valid values are:
  • RTC_A_CALENDAREVENT_MINUTECHANGE - assert interrupt on every minute
  • RTC_A_CALENDAREVENT_HOURCHANGE - assert interrupt on every hour
  • RTC_A_CALENDAREVENT_NOON - assert interrupt when hour is 12
  • RTC_A_CALENDAREVENT_MIDNIGHT - assert interrupt when hour is 0
    Modified bits are RTCTEV of RTCCTL register.
Returns
None

§ RTC_A_setCalibrationData()

void RTC_A_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_A module.
offsetDirectionis the direction that the calibration offset will go. Valid values are:
  • RTC_A_CALIBRATION_DOWN2PPM - calibrate at steps of -2
  • RTC_A_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

§ RTC_A_setCalibrationFrequency()

void RTC_A_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_A module.
frequencySelectis the frequency output to RTCCLK. Valid values are:
  • RTC_A_CALIBRATIONFREQ_OFF [Default] - turn off calibration output
  • RTC_A_CALIBRATIONFREQ_512HZ - output signal at 512Hz for calibration
  • RTC_A_CALIBRATIONFREQ_256HZ - output signal at 256Hz for calibration
  • RTC_A_CALIBRATIONFREQ_1HZ - output signal at 1Hz for calibration
    Modified bits are RTCCALF of RTCCTL3 register.
Returns
None

§ RTC_A_setCounterValue()

void RTC_A_setCounterValue ( uint16_t  baseAddress,
uint32_t  counterValue 
)

Sets the value of the Counter register.

This function sets the counter register of the RTC_A module.

Parameters
baseAddressis the base address of the RTC_A module.
counterValueis the value to set the Counter register to; a valid value may be any 32-bit integer.
Returns
None

§ RTC_A_setPrescaleValue()

void RTC_A_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_A_holdClock().

Parameters
baseAddressis the base address of the RTC_A module.
prescaleSelectis the prescaler to set the value for. Valid values are:
  • RTC_A_PRESCALE_0
  • RTC_A_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

§ RTC_A_startClock()

void RTC_A_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_A module.
Returns
None

§ RTC_A_startCounterPrescale()

void RTC_A_startCounterPrescale ( uint16_t  baseAddress,
uint8_t  prescaleSelect 
)

Starts the selected Prescaler.

This function starts the selected prescale counter. This function will only work if the RTC is in counter mode.

Parameters
baseAddressis the base address of the RTC_A module.
prescaleSelectis the prescaler to start. Valid values are:
  • RTC_A_PRESCALE_0
  • RTC_A_PRESCALE_1
Returns
None

Copyright 2020, Texas Instruments Incorporated