How to use 89S51 watchdog

Publisher:幸福梦想Latest update time:2013-03-08 Source: 21IC Keywords:89S51  Watchdog  ATMEL Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The 89S51 and 89C51 in ATMEL's 89S51 series have the same functions. The instructions are compatible. HEX programs can be used directly without any conversion. The 89S51 only adds a watchdog function compared to the 89C51. For other functions of the 89S51, please refer to the 89C51 data.

The specific usage of the watchdog is as follows:

In the initialization of the program, write 01EH first and then 0E1H to the watchdog register (WDTRST address is 0A6H) to activate the watchdog.

Org 0000

Ljmp begin

Begin:

Mov 0A6H,#01EH ; send 1E first

Mov 0A6H,#0E1H ; send to E1

;Activate the watchdog during program initialization.

For:

Mov 0A6H,#01EH ; send 1E first

Mov 0A6H,#0E1H ; send to E1

;Feed the dog command

Ljmp for

In C language, a declaration statement needs to be added.

Add a line sfr WDTRST = 0xA6 in the AT89X51.h declaration file;

Main()

{

WDTRST=0x1E;

WDTRST=0xE1; //Initialize watchdog.

While (1)

{

WDTRST=0x1E;

WDTRST=0xE1; //Dog feeding instruction

}

}

Note:

1. The watchdog of 89S51 must be activated by the program before it starts working. Therefore, it is necessary to ensure that the CPU has a reliable power-on reset. Otherwise, the watchdog will not work.

2. The watchdog uses the CPU crystal oscillator. When the crystal oscillator stops oscillating, the watchdog is invalid.

3. 89S51 has only 14-bit counter. The dog must be fed at least once in 16383 machine cycles. And this time is fixed and cannot be changed. When the crystal oscillator is 12M, the dog must be fed once every 16 milliseconds.

Keywords:89S51  Watchdog  ATMEL Reference address:How to use 89S51 watchdog

Previous article:How are C51 data stored in memory?
Next article:Comparison between MSP430 series and 89C5l series

Recommended ReadingLatest update time:2024-11-16 19:48

How to use the watchdog function of 89S51 microcontroller
The 89S51 and 89C51 of ATMEL's 89S51 series have the same functions and compatible instructions. The HEX program can be used directly without any conversion. The 89S51 only adds a watchdog function compared to the 89C51. Write 01EH first and then write 0E1H to the watchdog register (WDTRST address is 0A6H) to activate
[Microcontroller]
Detailed explanation of s3c2410 watchdog
1. What is a watchdog? Watchdog, the Chinese name is "watchdog", the full name is watchdog timer. From the literal meaning, we can know that it is actually a timer. However, it is different from the timers we usually come into contact with in terms of function. Ordinary timers generally play a role in timekeeping. Tim
[Microcontroller]
WINCE6.0+S3C6410 watchdog restart
// File: watchdog_sw_rst.c // // Samsung SMDK6410 SW_RST using watchdog timer support code. // #include windows.h #include ceddk.h #include oal.h #include s3c6410.h // WTCON - control register, bit specifications #define WTCON_PRESCALE(x) (((x)&0xff) 8) // bit 15:8, prescale value, 0
[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

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号