📄 gpt1.lst
字号:
C166 COMPILER V6.04, GPT1 08/30/2007 14:28:44 PAGE 1
C166 COMPILER V6.04, COMPILATION OF MODULE GPT1
OBJECT MODULE PLACED IN GPT1.OBJ
COMPILER INVOKED BY: C:\Keil C166\C166\BIN\C166.EXE GPT1.C MODV2 BROWSE MODV2 DEBUG
stmt lvl source
1 //****************************************************************************
2 // @Module General Purpose Timer Unit (GPT1)
3 // @Filename GPT1.C
4 // @Project SWITCH.dav
5 //----------------------------------------------------------------------------
6 // @Controller Infineon XC164CS-16F
7 //
8 // @Compiler Keil
9 //
10 // @Codegenerator 2.8
11 //
12 // @Description This file contains functions that use the GPT1 module.
13 //
14 //----------------------------------------------------------------------------
15 // @Date 2007-5-25 16:09:05
16 //
17 //****************************************************************************
18
19 // USER CODE BEGIN (GPT1_General,1)
20
21 // USER CODE END
22
23
24
25 //****************************************************************************
26 // @Project Includes
27 //****************************************************************************
28
29 #include "MAIN.H"
30
31 // USER CODE BEGIN (GPT1_General,2)
32 #include "stdio.h"
33 // USER CODE END
34
35
36 //****************************************************************************
37 // @Macros
38 //****************************************************************************
39
40 // USER CODE BEGIN (GPT1_General,3)
41
42 // USER CODE END
43
44
45 //****************************************************************************
46 // @Defines
47 //****************************************************************************
48
49 // USER CODE BEGIN (GPT1_General,4)
50
51 // USER CODE END
52
53
54 //****************************************************************************
55 // @Typedefs
C166 COMPILER V6.04, GPT1 08/30/2007 14:28:44 PAGE 2
56 //****************************************************************************
57
58 // USER CODE BEGIN (GPT1_General,5)
59
60 // USER CODE END
61
62
63 //****************************************************************************
64 // @Imported Global Variables
65 //****************************************************************************
66
67 // USER CODE BEGIN (GPT1_General,6)
68
69 // USER CODE END
70
71
72 //****************************************************************************
73 // @Global Variables
74 //****************************************************************************
75
76 // USER CODE BEGIN (GPT1_General,7)
77
78 // USER CODE END
79
80
81 //****************************************************************************
82 // @External Prototypes
83 //****************************************************************************
84
85 // USER CODE BEGIN (GPT1_General,8)
86
87 // USER CODE END
88
89
90 //****************************************************************************
91 // @Prototypes Of Local Functions
92 //****************************************************************************
93
94 // USER CODE BEGIN (GPT1_General,9)
95
96 // USER CODE END
97
98
99 //****************************************************************************
100 // @Function void GPT1_vInit(void)
101 //
102 //----------------------------------------------------------------------------
103 // @Description This is the initialization function of the GPT1 function
104 // library. It is assumed that the SFRs used by this library
105 // are in its reset state.
106 //
107 //----------------------------------------------------------------------------
108 // @Returnvalue None
109 //
110 //----------------------------------------------------------------------------
111 // @Parameters None
112 //
113 //----------------------------------------------------------------------------
114 // @Date 2007-5-25
115 //
116 //****************************************************************************
117
C166 COMPILER V6.04, GPT1 08/30/2007 14:28:44 PAGE 3
118 // USER CODE BEGIN (Init,1)
119
120 // USER CODE END
121
122 void GPT1_vInit(void)
123 {
124 1 // USER CODE BEGIN (Init,2)
125 1
126 1 // USER CODE END
127 1
128 1 /// -----------------------------------------------------------------------
129 1 /// Configuration of Timer Block Prescaler 1:
130 1 /// -----------------------------------------------------------------------
131 1 /// - prescaler for timer block 1 is 8
132 1
133 1
134 1 /// -----------------------------------------------------------------------
135 1 /// Configuration of the GPT1 Core Timer 3:
136 1 /// -----------------------------------------------------------------------
137 1 /// - timer 3 works in timer mode
138 1 /// - external up/down control is disabled
139 1 /// - prescaler factor is 128
140 1 /// - up/down control bit is reset
141 1 /// - alternate output function T3OUT (P3.3) is disabled
142 1 /// - timer 3 output toggle latch (T3OTL) is set to 0
143 1
144 1 GPT12E_T3CON = 0x0004; // load timer 3 control register
145 1 GPT12E_T3 = 0xC2F7; // load timer 3 register
146 1
147 1 /// -----------------------------------------------------------------------
148 1 /// Configuration of the GPT1 Auxiliary Timer 2:
149 1 /// -----------------------------------------------------------------------
150 1 /// - timer 2 works in timer mode
151 1 /// - external up/down control is disabled
152 1 /// - prescaler factor is 8
153 1 /// - up/down control bit is reset
154 1 /// - timer 2 run bit is reset
155 1
156 1 GPT12E_T2CON = 0x0000; // load timer 2 control register
157 1 GPT12E_T2 = 0x0000; // load timer 2 register
158 1
159 1 /// -----------------------------------------------------------------------
160 1 /// Configuration of the GPT1 Auxiliary Timer 4:
161 1 /// -----------------------------------------------------------------------
162 1 /// - timer 4 works in timer mode
163 1 /// - external up/down control is disabled
164 1 /// - prescaler factor is 8
165 1 /// - up/down control bit is reset
166 1 /// - timer 4 run bit is reset
167 1
168 1 GPT12E_T4CON = 0x0000; // load timer 4 control register
169 1 GPT12E_T4 = 0x0000; // load timer 4 register
170 1
171 1 /// -----------------------------------------------------------------------
172 1 /// Configuration of the used GPT1 Port Pins:
173 1 /// -----------------------------------------------------------------------
174 1
175 1
176 1 /// -----------------------------------------------------------------------
177 1 /// Configuration of the used GPT1 Interrupts:
178 1 /// -----------------------------------------------------------------------
179 1 /// timer 3 service request node configuration:
C166 COMPILER V6.04, GPT1 08/30/2007 14:28:44 PAGE 4
180 1 /// - timer 3 interrupt priority level (ILVL) = 11
181 1 /// - timer 3 interrupt group level (GLVL) = 1
182 1 /// - timer 3 group priority extension (GPX) = 0
183 1
184 1 GPT12E_T3IC = 0x006D;
185 1
186 1
187 1 // USER CODE BEGIN (GPT1_Function,3)
188 1
189 1 // USER CODE END
190 1
191 1 GPT12E_T3CON_T3R = 1; // set timer 3 run bit
192 1
193 1 } // End of function GPT1_vInit
194
195
196 //****************************************************************************
197 // @Function void GPT1_viTmr3(void)
198 //
199 //----------------------------------------------------------------------------
200 // @Description This is the interrupt service routine for the GPT1 timer 3.
201 // It is called up in the case of over or underflow of the
202 // timer 3 register.
203 // If the incremental interface mode is selected it is called
204 // up if count edge or count direction was detected.
205 //
206 // Please note that you have to add application specific code
207 // to this function.
208 //
209 //----------------------------------------------------------------------------
210 // @Returnvalue None
211 //
212 //----------------------------------------------------------------------------
213 // @Parameters None
214 //
215 //----------------------------------------------------------------------------
216 // @Date 2007-5-25
217 //
218 //****************************************************************************
219
220 // USER CODE BEGIN (Tmr3,1)
221 uword S5=0 ,S6=0; //IO口状态标志
222
223 // USER CODE END
224
225 void GPT1_viTmr3(void) interrupt T3INT
226 {
227 1 // USER CODE BEGIN (Tmr3,2)
228 1
229 1 // USER CODE END
230 1
231 1
232 1 // USER CODE BEGIN (Tmr3,5)
233 1
234 1 S5 = IO_ubReadPin(P9_P4); //读取P9.4口的值
235 1 S6 = IO_ubReadPin(P9_P5); //读取P9.5口的值
236 1
237 1 //输出选择的状态
238 1 if(S5 == 1)
239 1 printf("LED13\n");
240 1 else
241 1 printf("LED15\n");
C166 COMPILER V6.04, GPT1 08/30/2007 14:28:44 PAGE 5
242 1
243 1 if(S6==1)
244 1 printf("LED14\n");
245 1 else
246 1 printf("LED16\n");
247 1
248 1 // USER CODE END (Tmr3,5)
249 1 } // End of function GPT1_viTmr3
250
251
252
253
254 // USER CODE BEGIN (GPT1_General,10)
255
256 // USER CODE END
257
MODULE INFORMATION: INITIALIZED UNINITIALIZED
CODE SIZE = 180 --------
NEAR-CONST SIZE = 28 --------
FAR-CONST SIZE = -------- --------
HUGE-CONST SIZE = -------- --------
XHUGE-CONST SIZE = -------- --------
NEAR-DATA SIZE = 4 --------
FAR-DATA SIZE = -------- --------
XHUGE-DATA SIZE = -------- --------
IDATA-DATA SIZE = -------- --------
SDATA-DATA SIZE = -------- --------
BDATA-DATA SIZE = -------- --------
HUGE-DATA SIZE = -------- --------
BIT SIZE = -------- --------
INIT'L SIZE = 12 --------
END OF MODULE INFORMATION.
C166 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -