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

📄 mod6_cnt.lst

📁 TI的digital motor control lib的源代码。了解TI的编程规范
💻 LST
字号:
C:\TIC2XX\C2000\CGTOOLS\BIN\DSPA.EXE -q -v2xx -gs mod6_cnt.asm -o ..\obj\mod6_cnt.obj -l ..\temp\mod6_cnt.lst 

TMS320C1x/C2x/C2xx/C5x COFF Assembler Version 7.00  Tue May  6 12:41:18 2003
Copyright (c) 1987-1999  Texas Instruments Incorporated 
mod6_cnt.asm                                                         PAGE    1

       1            ;=====================================================================================
       2            ; File name:        MOD6_CNT.asm                     
       3            ;                    
       4            ; Originator:   Digital Control Systems Group
       5            ;                       Texas Instruments
       6            ;
       7            ; Description:                                 
       8            ; This file contains source for the Modulo 6 counter  routine.
       9            ;=====================================================================================
      10            ; History:
      11            ;-------------------------------------------------------------------------------------
      12            ; 9-15-2000     Release Rev 1.0
      13            ;================================================================================
      14            ; Applicability: F240,F241,C242,F243,F24xx.  (Peripheral Independant).
      15            ;
      16            ;
      17            ;================================================================================
      18            ; Routine Name: MOD6_CNT           Routine Type: C Callable
      19            ;
      20            ; Description:
      21            ;  
      22            ; C prototype : void  mod6cnt_calc(MOD6CNT *p)
      23            ;================================================================================
      24            ; History     Created  July 26,2000
      25            ;
      26            ; Definition of MOD6CNT:
      27            ;
      28            ; typedef struct MOD6CNT{                          
      29            ;                      int trig_in;     
      30            ;                      int cntr;        
      31            ;                      (int (*) (int))mod6cnt_calc
      32            ;                      };
      33            ;================================================================================
      34            
      35      0001  ON         .set 1
      36      0000  OFF        .set 0  
      37            ;--------------------------------------------------------------------------
      38      0001  RETURN_ADDRESS_SAVE .set ON     ; If this function calls no other functions 
      39                                            ; set RETURN_ADDRESS_SAVE to OFF for
      40                                            ; optimization                                
      41            ;--------------------------------------------------------------------------
      42      0005  MAX_STATES .set 5
      43      0000  CLEAR      .set 0 
      44            ;--------------------------------------------------------------------------
      45                        .def _mod6cnt_calc
      46            ;================================================================================
      47 0000       _mod6cnt_calc:   
      48            
      49      0001  __mod6cnt_calc_framesize .set 0001h
      50            ;--------------------------------------------------------------------------
      51                .if ( RETURN_ADDRESS_SAVE = ON)  
      52                                            ; AR1 is the  stack pointer (SP)
      53                                            ; AR0 is the  frame pointer (FP)
      54                                            
TMS320C1x/C2x/C2xx/C5x COFF Assembler Version 7.00  Tue May  6 12:41:18 2003
Copyright (c) 1987-1999  Texas Instruments Incorporated 
mod6_cnt.asm                                                         PAGE    2

      55 0000 8aa0      POPD *+                     ; Save the return address from hardware
      56                                            ; stack onto the software stack. ARP = AR1
      57                
      58                .endif
      59            
      60 0001 80a0      SAR  AR0, *+                ; push AR0 (FP). ARP = AR1
      61 0002 8180      SAR  AR1, *                 ; *SP = SP. ARP = AR1
      62 0003 b001      LAR  AR0, #__mod6cnt_calc_framesize 
      63                                            ; FP = size of frame. ARP = AR1
      64                
      65 0004 00ea      LAR  AR0, *0+, AR2          ; Allocate frame. AR0 = *AR1
      66                                            ; AR1 = AR1 + AR0. ARP = AR2
      67            ;================================================================================
      68                            .if (RETURN_ADDRESS_SAVE = ON) 
      69 0005 bf0a                  LAR AR2,  #-3 
         0006 fffd  
      70                            .endif                     
      71                            
      72                            .if (RETURN_ADDRESS_SAVE = OFF) 
      73                            LAR AR2,  #-2 
      74                            .endif          
      75            ;--------------------------------------------------------------------------
      76 0007 8be0                  MAR *0+         ; AR2 = AR2 + AR0
      77                                            ; AR2 -> passed parameter
      78                                            ; (i.e. pointer to the structure).
      79                                            ; ARP = AR2.
      80            ;--------------------------------------------------------------------------
      81 0008 028a                  LAR     AR2, *,AR2 
      82                                            ; AR2 points to the first member of the
      83                                            ; structure (i.e. AR2 -> trig_in) 
      84                                            ; ARP = AR2.  
      85            ;--------------------------------------------------------------------------
      86 0009 10a0                  LACC    *+      ; Load Accumulator with trig_in 
      87                                            ; and increment AR2
      88                                            ; ARP = AR2. AR2-> cntr. 
      89            ;--------------------------------------------------------------------------
      90 000a e388                  BCND    __mod6cnt_calc_exit , EQ 
         000b 0017' 
      91                                            ; If trig_in is equal to zero goto
      92                                            ; __mod6cnt_calc_exit
      93                                            ; ARP = AR2. AR2-> cntr 
      94            ;--------------------------------------------------------------------------
      95 000c 1080                  LACC    *       ; Load Accumulator with counter 
      96                                            ; ARP = AR2.  AR2-> cntr 
      97            ;--------------------------------------------------------------------------                                     
      98 000d ba05                  SUB     #MAX_STATES
      99                                            ; To check if counter is 5
     100                                            ; ARP = AR2.  AR2-> cntr 
     101            ;--------------------------------------------------------------------------                                     
     102 000e e344                  BCND    __MOD6CNT_Inc_Cntr, LT 
         000f 0014' 
     103                                            ; If counter is less than 5 goto
     104                                            ; __MOD6CNT_Inc_Cntr
     105                                            ; ARP = AR2.  AR2-> cntr 
TMS320C1x/C2x/C2xx/C5x COFF Assembler Version 7.00  Tue May  6 12:41:18 2003
Copyright (c) 1987-1999  Texas Instruments Incorporated 
mod6_cnt.asm                                                         PAGE    3

     106            ;--------------------------------------------------------------------------                                     
     107 0010       __MOD6CNT_Clear_Cntr:
     108                                                 
     109 0010 ae80                  SPLK    #CLEAR, *
         0011 0000  
     110                                            ; If yes, load 0 to clear the counter 
     111                                            ; i.e Reset state pointer to 0
     112                                            ; ARP = AR2.  AR2-> cntr  
     113            ;--------------------------------------------------------------------------                                     
     114 0012 7980                  B       __mod6cnt_calc_exit 
         0013 0017' 
     115                                            ; If counter is equal to zero goto
     116                                            ; __mod6cnt_calc_exit 
     117                                            ; ARP = AR2.  AR2-> cntr 
     118            ;--------------------------------------------------------------------------                                     
     119 0014       __MOD6CNT_Inc_Cntr:
     120            
     121 0014 1080                  LACC    *       ; Get the counter
     122                                            ; ARP = AR2.  AR2-> cntr 
     123            ;--------------------------------------------------------------------------                                     
     124 0015 b801                  ADD     #1      ; To increment the counter
     125                                            ; ARP = AR2.  AR2-> cntr 
     126            ;--------------------------------------------------------------------------                                     
     127 0016 9080                  SACL    *       ; Update counter 
     128                                            ; i.e Increment commutation_ptr
     129                                            ; ARP = AR2. AR2-> cntr 
     130            ;================================================================================
     131                ; Retrieve FP and SP of parent function
     132                
     133 0017       __mod6cnt_calc_exit:  
     134 0017 8b89      MAR     *, AR1              ; set ARP = SP before you exit.
     135 0018 7c02      SBRK    #(__mod6cnt_calc_framesize+1) 
     136                                            ; Deallocate frame, point to saved FP
     137                    
     138                .if (RETURN_ADDRESS_SAVE = ON)
     139 0019 0090      LAR     AR0, *-             ; Restore frame pointer
     140 001a 7680      PSHD    *                   ; Push return address on hardware stack
     141                .endif
     142                    
     143                .if (RETURN_ADDRESS_SAVE = OFF)
     144                LAR     AR0, *              ; Restore frame pointer
     145                .endif
     146                
     147 001b ef00      RET
     148               
     149                .end

 No Errors,  No Warnings

⌨️ 快捷键说明

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