📄 mcu.lst
字号:
C51 COMPILER V7.10 MCU 07/03/2008 12:45:33 PAGE 1
C51 COMPILER V7.10, COMPILATION OF MODULE MCU
OBJECT MODULE PLACED IN .\mcu.obj
COMPILER INVOKED BY: C:\Program Files\Keil\C51\BIN\C51.EXE ..\SourceFile\mcu.c BROWSE DEBUG OBJECTEXTEND PRINT(.\mcu.lst
-) OBJECT(.\mcu.obj)
line level source
1
2 /***************************************************************************************
3 ****************************************************************************************
4 * FILE : mcu.c
5 * Description :
6 *
7 * Copyright (c) 2007 by WANG SHAOWEI. All Rights Reserved.
8 *
9 * History:
10 * Version Name Date Description
11 0.1 WANG SHAOWEI 2007/04/29 Initial Version
12
13 ****************************************************************************************
14 ****************************************************************************************/
15
16
17
18 #include "common.h"
19
20
21
22 /*==================================================================
23 * Function : port_init
24 * Description : Port init
25 * Input Para : void
26 * Output Para : void
27 * Return Value: void
28 ==================================================================*/
29 void port_init(void)
30 {
31 1 P0 = 0xFF;
32 1 P1 = 0xFF;
33 1 P2 = 0xFF;
34 1 P3 = 0xFF;
35 1 }
36
37
38
39 /*==================================================================
40 * Function : Interrupt_priority_init
41 * Description :
42 * Input Para :
43 * Output Para :
44 * Return Value:
45 ==================================================================*/
46 void Interrupt_priority_init(void)
47 {
48 1 //UART
49 1 PS = 1;
50 1 SETBIT(IPH, 4);
51 1
52 1 //TIMER2
53 1 PT2 = 0;
54 1 SETBIT(IPH, 5);
C51 COMPILER V7.10 MCU 07/03/2008 12:45:33 PAGE 2
55 1
56 1 //TIMER1
57 1 PT1 = 0;
58 1 RESETBIT(IPH, 3);
59 1
60 1 //INT1
61 1 PX1 = 0;
62 1 RESETBIT(IPH, 2);
63 1
64 1 //TIMER0
65 1 PT0 = 0;
66 1 RESETBIT(IPH, 1);
67 1
68 1 //INT0
69 1 PX0 = 0;
70 1 RESETBIT(IPH, 0);
71 1 }
72
73
74 /*==================================================================
75 * Function : extern_interrupt0_init
76 * Description :
77 * Input Para :
78 * Output Para :
79 * Return Value:
80 ==================================================================*/
81 void extern_interrupt0_init(U1 Enable, U1 EdgeEnable)
82 {
83 1 IE0 = 0; /*中断标记位*/
84 1 IT0 = EdgeEnable;
85 1 EX0 = Enable;
86 1 }
87
88
89 /*==================================================================
90 * Function : extern_interrupt1_init
91 * Description :
92 * Input Para :
93 * Output Para :
94 * Return Value:
95 ==================================================================*/
96 void extern_interrupt1_init(U1 Enable, U1 EdgeEnable)
97 {
98 1 IE1 = 0; /*中断标记位*/
99 1 IT1 = EdgeEnable;
100 1 EX1 = Enable;
101 1 }
102
103
104
105 /*==================================================================
106 * Function : mode_init
107 * Description :
108 * Input Para :
109 * Output Para :
110 * Return Value:
111 ==================================================================*/
112 void mode_init(void)
113 {
114 1 #ifdef SPEEDUP
115 1 SETBIT(CKCON, 0);
116 1 #else
C51 COMPILER V7.10 MCU 07/03/2008 12:45:33 PAGE 3
RESETBIT(CKCON, 0);
#endif
119 1 }
120
121
122 /*==================================================================
123 * Function : timer0_init
124 * Description : Timer0 initialize
125 * Input Para : bStart Enable Timer0
126 bInt0Relation Relation with Int0
127 bTimerMode 0:counter mode, 1:timer mode
128 bInterruptEnable Interrupt enable
129 WorkMode work mode setting,It has 0,1,2,3 four work mode,
130 the counter value difference
131 0: 13bit counter
132 1: 16bit counter
133 2: auto load 8bit counter
134 3: two 8bit counter
135 TH0Data High counter value
136 TL0Data Low counter value
137 * Output Para : void
138 * Return Value: void
139 ==================================================================*/
140 void timer0_init(U1 Enable,
141 U8 WorkMode,
142 U8 TH0Data,
143 U8 TL0Data)
144 {
145 1 TF0 = 0; /*定时器中断标志位*/
146 1
147 1 RESETBIT(TMOD, 3); /*不受INT0控制*/
148 1
149 1 RESETBIT(TMOD, 2); /*定时器计数器模式,TRUE为定时器,FALSE为计数器*/
150 1
151 1
152 1
153 1
154 1 if(WorkMode & 0x02) /*定时/计数器0工作方式设定*/
155 1 {
156 2 SETBIT(TMOD, 1);
157 2 }
158 1 else
159 1 {
160 2 RESETBIT(TMOD, 1);
161 2 }
162 1
163 1 if(WorkMode & 0x01)
164 1 {
165 2 SETBIT(TMOD, 0);
166 2 }
167 1 else
168 1 {
169 2 RESETBIT(TMOD, 0);
170 2 }
171 1 TH0 = TH0Data;
172 1 TL0 = TL0Data;
173 1
174 1 ET0 = (U1)1; /*中断允许*/
175 1 TR0 = Enable;
176 1
177 1 }
178
C51 COMPILER V7.10 MCU 07/03/2008 12:45:33 PAGE 4
179
180 /*==================================================================
181 * Function : timer2_init
182 * Description : The timer2 as system timer,so it only initialize for system time
183 * Input Para : bStart Enable Timer2
184 TH2Data High counter value
185 * Output Para : void
186 * Return Value: void
187 ==================================================================*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -