⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.asm

📁 ucos-ii 的完整代码
💻 ASM
字号:

  .extern   ___SP_INIT     
  .global _asm_function
  .global _main
  .global _Init_Timer
  .global _wait
  .global _asm_startmeup
  .include "derivative.inc"  
  
	.text
	.function "_asm_startmeup",_asm_startmeup,_asm_startmeup_end-_asm_startmeup

 _asm_startmeup:
  /* disable interrupts */
  move.w        #0x2700,SR  

  /* setup the stack pointer */
  lea           ___SP_INIT,A7

  /* setup A6 dummy stackframe */
  movea.l       #0,A6
  link          A6,#0
  
_main:
       bsr.l    _Init_Timer
       
       clr.l    D4             /* Initialize timeouts (0=off) */
       clr.l    D5
       clr.l    D6
           
       move.b   #$03,D0
       move.b   D0,SOPT1
       
       move.b   #$F,D4         /* Schedule a timeout1 event ~ 160ms @ 4MHz Bus Frequency */
       move.b   #$FF,D0
       move.b   D0,PTBDD       /* Set DEMOQE led ports as outputs */
       move.b   #$3F,D0
       move.b   D0,PTCDD
       move.b   #$C0,D0
       move.b   D0,PTEDD
       
       move.b   #$20,D0
       move.b   D0,PTBD
       move.b   #$3F,D0
       move.b   D0,PTCD
       move.b   #$C0,D0
       move.b   D0,PTED
 
  /* enable interrupts */
       move     SR,D0
       andi.l   #0xF8FF,D0
       move     D0,SR     
       
_wait:   

  bra _wait    

/*************************************************************
* Init_Timer - Turns on timer 1 channel 0 for an Output      *
*              Compare in approximately 10ms. The timer      *
*              interrupt service routine continually sets    *
*              the next interrupt to occur 10ms later.       *
**************************************************************/

_Init_Timer:
       move.b   #$06,D0
       move.b   D0,TPM1SC      /* Timer 1 - Cleared + Stopped.
                                  Clicks once every 64 BUS Cycles
			                            Bus Clock Selected */

       move.b   #$54,D0
       move.b   D0,TPM1C0SC    /* Timer 1 Channel 0
                                  Set for Output Compare operation. */


       move.b   #$02,D0
       move.b   D0,TPM1C0VH    /* Set Output Compare to happen 622T clicks ($26e) */
       move.b   #$6e,D0
       move.b   D0,TPM1C0VL    /* after we start the timer. (~10ms). The
                                  timer interrupt will set OC for another ~10ms. */

       move.b   #$0E,D0
       move.b   D0,TPM1SC      /* Start the timer */
       rts

_asm_startmeup_end:        

    .end
    
/* This source is (C)opyright 2003, P&E Microcomputer Systems, Inc.
   Visit us at http://www.pemicro.com */	    

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -