Detailed explanation of how to use the MSP430 watchdog

Publisher:ShuxiangLatest update time:2012-10-15 Source: 21ic Keywords:MSP430 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Take MSP430F2274 as an example. The assembly implementation uses IAR assembly, and the CCE assembly implementation can be slightly modified.

1. The watchdog has three working modes: stop mode, timer mode, and watchdog mode.

2. The clock sources that can be selected in the latter two modes are: SMCLK and ACLK.

3. When using the latter two modes, pay attention to whether the watchdog can work under the state of the MCU. For example, when the MCU is in LPM3, there is only ACLK clock, and in LPM4, there is no clock available.

4. How to use the watchdog mode: When the watchdog count overflows, the program is reset. Enable the watchdog in the program, clear the watchdog before the count overflows, or reset the watchdog to restart the count. If the program runs away, the watchdog may not be cleared or reset, and it will overflow, causing the program to reset.

5. In MSP430F2274, the maximum timing in watchdog mode is 1s. If a longer reset time is required, you can use other counters and execute ((void (*)())RESET_VECTOR)(); after the count is full, or write an error value to the watchdog control register or execute an invalid command after the count is full: such as ((void (*)())0x170)(); 0x170 is an address of a peripheral module and cannot be a function address, so executing this sentence will reset the program.

Stop mode: Disable watchdog

C language implementation: WDTCTL = WDTPW + WDTHOLD

Assembly language implementation: mov.w #WDTPW+WDTHOLD,&WDTCTL

Timer mode: used as a timer, the watchdog interrupt function is executed when the counter is full and an interrupt is generated.

C language implementation:

In the main program: turn on the watchdog timer, such as: WDTCTL = WDT_MDLY_8; or WDTCTL = WDT_ADLY_250; etc.

The watchdog interrupt function is:

#pragma vector=WDT_VECTOR

__interrupt void watchdog_timer(void)

{

//.................................................

}

Assembly language implementation:

Enable the watchdog timer, such as:

mov.w

#WDTPW+WDTTMSEL+WDTCNTCL+WDTIS0 ,&WDTCTL

or mov.w

#WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL+WDTIS0,&WDTCTL, etc.

Watchdog interrupt vector in the interrupt vector table:

ORG 0FFF4h ;msp430f2274 watchdog interrupt address

DW

RESET; The program starts with REST as the label

Watchdog interrupt function:

WDT_ISR

;....................

reti

Watchdog mode: When the count overflows, the reset interrupt function is executed.

C language implementation:

Clear watchdog: WDTCTL = WDTPW+WDTCNCTL;

Set watchdog: WDTCTL = WDT_MRST_0_5;

or WDTCTL = WDT_ARST_1000; etc.

Assembly language implementation:

Reset vector in the interrupt vector table:

ORG 0FFFEh ;msp430f2274 reset address

DW

RESET; The program starts with REST as the label

Clear watchdog: mov.w #WDTPW+WDTCNCTL,&WDTCTL

Set up the watchdog:

mov.w

# WDTPW+WDTCNTCL+WDTIS1 ,&WDTCTL

mov.w

# WDTPW+WDTCNTCL+WDTSSEL,&WDTCTL;etc.

Original post address: http://bbs.21ic.com/icview-339370-1-1.html

Keywords:MSP430 Reference address:Detailed explanation of how to use the MSP430 watchdog

Previous article:AD program of STC12C5410AD single chip microcomputer two digital tube display
Next article:SPI data memory expansion based on MSP430F12x2

Recommended ReadingLatest update time:2024-11-16 15:47

MSP430 Flowing Light Ⅱ
//Three flow modes and four flow speeds of running lights   #include msp430f149.h      typedef unsigned int  uint;      uint i = 0,j = 0,dir = 0;   uint flag = 0,speed = 0;      void main( void )   {       P1DIR = 0XFF;P1OUT = 0XFF;       P2DIR = 0XFF;P2OUT = 0XFF;       P3DIR = 0XFF;P3OUT = 0XFF;       P4DIR = 0XFF;P
[Microcontroller]
MSP430 Tutorial 15: MSP430 MCU Serial Communication Module
Serial asynchronous communication module    In the MSP430 series of products, each model can realize the function of serial communication. In the 430F1X11 series, the serial communication function can be realized by combining timer A and software programming. In other series of products, the hardware serial communicat
[Microcontroller]
Design of wireless charger based on MSP430 microcontroller
   introduction   At present, the charging of portable electronic devices such as mobile phones, MP3 and laptops mainly adopts the traditional charging method of connecting one end to the AC power supply and the other end to the portable electronic device rechargeable battery. This method has many disadvantages, such
[Power Management]
Design of wireless charger based on MSP430 microcontroller
Application of MSP430F in the highway toll collection system (ETC)
    MSP430 Introduction   TI's MSP430 microcontroller product series has a 16-bit RSIC architecture and ultra-low power consumption. As the latest product series of MSP430, F5xxx uses 0.18um process for the first time, and the current consumed by 1MIPs is as low as an astonishing 160uA, and the main frequency reaches
[Microcontroller]
Application of MSP430F in the highway toll collection system (ETC)
MSP430 Register Chinese Notes ---- Serial Port Register
/************************************************************ * The bits defined by USART serial port registers "UCTL", "UTCTL", and "URCTL" are shared by serial port 1 and serial port 2 **********************************************************/ /* UCTL serial port control register*/  #define PENA 0
[Microcontroller]
Real-time recording of MSP430 programming problems
I encountered a very strange problem during programming. When the LISTEN control word of the sending buffer and the receiving buffer is zero and the two ends are not connected by a line, the receiving buffer is also changed when the value of the sending buffer is set. I am currently checking various issues and will pos
[Microcontroller]
Smart remote control based on MSP430F413 and chip resistors
  introduction   At present, most of the common wireless remote controls on the market are four-key and twelve-key, mainly used in car anti-theft systems, home anti-theft systems and remote control toys. These applications are simple, practical and low-cost. However, for some projects that require a distance of more
[Microcontroller]
Smart remote control based on MSP430F413 and chip resistors
Use of _EINT, _BIS_SR, and _NOP in MSP430
I just started learning MSP430 and used IAR5.4. I wrote my first program according to the example in the reference book. It is as follows:     #include "io430.h" void main( void ) {   // Stop watchdog timer to prevent time out reset   WDTCTL = WDT_ADLY_250;   IE1 |= WDTIE;   P1DIR |= 0X01;   _EINT();  
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components
Guess you like

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号