?? main.lst
字號:
C51 COMPILER V8.08 MAIN 07/02/2012 22:51:19 PAGE 1
C51 COMPILER V8.08, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN main.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE main.c BROWSE DEBUG OBJECTEXTEND
line level source
1 //main.c
2 #include <reg51.h> //包含頭文件
3 #include "fun.h"
4
5 void INT0_interrupt() interrupt 0
6 {
7 1 running = ~running; //切換暫停/計時
8 1 if (running)
9 1 {//切換為運行
10 2 TR0 = 1;
11 2 }
12 1 else
13 1 { //切換為暫停
14 2 TR0 = 0;
15 2 }
16 1 }
17
18 void Timer0_interrupt() interrupt 1
19 {
20 1 TH0 = T0_50ms >> 8; //重裝初值
21 1 TL0 = T0_50ms;
22 1
23 1 if ((++ count_in_T0) == 20)//count_in_T0自加到20,計時1s
24 1 {
25 2 count_in_T0 = 0;
26 2 if ( (++ display_num) ==60)
27 2 {//display_num自加1后判斷是否等于60
28 3 display_num = 0;
29 3 }
30 2 }
31 1 }
32
33 main()
34 {
35 1 unsigned char shi, ge; //定義十位、個位要輸出的數據
36 1
37 1 init_port();
38 1 init_int();
39 1 init_timer();
40 1
41 1 display_num = 0;
42 1 count_in_T0 = 0;
43 1 running = 0;
44 1 //把兩個數碼管都關閉
45 1 en2 = 1;
46 1 en1 = 1;
47 1 EA = 1;//開總中斷
48 1 TR0 = 1;//啟動T0
49 1
50 1 while(1)
51 1 {
52 2 shi = display_num / 10;
53 2 ge = display_num % 10;
54 2 display(shi,ge);
55 2 //檢測清零按鍵
C51 COMPILER V8.08 MAIN 07/02/2012 22:51:19 PAGE 2
56 2 if ( clear == 0)
57 2 {
58 3 ms_delay(10);
59 3 if ( clear == 0 )
60 3 {//確認按下清零按鈕
61 4 if ( !running )//如果處于暫停狀態
62 4 display_num = 0;
63 4 }
64 3 }
65 2 }
66 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 200 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 12 ----
IDATA SIZE = ---- ----
BIT SIZE = 1 ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -