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

📄 q1inv1.asm

📁 在采样的基础上实现数码管显示和利用TI公司的FFT算法进行运算
💻 ASM
字号:
;===========================================================
;
; File Name     :q1inv1.asm
; 
; Originator    :Digital Control Systems Group 
;                Texas Instruments 
; 
; Description   :This file contain source code to find the reciprocal of 
;                fixed point number, The output is a 32 bit number                          
;
;                        |-----------|
;                        |           |
;        inv1_input ---->|  QINV1    |-------> inv1_output
;                        |           |
;                        |-----------|
;
; Date          : 26/12/2000
;==========================================================
; Routine Name  : Generic Function      
; Routine Type  : ASM only;         
;
; Input format:  Signed number in Q(x) format (x<16)
; Output format: Signed number in Q(31-x) format (32 bit result)
; 
; Example 1: 
; Input format:  Signed Q15 format  (Fractional Number)
; Output format: Signed Q16  format 
;
; Example 2:
; Input format:  Signed Q0 format   (Integer Number)
; Output format: Signed Q31
;                                     
; Example 3: 
; Input format:  Signed Q13 format
; Output format: Signed Q18 format
;========================================================================
; Module Usage:   Copy this section to main system file
;           .ref    qinv1
;           .ref    inv1_input,inv1_output
;========================================================================


; Module definition for external referance
            .def    _qinv1

; Input/output Symbol Delaration for external referance 
            .def    inv1_input, inv1_output
            
; I/O and Local symbol definition
inv1_input  .usect "qmath",1
inv1_output .usect "qmath",2,1
temp        .usect "qmath",2    

; INV1 module definition                    
                                        
_qinv1:
            SETC    OVM             ; To saturate ABS value of 0x8000 to 0x7fff                        
            SETC    SXM             
            SPM     #0
            LAR     AR2,#inv1_input ; AR2->inv1_input   
            LAR     AR3,#(temp+1)   ; AR3->temp[1]     
            LAR     AR0,#temp       ; AR0->temp[0]
            MAR     *,AR2

;==========================================================================================
; From here---The code is same as CcA
;=========================================================================================
            
            LACC    *,16,AR3        ; Load the input to the ACCH
            
            BCND    calculate,NEQ   ; If input is zero, return with ZERO
            LACC    #0000h
            B       return   
            
calculate:  BCND    positive, GT
            ABS                     ; Obtain the absolute value of x<0

positive:   SACH    *               ; Store |x| in 16.0
            LACC    #01h,15         ; #1 in Q15 format

            RPT     #15
            SUBC    *               ; Obtain first 16 bit of Q
            
            MAR     *,AR0
            SACL    *,0,AR3         ; Store the Quotient
            AND     #0ffffh,16      ; Mask the quotient 
            
            RPT     #15             ; Generate another 16 quotient bits
            SUBC    *               ; by dividing the remainder from the
                                    ; first stage.   
            
            AND     #0ffffh         ; Mask the remainder
            MAR     *,AR0
            ADD     *,16,AR2        ; Combine the Quotient bits
            ABS                     ; To convert 8000 0000 to 7fff ffff 
                
isnot1:     BIT     *,0
            BCND    return,NTC
            NEG
            
return:     CLRC    OVM                                    
;==========================================================
; upto this point ---the code is same as CcA
;==========================================================
            MAR     *,AR2
            LAR     AR2,#inv1_output
            SACL    *+
            SACH    *
            RET
              
                                    
            
            
                
            
            
            
            
                  

⌨️ 快捷键说明

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