📄 main.lst
字号:
168 1 /// ---------------------------------------------------------------------
169 1
170 1 //// this register must be set in the start-up file
171 1 //// SYSCON0 = 0x0000
172 1
173 1 /// ---------------------------------------------------------------------
174 1 /// Initialization of the SYSCON1 Register:
175 1 /// ---------------------------------------------------------------------
176 1 /// clock prescaler for system is fpll / 1
177 1
178 1 //// this register must be set in the start-up file
179 1 //// SYSCON1 = 0x0000
C166 COMPILER V6.08, MAIN 09/12/2008 14:54:07 PAGE 4
180 1
181 1 /// ---------------------------------------------------------------------
182 1 /// Initialization of the SYSCON3 Register:
183 1 /// ---------------------------------------------------------------------
184 1
185 1 //// this register must be set in the start-up file
186 1 //// SYSCON3 = 0x0000
187 1
188 1 /// ---------------------------------------------------------------------
189 1 /// Initialization of EBC
190 1 /// ---------------------------------------------------------------------
191 1
192 1 //// this register must be set in the start-up file
193 1 //// EBCMOD1 = 0x004F
194 1
195 1 /// EBC is disabled
196 1 //// -----------------------------------------------------------------------
197 1 //// End of Important Settings for the Start-Up File
198 1 //// -----------------------------------------------------------------------
199 1
200 1
201 1 // -----------------------------------------------------------------------
202 1 // Initialization of the Peripherals:
203 1 // -----------------------------------------------------------------------
204 1
205 1 // initializes the Parallel Ports
206 1 IO_vInit();
207 1
208 1 // initializes the General Purpose Timer Unit (GPT1)
209 1 GPT1_vInit();
210 1
211 1 // USER CODE BEGIN (Init,3)
212 1
213 1 // USER CODE END
214 1
215 1 // globally enable interrupts
216 1 PSW_IEN = 1;
217 1
218 1 } // End of function MAIN_vInit
219
220
221 //****************************************************************************
222 // @Function void MAIN_vUnlockProtecReg(void)
223 //
224 //----------------------------------------------------------------------------
225 // @Description This function makes it possible to write one protected
226 // register. After calling of this function and write on the
227 // protected register is the security level set to low
228 // protected mode.
229 //
230 //----------------------------------------------------------------------------
231 // @Returnvalue None
232 //
233 //----------------------------------------------------------------------------
234 // @Parameters None
235 //
236 //----------------------------------------------------------------------------
237 // @Date 2006-07-21
238 //
239 //****************************************************************************
240
241 // USER CODE BEGIN (UnlockProtecReg,1)
C166 COMPILER V6.08, MAIN 09/12/2008 14:54:07 PAGE 5
242
243 // USER CODE END
244
245 void MAIN_vUnlockProtecReg(void)
246 {
247 1 uword ubPASSWORD;
248 1
249 1 if((SCUSLS & 0x1800) == 0x0800) // if low protected mode
250 1 {
251 2
252 2 ubPASSWORD = SCUSLS & 0x00FF;
253 2 ubPASSWORD = ~ubPASSWORD;
254 2 SCUSLC = 0x8E00 | ubPASSWORD; // command 4
255 2
256 2 } // end if low protected mode
257 1
258 1 if((SCUSLS & 0x1800) == 0x1800) // if write protected mode
259 1 {
260 2 SCUSLC = 0xAAAA; // command 0
261 2 SCUSLC = 0x5554; // command 1
262 2
263 2 ubPASSWORD = SCUSLS & 0x00FF;
264 2 ubPASSWORD = ~ubPASSWORD;
265 2
266 2 SCUSLC = 0x9600 | ubPASSWORD; // command 2
267 2 SCUSLC = 0x0800; // command 3; new PASSWOR is 0x00
268 2
269 2 ubPASSWORD = SCUSLS & 0x00FF;
270 2 ubPASSWORD = ~ubPASSWORD;
271 2 SCUSLC = 0x8E00 | ubPASSWORD; // command 4
272 2
273 2 } // end if write protected mode
274 1
275 1 } // End of function MAIN_vUnlockProtecReg
276
277
278 //****************************************************************************
279 // @Function void main(void)
280 //
281 //----------------------------------------------------------------------------
282 // @Description This is the main function.
283 //
284 //----------------------------------------------------------------------------
285 // @Returnvalue None
286 //
287 //----------------------------------------------------------------------------
288 // @Parameters None
289 //
290 //----------------------------------------------------------------------------
291 // @Date 2006-07-21
292 //
293 //****************************************************************************
294
295 // USER CODE BEGIN (Main,1)
296
297 // USER CODE END
298
299 void main(void)
300 {
301 1 // USER CODE BEGIN (Main,2)
302 1
303 1 // USER CODE END
C166 COMPILER V6.08, MAIN 09/12/2008 14:54:07 PAGE 6
304 1
305 1 MAIN_vInit();
306 1
307 1 // USER CODE BEGIN (Main,4)
308 1 while(1);
309 1 // USER CODE END
310 1
311 1 } // End of function main
312
313
314
315 // USER CODE BEGIN (MAIN_General,10)
316
317 // USER CODE END
318
MODULE INFORMATION: INITIALIZED UNINITIALIZED
CODE SIZE = 136 --------
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 + -