📄 main.lst
字号:
C51 COMPILER V7.09 MAIN 05/22/2004 01:49:23 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 BROWSE DEBUG OBJECTEXTEND
line level source
1 #include <reg52.h>
2 #include <stdio.h>
3
4 /*------------------------------------------------
5 Timer 1 Interrupt Service Routine.
6
7 Set a breakpoint on 'overflow_count++' and run the
8 program in the debugger. You will see this line
9 executes every 100 clock cycles (or 10,000 Hz).
10
11 So, overflow_count is actually a 1/10,000 sec
12 timer.
13 ------------------------------------------------*/
14 static unsigned long overflow_count = 0;
15
16 void timer1_ISR (void) interrupt 3
17 {
18 1 overflow_count++; /* Increment the overflow count */
19 1 }
20 void main (void)
21 {
22 1 /*--------------------------------------
23 1 Set Timer1 for 8-bit timer with reload
24 1 (mode 2). The timer counts to 255,
25 1 overflows, is reloaded with 156, and
26 1 generates an interrupt.
27 1
28 1 Set the Timer1 Run control bit.
29 1 --------------------------------------*/
30 1 TMOD = (TMOD & 0x0F) | 0x20; /* Set Mode (8-bit timer with reload) */
31 1 TH1 = 256 - 100; /* Reload TL1 to count 100 clocks */
32 1 TL1 = TH1;
33 1 ET1 = 1; /* Enable Timer 1 Interrupts */
34 1 TR1 = 1; /* Start Timer 1 Running */
35 1 EA = 1; /* Global Interrupt Enable */
36 1
37 1 /*--------------------------------------
38 1 Do Nothing. Actually, the timer 1
39 1 interrupt will occur every 100 clocks.
40 1 Since the oscillator runs at 12 MHz,
41 1 the interrupt will happen every 10 KHz.
42 1 --------------------------------------*/
43 1 while (1)
44 1 {
45 2 }
46 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 52 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 4 ----
IDATA SIZE = ---- ----
C51 COMPILER V7.09 MAIN 05/22/2004 01:49:23 PAGE 2
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 + -