7/24/2023 0 Comments Real time clock timer![]() Real-Time Clock Interrupts in Calendar Mode NewTime = RTC_A_getCalendarTime(RTC_A_BASE) Read out New Time a Minute Later BREAKPOINT HERE #if defined(_TI_COMPILER_VERSION_) || defined(_IAR_SYSTEMS_ICC_) Enter LPM3 mode with interrupts enabled Also, enable interrupts for the Calendar alarm and Calendar event. Enable interrupt for RTC Ready Status, which asserts when the RTC Specify an interrupt to assert every minute RTC_A_configureCalendarAlarm(RTC_A_BASE, ¶m) Param.dayOfWeekAlarm = RTC_A_ALARMCONDITION_OFF ![]() RTC_A_configureCalendarAlarmParam param = Note: Does not specify day of the week. Setup Calendar Alarm for 5:00pm on the 5th day of the week. RTC_A_initCalendar(RTC_A_BASE, ¤tTime, RTC_A_FORMAT_BINARY) // Enable RTC in the calendar mode. This algorithm is accurate from the year 1901 through 2099. The calendar includes a leap-year algorithm that considers all years evenly divisible by four as * seconds, minutes, hours, day of week, day of month, month, and year in selectable BCD or hexadecimal In calendar mode, the RTC_A module provides * Calendar mode is selected when RTCMODE is set. Setup Current Date and Time for Calendar UCS_turnOnLFXT1(UCS_XT1_DRIVE_3, UCS_XCAP_3) If needed, user software can reduce the drive * starts with the highest drive settings for fast, reliable startup. * The DRIVE settings of XT1 in LF mode can be increased with the XT1DRIVE bits. Initialize LFXT1 - low frequency 32768 Hz oscillator GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P5, GPIO_PIN4 + GPIO_PIN5) * The GPIO_setAsPeripheralModuleFunctionInputPin() function sets them to their periferal designated * Enable XT1: port5 pin4 and pin5 are connected to 32768 Hz external oscillator on the schematics. WDT_A_hold(WDT_A_BASE) //Stop watchdog timer Volatile uint8_t bSendTimeToHost = FALSE // RTC->main(): "send the time over USB" Volatile uint8_t hour = 4, min = 30, sec = 00 // Real-time clock (RTC) values. * NOTE: Modify hal.h to select a specific evaluation board and customize for #include "USB_API/USB_Common/usb.h" //USB-specific functions HWREG16(baseAddress + OFS_RTCYEAR) = CalendarTime->Year HWREG8(baseAddress + OFS_RTCDATE_H) = CalendarTime->Month HWREG8(baseAddress + OFS_RTCDATE_L) = CalendarTime->DayOfMonth HWREG8(baseAddress + OFS_RTCTIM1_H) = CalendarTime->DayOfWeek HWREG8(baseAddress + OFS_RTCTIM1_L) = CalendarTime->Hours HWREG8(baseAddress + OFS_RTCTIM0_H) = CalendarTime->Minutes HWREG8(baseAddress + OFS_RTCTIM0_L) = CalendarTime->Seconds HWREG16(baseAddress + OFS_RTCCTL01) |= formatSelect HWREG16(baseAddress + OFS_RTCCTL01) &= ~(RTCBCD) HWREG8(baseAddress + OFS_RTCCTL01_H) |= RTCMODE_H + RTCHOLD_H Void RTC_A_initCalendar(uint16_t baseAddress, RTC_A_initCalendar(RTC_A_BASE, ¤tTime, RTC_A_FORMAT_BCD) Seconds, minutes, hours, day of week, day of month, month, and year in selectable BCD or hexadecimalįormat. ![]() The RTC_A module can be configured as a real-time clock with calendar function (calendar mode) or as aģ2-bit general purpose counter (counter mode) with the RTCMODE bit set to zero.Ĭalendar mode is selected when RTCMODE is set. The Real Time Clock module A (RTC_A) provides a real-time clock and calendar function that can also be configured as a The real time clock uses the LFXT1 oscillator in LF mode with a 32768-Hz crystal. The CPU can sleep or perform other functions between interrupts. Interrupts and a small CPU routine to count the interrupts. It consists of a timer/counter giving 1-second The general implementation of the RTC is simple. In the real-time clock application, the crystal oscillator is used as theĬlock source for the timer/counter that serves as the time base (either Timer_A or the Watchdog Timer in this application report). The RC-type oscillator is typically used for the CPU clock and the crystal oscillator is typically Real time clocks (RTC) are used in a variety of applications - from watches and clocks to time-stamping events, to generating events.Īll MSP430 devices contain both a digitally-controlled RC-type oscillator and a crystal oscillator. MSP430 RTC MSP430 MSP430 USB Project MSP430 SPI Generating and Loading MSP430 Binary Files MSP430 Interrupts and Low Power mode MSP430 Hardware Tools Unified Clock System 4 Bit Interface MSP430 To an Alpha-Numeric LCD display Configuring GPIOs MPS430 Real-Time ClockĪ real-time clock (RTC) is a computer clock that keeps track of the current date and time.
0 Comments
Leave a Reply. |