📄 t0_m3_t_gs.lst
字号:
C51 COMPILER V7.06 T0_M3_T_GS 04/08/2004 13:57:01 PAGE 1
C51 COMPILER V7.06, COMPILATION OF MODULE T0_M3_T_GS
OBJECT MODULE PLACED IN t0_m3_t_gs.OBJ
COMPILER INVOKED BY: C:\KEIL\C51\BIN\C51.EXE t0_m3_t_gs.c BROWSE DEBUG OBJECTEXTEND
stmt level source
1 /**
2 * @file $RCSfile: t0_m3_t_gs.c,v $
3 *
4 * Copyright (c) 2004 Atmel.
5 *
6 * Please read file license.txt for copyright notice.
7 *
8 * @brief This file is an example to use timer0 in mode 3.
9 *
10 * This file can be parsed by Doxygen for automatic documentation
11 * generation.
12 * Put here the functional description of this file within the software
13 * architecture of your program.
14 *
15 * @version $Revision: 1.0 $ $Name: $
16 */
17
18 /* @section I N C L U D E S */
19 #include "reg_c51.h"
20
21
22 /**
23 * FUNCTION_PURPOSE: This file set up timer 0 in mode 3 (two 8 bits timers)
24 * with a software gate for the first.The second is always in timer mode
25 * without hardware gate.
26 * The two 8-bits register consist of all 8 bits of TL0 for the first timer
27 * and all 8 bits of TH0 for the second timer.
28 * In mode 3 TR1 is used for run the second timer and timer1.
29 * FUNCTION_INPUTS: void
30 * FUNCTION_OUTPUTS: void
31 */
32 void main(void)
33 {
34 1 TMOD &= 0xF0; /* Timer 0 mode 3 with software gate */
35 1 TMOD |= 0x03; /* GATE0=0; C/T0#=0; M10=1; M00=1; */
36 1
37 1 TH0 = 0x00; /* init values */
38 1 TL0 = 0x00;
39 1 ET0=1; /* enable first timer interrupt */
40 1 ET1=1; /* enable second timer interrupt */
41 1 EA=1; /* enable interrupts */
42 1 TR0=1; /* run the first timer */
43 1 TR1=1; /* run the second timer */
44 1
45 1 while(1); /* endless */
46 1 }
47
48
49 /**
50 * FUNCTION_PURPOSE: first timer interrupt
51 * FUNCTION_INPUTS: void
52 * FUNCTION_OUTPUTS: P1.0 toggle period = 2 * 8192 cycles
53 */
54 void it_first_timer(void) interrupt 1 /* interrupt address is 0x000b */
55 {
C51 COMPILER V7.06 T0_M3_T_GS 04/08/2004 13:57:01 PAGE 2
56 1 TF0 = 0; /* reset interrupt flag (already done by hardware)*/
57 1 P1_0 = ~P1_0; /* P1.0 toggle when interrupt. */
58 1 }
59
60
61 /**
62 * FUNCTION_PURPOSE: second timer interrupt.In mode 3 timer1 have not
63 * interrupt.
64 * FUNCTION_INPUTS: void
65 * FUNCTION_OUTPUTS: P1.1 toggle period = 2 * 8192 cycles
66 */
67 void it_second_timer(void) interrupt 3 /* interrupt address is 0x001b */
68 {
69 1 TF1 = 0; /* reset interrupt flag (already done by hardware)*/
70 1 P1_1 = ~P1_1; /* P1.1 toggle when interrupt. */
71 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 33 ----
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 + -