📄 main.lst
字号:
228 1 //// this register must be set in the start-up file
229 1 //// VECSEG = 0x0000
230 1
231 1 /// ---------------------------------------------------------------------
232 1 /// Initialization of the SYSCON0 Register:
233 1 /// ---------------------------------------------------------------------
234 1
235 1 //// this register must be set in the start-up file
236 1 //// SYSCON0 = 0x0000
237 1
238 1 /// ---------------------------------------------------------------------
239 1 /// Initialization of the SYSCON1 Register:
240 1 /// ---------------------------------------------------------------------
241 1 /// clock prescaler for system is fpll / 1
C166 COMPILER V6.04, MAIN 08/30/2007 18:29:21 PAGE 5
242 1
243 1 //// this register must be set in the start-up file
244 1 //// SYSCON1 = 0x0000
245 1
246 1 /// ---------------------------------------------------------------------
247 1 /// Initialization of the SYSCON3 Register:
248 1 /// ---------------------------------------------------------------------
249 1
250 1 //// this register must be set in the start-up file
251 1 //// SYSCON3 = 0x0000
252 1
253 1 /// ---------------------------------------------------------------------
254 1 /// Initialization of EBC
255 1 /// ---------------------------------------------------------------------
256 1
257 1 //// this register must be set in the start-up file
258 1 //// EBCMOD1 = 0x003F
259 1
260 1 /// EBC is enabled
261 1 /// pin #BHE is enabled
262 1 /// #WR and #BHE retain their normal function
263 1 /// pin ALE is enabled
264 1 /// as segment address are 2 pins enabled ( A[17] .. A[16] )
265 1 /// #CS2 .. #CS0 are enabled
266 1 /// pin #READY is disabled
267 1 /// bus arbitration is disabled, P6.7 .. P6.5 may used for general
268 1 /// purpose IO
269 1
270 1 //// this register must be set in the start-up file
271 1 //// EBCMOD0 = 0x4032
272 1
273 1 /// ---------------------------------------------------------------------
274 1 /// ---------- chip select 0 is enabled ----------
275 1 /// ---------------------------------------------------------------------
276 1 /// - 16-bit Multiplexed Bus
277 1 /// access time is controlled by bitfield PHE0
278 1
279 1 //// this register must be set in the start-up file
280 1 //// FCONCS0 = 0x0031
281 1
282 1 /// Phase A: 3 clock cycles
283 1 /// Phase B: 1 clock cycles
284 1 /// Phase C: 0 clock cycles
285 1 /// Phase D: 0 clock cycles
286 1 /// Phase E: 10 clock cycles
287 1 /// Read Phase F: 0 clock cycles
288 1 /// Write Phase F: 3 clock cycles
289 1
290 1 //// this register must be set in the start-up file
291 1 //// TCONCS0 = 0x6243
292 1
293 1 /// ---------------------------------------------------------------------
294 1 /// ---------- chip select 1 is disabled ----------
295 1 /// ---------------------------------------------------------------------
296 1
297 1
298 1 /// ---------------------------------------------------------------------
299 1 /// ---------- chip select 2 is disabled ----------
300 1 /// ---------------------------------------------------------------------
301 1
302 1
303 1 /// ---------------------------------------------------------------------
C166 COMPILER V6.04, MAIN 08/30/2007 18:29:21 PAGE 6
304 1 /// ---------- chip select 3 is disabled ----------
305 1 /// ---------------------------------------------------------------------
306 1
307 1
308 1 //// -----------------------------------------------------------------------
309 1 //// End of Important Settings for the Start-Up File
310 1 //// -----------------------------------------------------------------------
311 1
312 1
313 1 // -----------------------------------------------------------------------
314 1 // Initialization of the Peripherals:
315 1 // -----------------------------------------------------------------------
316 1
317 1 // initializes the Parallel Ports
318 1 IO_vInit();
319 1
320 1 // USER CODE BEGIN (Init,3)
321 1
322 1 // USER CODE END
323 1
324 1 // globally enable interrupts
325 1 PSW_IEN = 1;
326 1
327 1 } // End of function MAIN_vInit
328
329
330 //****************************************************************************
331 // @Function void MAIN_vUnlockProtecReg(void)
332 //
333 //----------------------------------------------------------------------------
334 // @Description This function makes it possible to write one protected
335 // register. After calling of this function and write on the
336 // protected register is the security level set to low
337 // protected mode.
338 //
339 //----------------------------------------------------------------------------
340 // @Returnvalue None
341 //
342 //----------------------------------------------------------------------------
343 // @Parameters None
344 //
345 //----------------------------------------------------------------------------
346 // @Date 2007-7-13
347 //
348 //****************************************************************************
349
350 // USER CODE BEGIN (UnlockProtecReg,1)
351
352 // USER CODE END
353
354 void MAIN_vUnlockProtecReg(void)
355 {
356 1 uword ubPASSWORD;
357 1
358 1 if((SCUSLS & 0x1800) == 0x0800) // if low protected mode
359 1 {
360 2
361 2 ubPASSWORD = SCUSLS & 0x00FF;
362 2 ubPASSWORD = ~ubPASSWORD;
363 2 SCUSLC = 0x8E00 | ubPASSWORD; // command 4
364 2
365 2 } // end if low protected mode
C166 COMPILER V6.04, MAIN 08/30/2007 18:29:21 PAGE 7
366 1
367 1 if((SCUSLS & 0x1800) == 0x1800) // if write protected mode
368 1 {
369 2 SCUSLC = 0xAAAA; // command 0
370 2 SCUSLC = 0x5554; // command 1
371 2
372 2 ubPASSWORD = SCUSLS & 0x00FF;
373 2 ubPASSWORD = ~ubPASSWORD;
374 2
375 2 SCUSLC = 0x9600 | ubPASSWORD; // command 2
376 2 SCUSLC = 0x0800; // command 3; new PASSWOR is 0x00
377 2
378 2 ubPASSWORD = SCUSLS & 0x00FF;
379 2 ubPASSWORD = ~ubPASSWORD;
380 2 SCUSLC = 0x8E00 | ubPASSWORD; // command 4
381 2
382 2 } // end if write protected mode
383 1
384 1 } // End of function MAIN_vUnlockProtecReg
385
386
387 //****************************************************************************
388 // @Function void main(void)
389 //
390 //----------------------------------------------------------------------------
391 // @Description This is the main function.
392 //
393 //----------------------------------------------------------------------------
394 // @Returnvalue None
395 //
396 //----------------------------------------------------------------------------
397 // @Parameters None
398 //
399 //----------------------------------------------------------------------------
400 // @Date 2007-7-13
401 //
402 //****************************************************************************
403
404 // USER CODE BEGIN (Main,1)
405
406 // USER CODE END
407
408 void main(void)
409 {
410 1 // USER CODE BEGIN (Main,2)
411 1
412 1 // USER CODE END
413 1
414 1 MAIN_vInit();
415 1
416 1 // USER CODE BEGIN (Main,4)
417 1 while(1)
418 1 {
419 2 RightMovLed(); // LED点亮后单个右移
420 2 delay(100);
421 2 LeftMovLed(); // LED点亮后单个左移
422 2 delay(100);
423 2 LedFlash(); // 实现两个LED从中间跑两边
424 2 delay(100);
425 2 crossFlash(); // 交叉闪烁
426 2 delay(100);
427 2 }
C166 COMPILER V6.04, MAIN 08/30/2007 18:29:21 PAGE 8
428 1
429 1 // USER CODE END
430 1
431 1 } // End of function main
432
433
434
435 // USER CODE BEGIN (MAIN_General,10)
436
437 // USER CODE END
438
MODULE INFORMATION: INITIALIZED UNINITIALIZED
CODE SIZE = 310 --------
NEAR-CONST SIZE = -------- --------
FAR-CONST SIZE = -------- --------
HUGE-CONST SIZE = -------- --------
XHUGE-CONST SIZE = -------- --------
NEAR-DATA SIZE = 5 --------
FAR-DATA SIZE = -------- --------
XHUGE-DATA SIZE = -------- --------
IDATA-DATA SIZE = -------- --------
SDATA-DATA SIZE = -------- --------
BDATA-DATA SIZE = -------- --------
HUGE-DATA SIZE = -------- --------
BIT SIZE = -------- --------
INIT'L SIZE = 10 --------
END OF MODULE INFORMATION.
C166 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -