delayus.asm

来自「ti tms281x BIOS/RTOS 实例代码」· 汇编 代码 · 共 47 行

ASM
47
字号
***********************************************************************
* File: DelayUs.asm
* Devices: TMS320F2812, TMS320F2811, TMS320F2810
* Author: David M. Alter, Texas Instruments Inc.
* History:
*   09/08/03 - original (D. Alter)
***********************************************************************


**********************************************************************
* Function: DelayUs()                                                *
* Description: Implements a time delay.                              *
* DSP: TMS320F2812, TMS320F2811, TMS320F2810                         *
* Last Modified: 08/12/03                                            *
* Include files: none                                                *
* Function Prototype: void DelayUs(unsigned int)                     *
* Useage: DelayUs(Usec);                                             *
* Input Parameters: unsigned int Usec = time delay in microseconds   *
* Return Value: none                                                 *
* Notes: The execution time of this routine is based upon a 150 MHz  *
*        CPUCLK.  It is assumes that the function executes out of    *
*        internal RAM.  If executing out of internal flash, the      *
*        execution speed will be slightly slower.  However, the      *
*        inner loop of this function is essentially invariant to the *
*        memory it is running in.  Therefore, even when running in   *
*        flash memory, the basic loop time will be only slightly     *
*        longer than 1 us.                                           *   
**********************************************************************
       .def _DelayUs
       .text

_DelayUs:

        RPT #143                      ;inner loop
     || NOP

        SUBB ACC,#1                   ;decrement outer loop counter
        BF _DelayUs, GT               ;branch for outer loop

        LRETR                         ;return

; end of function DelayUs() ******************************************


;end of file DelayUs.asm
       .end

⌨️ 快捷键说明

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