📄 main.lst
字号:
C51 COMPILER V7.09 MAIN 06/18/2004 09:24:38 PAGE 1
C51 COMPILER V7.09, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN main.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE main.c DEBUG OBJECTEXTEND
line level source
1 #include <reg51f.h>
2
3 /*------------------------------------------------
4 This function adjusts the watchdog timer compare
5 value to the current PCA timer value + 0xFF00.
6
7 Note that you must write to CCAP4L first, then
8 write to CCAP4H.
9 ------------------------------------------------*/
10 void watchdog_reset (void)
11 {
12 1 unsigned int newval;
13 1
14 1 newval = (CH << 8) | CL;
15 1 newval += 0xFF00;
16 1
17 1 CCAP4L = newval;
18 1 CCAP4H = newval >> 8;
19 1 }
20
21 /*------------------------------------------------
22 MAIN C function
23 ------------------------------------------------*/
24 void main (void)
25 {
26 1 unsigned int i;
27 1
28 1 /*--------------------------------------
29 1 Configure PCA Module 4 as the watchdog
30 1 and make sure it doesn't time-out
31 1 immediately.
32 1 --------------------------------------*/
33 1 watchdog_reset ();
34 1 CCAPM4 = 0x48;
35 1
36 1 /*--------------------------------------
37 1 Configure the PCA for watchdog timer.
38 1 --------------------------------------*/
39 1 CMOD = (CMOD & 0x01) | 0x40;
40 1
41 1 /*--------------------------------------
42 1 Start the PCA Timer.
43 1
44 1 From this point on, we must reset the
45 1 watchdog timer every 0xFF00 clock
46 1 cycles. If we don't the watchdog timer
47 1 will reset the MCU.
48 1 --------------------------------------*/
49 1 CR = 1;
50 1
51 1 /*--------------------------------------
52 1 Do something for a while and make sure
53 1 that we don't get reset by the watchdog.
54 1 --------------------------------------*/
55 1 for (i = 0; i < 1000; i++)
C51 COMPILER V7.09 MAIN 06/18/2004 09:24:38 PAGE 2
56 1 {
57 2 watchdog_reset ();
58 2 }
59 1
60 1 /*--------------------------------------
61 1 Stop updating the watchdog and we should
62 1 get reset.
63 1 --------------------------------------*/
64 1 while (1)
65 1 {
66 2 }
67 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 54 ----
CONSTANT SIZE = ---- ----
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 + -