1 / 13

ECE 447 Fall 2009

ECE 447 Fall 2009. Lecture 13: TI MSP430 Watchdog Timer and Real-Time Clock. ECE447: MSP430 Watchdog Timer Concept.

Télécharger la présentation

ECE 447 Fall 2009

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ECE 447 Fall 2009 Lecture 13: TI MSP430 Watchdog Timer and Real-Time Clock

  2. ECE447: MSP430 Watchdog Timer Concept • A watchdog timer (or computer operating properly timer) is a hardware timing device that triggers a system reset if the main program, due to some fault condition, such as a hang, neglects to regularly service the watchdog.

  3. ECE447: Use Cases for Watchdog Timer • Out of Control Software: • Trapped in infinite loop • Code/Memory overwrite • Peripheral Failure: • Polling a non responsive device • SW controlled reset: • The WDT register can be used to force a reset purposely

  4. ECE 447: Enabling and Disabling the WDT • The WDT is always active after a reset • Default settings allow the software about 32ms to clear, stop, or reconfigure the WDT at startup. • Up until now we have always stopped the WDT by setting the WDT-HOLD bit.

  5. ECE447: Petting the Watchdog • Petting is performed by writing to the WDT-CNTCL bit. • All writes to the WDT register are protected by a 8 bit password. • 0x5A must be the upper byte value of any write to the WDTCTL register • Any other value will cause an immediate reset.

  6. ECE 447: WDT Control Register

  7. ECE447: MSP430 Basic Timer1 • Basic Timer 1 provides two or three fucntions in the MSP430: • Clock for the LCD module • Periodic Interrupts • 1Hz clock signal to drive the Real-Time Clock • The RTC only exists in newer MSP430xFxx family devices.

  8. ECE447: MSP430 Basic Timer1 • BTCNT1 and BTCNT2 count based on control bits in BTFRQx and BTIPx. • BTCNT2 causes the BTIFG flasg to be set at each rollover, with a rame from 16ms to 2s.

  9. ECE447: MSP430 Real Timer Clock Concept • A Real-Time Clock (RTC) is a hardware device that counts time based on seconds, minutes, hours, days, months, and year. • Unlike most clocks in a microcontroller that do not convey useful data directly, the RTC is directly human understandable.

  10. ECE447: MSP430 Real Timer Clock Concept • The current time and date are held in a set of registers that contain the following bytes: • Second (RTCSEC) • Minute (RTCMIN) • Hour (RTCHOUR), which runs from 0-23 (24-hour format) • Day of week (RTCDOW), which runs from 0-6 • Day of month (RTCDAY) • Month (RTCMON) • Year (RTCYEARL), assuming BCD format • Century (RTCYEARH), assuming BCD format.

  11. ECE447: MSP430 Real Timer Clock Data Registers • The RTC is controlled by the RTCCTL • It is initially disabled at reset (RTCHOLD is set) • It can store its data registers in BCD or unsigned binary numbers (RTCBDC) • Care should be taken in reading the RTC, see Davies p286.

  12. ECE447: MSP430 Real Timer Clock Data Registers • The Real-Time Clock has an interrupt flag RTCFG and corresponding enable bit RTCIE inRTCCTL. • The flag is set every minute, every hour, daily at midnight, or daily at noondepending on the RTCTEVx bits. • There is no alarm interrupt function, this must be implemented in software if desired.

  13. ECE447: MSP430 Class Exercise Write a C program that sets up the RTC and sets the date to today, 18:00:00, and starts the time displaying on the Hitachi LCD module attached to P1 (4-bit mode) The time will be displayed in 24hr format with hours, minutes, and seconds. The output should be updated any time that the corresponding values are updated in the RTC registers.

More Related