📄 asc0.lst
字号:
C166 COMPILER V6.02, ASC0 08/28/2006 10:05:55 PAGE 1
C166 COMPILER V6.02, COMPILATION OF MODULE ASC0
OBJECT MODULE PLACED IN ASC0.OBJ
COMPILER INVOKED BY: C:\Keil\C166\BIN\C166.EXE ASC0.C MODV2 BROWSE MODV2 DEBUG
stmt lvl source
1 //****************************************************************************
2 // @Module Asynchronous/Synchronous Serial Interface (ASC0)
3 // @Filename ASC0.C
4 // @Project TWINCAN.dav
5 //----------------------------------------------------------------------------
6 // @Controller Infineon XC164CS-16F
7 //
8 // @Compiler Keil
9 //
10 // @Codegenerator 2.7
11 //
12 // @Description This file contains functions that use the ASC0 module.
13 //
14 //----------------------------------------------------------------------------
15 // @Date 12/17/2004 7:07:08 PM
16 //
17 //****************************************************************************
18
19 // USER CODE BEGIN (ASC0_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 (ASC0_General,2)
32
33 // USER CODE END
34
35
36 //****************************************************************************
37 // @Macros
38 //****************************************************************************
39
40 // USER CODE BEGIN (ASC0_General,3)
41
42 // USER CODE END
43
44
45 //****************************************************************************
46 // @Defines
47 //****************************************************************************
48
49 // USER CODE BEGIN (ASC0_General,4)
50
51 // USER CODE END
52
53
54 //****************************************************************************
55 // @Typedefs
C166 COMPILER V6.02, ASC0 08/28/2006 10:05:55 PAGE 2
56 //****************************************************************************
57
58 // USER CODE BEGIN (ASC0_General,5)
59
60 // USER CODE END
61
62
63 //****************************************************************************
64 // @Imported Global Variables
65 //****************************************************************************
66
67 // USER CODE BEGIN (ASC0_General,6)
68
69 // USER CODE END
70
71
72 //****************************************************************************
73 // @Global Variables
74 //****************************************************************************
75
76 // USER CODE BEGIN (ASC0_General,7)
77
78 // USER CODE END
79
80
81 //****************************************************************************
82 // @External Prototypes
83 //****************************************************************************
84
85 // USER CODE BEGIN (ASC0_General,8)
86
87 // USER CODE END
88
89
90 //****************************************************************************
91 // @Prototypes Of Local Functions
92 //****************************************************************************
93
94 // USER CODE BEGIN (ASC0_General,9)
95
96 // USER CODE END
97
98
99 //****************************************************************************
100 // @Function void ASC0_vInit(void)
101 //
102 //----------------------------------------------------------------------------
103 // @Description This is the initialization function of the ASC0 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 12/17/2004
115 //
116 //****************************************************************************
117
C166 COMPILER V6.02, ASC0 08/28/2006 10:05:55 PAGE 3
118 // USER CODE BEGIN (Init,1)
119
120 // USER CODE END
121
122 void ASC0_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 the ASC0 Baudrate Generator:
130 1 /// -----------------------------------------------------------------------
131 1 /// - fractional divider as prescaler for baud rate timer is used
132 1
133 1 ASC0_FDV = 0x0074; // load ASC0 fractional divider register
134 1
135 1 /// - required baud rate = 9.600 kbaud
136 1 /// - real baud rate = 9.600 kbaud
137 1 /// - deviation = 0.001 %
138 1
139 1 ASC0_BG = 0x003A; // load ASC0 baud rate time reload register
140 1
141 1 /// -----------------------------------------------------------------------
142 1 /// Configuration of the ASC0 Operation Mode:
143 1 /// -----------------------------------------------------------------------
144 1 /// - 8-bit data asychronous operation with one stop bit
145 1 /// - receiver is enabled
146 1 /// - fractional divider is enabled
147 1
148 1 ASC0_CON = 0x0811; // load ASC0 control register
149 1
150 1 /// -----------------------------------------------------------------------
151 1 /// FIFO Configuration:
152 1 /// -----------------------------------------------------------------------
153 1 /// - receive FIFO is disabled
154 1 /// - transmit FIFO is disabled
155 1
156 1 ASC0_RXFCON = 0x0102; // load ASC0 receive FIFO control register
157 1 ASC0_TXFCON = 0x0102; // load ASC0 transmit FIFO control register
158 1
159 1 /// -----------------------------------------------------------------------
160 1 /// Configuration of the used ASC0 Port Pins:
161 1 /// -----------------------------------------------------------------------
162 1 /// - P3.10 is used for ASC Transmit Data Output (TxDA0)
163 1 /// - P3.11 is used for ASC0 Receive data Input (RxDA0)
164 1
165 1 ALTSEL0P3 |= 0x0400; // select alternate output function
166 1 P3 = (P3 & ~(uword)0x0400) | 0x0400; //set data register
167 1 DP3 = (DP3 & ~(uword)0x0400) | 0x0400; //set direction register
168 1
169 1 /// -----------------------------------------------------------------------
170 1 /// Configuration of the used ASC0 Interrupts:
171 1 /// -----------------------------------------------------------------------
172 1 /// Rx service request node configuration:
173 1 /// - Rx interrupt priority level (ILVL) = 8
174 1 /// - Rx interrupt group level (GLVL) = 1
175 1 /// - Rx group priority extension (GPX) = 0
176 1
177 1 ASC0_RIC = 0x0061;
178 1
179 1
C166 COMPILER V6.02, ASC0 08/28/2006 10:05:55 PAGE 4
180 1 // USER CODE BEGIN (ASC0_Function,3)
181 1 ASC0_TIC_IR = 1;
182 1 // USER CODE END
183 1
184 1 ASC0_CON |= 0x8000; // enable baud rate generator
185 1
186 1
187 1 } // End of function ASC0_vInit
188
189
190 //****************************************************************************
191 // @Function uword ASC0_uwGetData(void)
192 //
193 //----------------------------------------------------------------------------
194 // @Description This function reads out the content of the receive buffer
195 // register which contains the received data.
196 //
197 //----------------------------------------------------------------------------
198 // @Returnvalue data that has been received
199 //
200 //----------------------------------------------------------------------------
201 // @Parameters None
202 //
203 //----------------------------------------------------------------------------
204 // @Date 12/17/2004
205 //
206 //****************************************************************************
207
208 // USER CODE BEGIN (GetData,1)
209
210 // USER CODE END
211
212 uword ASC0_uwGetData(void)
213 {
214 1 return(ASC0_RBUF); // return receive buffer register
215 1
216 1 } // End of function ASC0_uwGetData
217
218
219 //****************************************************************************
220 // @Function void ASC0_viRx(void)
221 //
222 //----------------------------------------------------------------------------
223 // @Description This is the receive interrupt service routine for the ASC0.
224 // It is called if the data has been received.
225 // Please note that you have to add application specific code
226 // to this function.
227 //
228 //----------------------------------------------------------------------------
229 // @Returnvalue None
230 //
231 //----------------------------------------------------------------------------
232 // @Parameters None
233 //
234 //----------------------------------------------------------------------------
235 // @Date 12/17/2004
236 //
237 //****************************************************************************
238
239 // USER CODE BEGIN (Rx,1)
240
241 // USER CODE END
C166 COMPILER V6.02, ASC0 08/28/2006 10:05:55 PAGE 5
242
243 void ASC0_viRx(void) interrupt ASC0_RINT
244 {
245 1
246 1 // USER CODE BEGIN (Rx,2)
247 1
248 1 KeyBuf[WriteIndex++] = (unsigned char)ASC0_uwGetData();
249 1 if (WriteIndex == 12)
250 1 WriteIndex = 0;
251 1 // USER CODE END
252 1
253 1 } // End of function ASC0_viRx
254
255
256
257
258 // USER CODE BEGIN (ASC0_General,10)
259
260 // USER CODE END
261
MODULE INFORMATION: INITIALIZED UNINITIALIZED
CODE SIZE = 120 --------
NEAR-CONST SIZE = -------- --------
FAR-CONST SIZE = -------- --------
HUGE-CONST SIZE = -------- --------
XHUGE-CONST SIZE = -------- --------
NEAR-DATA SIZE = -------- --------
FAR-DATA SIZE = -------- --------
XHUGE-DATA SIZE = -------- --------
IDATA-DATA SIZE = -------- --------
SDATA-DATA SIZE = -------- --------
BDATA-DATA SIZE = -------- --------
HUGE-DATA SIZE = -------- --------
BIT SIZE = -------- --------
INIT'L SIZE = -------- --------
END OF MODULE INFORMATION.
C166 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -