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

📄 delayus.asm

📁 SVPWM算法的DSP源码已通过硬件验证
💻 ASM
字号:

**********************************************************************
* File: DelayUs.asm                                                  *
* Devices: TMS320F2808, TMS320F2806, TMS320F2801                     *
* Author: David M. Alter, Texas Instruments Inc.                     *
* History:                                                           *
*   11/13/05 - added save/restore of ST1 to preserve EALLOW setting  *
*              (D. Alter)                                            *
*   05/02/05 - added watchdog servicing in outer loop (D. Alter)     *
*   02/11/05 - original (D. Alter)                                   *
**********************************************************************

WDKEY	.set	0x7025

**********************************************************************
* Function: DelayUs()                                                *
* Description: Implements a time delay.                              *
* DSP: TMS320F2808, TMS320F2806, TMS320F2801                         *
* Last Modified: 05/02/05                                            *
* 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:                                                             *
*   1) The execution time of this routine is based upon a 100 MHz    *
*      CPUCLK.  It also 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.                                                         *
*                                                                    *
*   2) The outer loop of this function is interruptible (i.e., every *
*      1 us).  The user should disable interrupts before calling the *
*      function if they need an exact delay time, as opposed to a    *
*      minimum delay time.                                           *
*                                                                    *
**********************************************************************
       .def _DelayUs
       .text

_DelayUs:
        MOVB AH, #0                   ;Zero AH
        PUSH ST1                      ;Save ST1 to preserve EALLOW setting

DelayUs1:                             ;Outer loop

;Service the watchdog in case it is active
        EALLOW
        MOVZ DP, #(WDKEY>>6)
        MOV @WDKEY, #0x0055
        MOV @WDKEY, #0x00AA
        EDIS

;Proceed with the inner loop
        RPT #88                       ;Inner loop
     || NOP

        SUBB ACC,#1                   ;Decrement outer loop counter
        BF DelayUs1, GT               ;Branch for outer loop

;Finish up
        POP ST1                       ;Restore ST1
        LRETR                         ;Return

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


;end of file DelayUs.asm
       .end

⌨️ 快捷键说明

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