Use of MSP430 MCU Watchdog

Publisher:genius5Latest update time:2015-10-21 Source: eefocusKeywords:MSP430 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
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 last 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 make it count again. 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 you need to reset it with a longer time, 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.

6. Specific use of watchdog

6.1. Stop mode: turn off the watchdog

C language implementation: WDTCTL = WDTPW + WDTHOLD

6.2. 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:

Start the watchdog timer in the main program, such as: WDTCTL = WDT_MDLY_8;

The watchdog interrupt function is:

#pragmavector=WDT_VECTOR

__interruptvoid wATchdog_timer(void)

{

}

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

C language implementation:

Clear watchdog: WDTCTL = WDTPW+WDTCNTCL;

Set watchdog: WDTCTL = WDT_MRST_0_5;

or WDTCTL = WDT_ARST_1000;


Keywords:MSP430 Reference address:Use of MSP430 MCU Watchdog

Previous article:Design and Analysis of Data Acquisition System Based on CAN Bus Technology
Next article:MSP430 MCU Hardware IIC

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

Ordinary MCU Teaching Lecture 19 Timing/Counter Experiment 2
We have done the timer experiment before. Now let's take a look at the counting experiment. There are usually two requirements for counting at work: first, display the count value, and second, interrupt the alarm when the count value reaches a certain level. The first type is like various counters and odometers, and th
[Microcontroller]
Application of ultrasonic distance measurement in the field based on NEC single chip microcomputer
In order to facilitate the agricultural machinery operator to quickly and accurately know the depth of the machine operation, a field ultrasonic ranging method based on NEC single-chip microcomputer is proposed, a non-rigid contact ground profiling device and an electronic control system are designed, and ultrasonic r
[Microcontroller]
Application of ultrasonic distance measurement in the field based on NEC single chip microcomputer
51 single chip microcomputer static digital tube display
1. Create a new project and select the chip model. Note here - to prevent some pins from being undefined when inserting the header file reg You can try switching to the AT89C52 chip and inserting the header file as reg52. Of course, if you use the 51 model and it compiles successfully, that is also fine. 2. Displa
[Microcontroller]
51 single chip microcomputer static digital tube display
Application of Single Chip Microcomputer in Renovation of Old Milling Machine
1 Overview In the early 1990s, my country's mechanical processing industry realized mechatronics and carried out different degrees of transformation on old machine tools. When we participated in this work, we carefully analyzed the actual situation of the factory. Based on the principle of thrift and reducing t
[Microcontroller]
Application of Single Chip Microcomputer in Renovation of Old Milling Machine
Assembling 51 microcontroller button detection
Without further ado, let’s start with the code: ORG 00H LOOP: JB P3.4,LOOP LCALL DELAY JB P3.4,LOOP LOOP1:JB P3.4,LOOP JB P1.0,TC1 SETB P1.0 JMPLOOP TC1: CLR P1.0 JMPLOOP DELAY: MOV R7,#50 D1: MOV R6,#50 D2: DJNZ R6,D2 DJNZ R7,D1 RET END I won't talk about the static display of the digital tube, the dynamic displa
[Microcontroller]
Design of two DS18B20 temperature sensors based on 51 single chip microcomputer
This paper proposes a design scheme of a two-way temperature controller based on a 51 single-chip microcomputer. The design scheme uses two DS18B20 temperature sensors to collect the temperature of two different places, and processes it through AT89C51. The measured temperature is displayed by a four-digit LED digital
[Microcontroller]
Design of two DS18B20 temperature sensors based on 51 single chip microcomputer
51 MCU Development Series 1602 Character LCD Display
After getting started with the 51 single-chip microcomputer and having a certain understanding of the running lights, you can start learning the display peripheral drivers, because learning often requires direct verification and tracking of results, and display peripherals can provide feedback on the code running stat
[Microcontroller]
51 MCU Development Series 1602 Character LCD Display
Learning MCU by Proteus simulation
1 Introduction For the study of single-chip microcomputer, because it is relatively abstract, especially when writing programs, it is completely based on the programmer's careful logical thinking to design programs. In order to allow programmers to better understand and debug the programs they designed, all sin
[Microcontroller]
Learning MCU by Proteus simulation
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

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号