📄 watchdog.lst
字号:
C51 COMPILER V6.14h WATCHDOG 08/31/2001 12:56:29 PAGE 1
C51 COMPILER V6.14h, COMPILATION OF MODULE WATCHDOG
OBJECT MODULE PLACED IN watchdog.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE watchdog.c DEBUG OBJECTEXTEND
stmt level source
1 /*------------------------------------------------------------------------------
2 watchDog.c : Sample Program that demonstrates the watchdog timer for the
3 following microcontrollers
4
5 Dallas Semiconductor DS80C320
6 Dallas Semiconductor DS80C323
7
8 Copyright (c) 1988-2001 Keil Elektronik GmbH and Keil Software, Inc.
9 All rights reserved.
10 --------------------------------------------------------------------------*/
11
12 #include <stdio.h>
13
14 sfr WDCON = 0xD8;
15 sfr CKCON = 0x8E;
16 sfr TA = 0xC7;
17
18 sfr SCON0 = 0x98;
19 sfr TMOD = 0x89;
20 sfr TH1 = 0x8D;
21 sbit TR1 = 0x88^6;
22 sbit TI = SCON0^1;
23
24 void reset_Watchdog( void )
25 {
26 1 WDCON |= 0x02;
27 1 }
28
29
30 /*------------------------------------------------------------------------------
31 main() : Runs a while loop that simulated a condition that will cause the
32 watchdog timer to reset the microcontroller
33 ------------------------------------------------------------------------------*/
34 void main( void )
35 {
36 1
37 1 int i;
38 1
39 1 /*------------------------------------------------
40 1 Setup the serial port for 1200 baud at 16MHz.
41 1 ------------------------------------------------*/
42 1 SCON0 = 0x50; /* SCON: mode 1, 8-bit UART, enable rcvr */
43 1 TMOD |= 0x20; /* TMOD: timer 1, mode 2, 8-bit reload */
44 1 TH1 = 221; /* TH1: reload value for 1200 baud @ 16MHz */
45 1 TR1 = 1; /* TR1: timer 1 run */
46 1 TI = 1; /* TI: set TI to send first char of UART */
47 1
48 1 if( WDCON & 0x04 )
49 1 {
50 2 printf("Watchdog Reset Occured\n");
51 2 WDCON &= ~0x04;
52 2 }
53 1
54 1 WDCON |= 0x01; //Enable the Watchdog timer
55 1 CKCON |= 0xC0; //Set rest time to 2684.38ms
C51 COMPILER V6.14h WATCHDOG 08/31/2001 12:56:29 PAGE 2
56 1
57 1 TA = 0xAA; //Accessing timed access in order to start the watchdog timer
58 1 TA = 0x55; //
59 1
60 1 WDCON |= 0x02; //Start watch dog timer
61 1
62 1 for( i = 0; i < 500; i++)
63 1 {
64 2 reset_Watchdog();
65 2 }
66 1
67 1 while(1)
68 1 {
69 2 //Simulating a error that would cause the watchdog timer to reset processor
70 2 }
71 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 68 ----
CONSTANT SIZE = 24 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -