?? f2407qep2.lst
字號:
C:\TIC2XX\C2000\CGTOOLS\BIN\DSPA.EXE -q -v2xx -gs f2407qep2.asm -o ..\obj\f2407qep2.obj -l ..\temp\f2407qep2.lst
TMS320C1x/C2x/C2xx/C5x COFF Assembler Version 7.00 Tue May 6 12:42:10 2003
Copyright (c) 1987-1999 Texas Instruments Incorporated
f2407qep2.asm PAGE 1
1 ;===============================================================================================================
2 ; File name: F2407QEP2.ASM
3 ;
4 ; Originator: Digital Control Systems Group
5 ; Texas Instruments
6 ; Description:
7 ; This file contains source for the QEP theta calculation function.
8 ;=====================================================================================
9 ; History:
10 ;-------------------------------------------------------------------------------------
11 ; 09-15-2000 Release Rev 1.0
12 ; 04-04-2001 Release Rev 1.1
13 ; 02-15-2002 Release Rev 1.2 ; change left shift from 14 to 2 for dir_QEP
14 ;================================================================================
15 ; Applicability: F240x. (Peripheral dependant).
16 ;
17 ;================================================================================
18 ; Routine Name: F2407_qep_theta_calc Routine Type: C Callable
19 ;
20 ; Description:
21 ;
22 ; C prototype : int F2407_qep_theta_calc(struct QEP *p)
23 ;================================================================================
24
25 ; Definition of the QEP structure is as follows:
26 ;
27 ;typedef struct {int dir_QEP; /* Output: Motor rotation direction (Q0) */
28 ; int cal_angle; /* Parameter: Encoder offset calibration (Q0) */
29 ; int theta_raw; /* Variable: Raw angle of timer value (Q0) */
30 ; int mech_scale; /* Parameter: Scaling factor for raw angle Q0->Q15 */
31 ; int theta_mech; /* Output: Motor Mechanical Angle (Q15) */
32 ; int polepairs; /* Parameter: No. of poles/2 of the motor (Q0) */
33 ; int theta_elec; /* Output: Motor Electrical Angle (Q15) */
34 ; int QEP_cnt_idx; /* Variable: Pulses count on encoder at index (Q0) */
35 ; int index_sync_flg; /* Output: Index sync status (Q0) */
36 ; int (*calc)(); /* Pointer to the calc funtion */
37 ; int (*init)(); /* Pointer to the init funcion */
38 ; int (*indexevent)(); /* Pointer to index event handler */
39 ; } QEP ;
40 ;
41 ;================================================================================
42 .include ..\include\x240x.h
43 ;================================================================================
44 .def _F2407_EV1_qep_theta_calc
45 ;================================================================================
46 0001 __F2407_EV1_qep_theta_calc_framesize .set 0001h
47 ;================================================================================
48 0000 _F2407_EV1_qep_theta_calc:
49
50 0000 8aa0 POPD *+ ; Keep return add
51 0001 80a0 SAR AR0,*+ ; Keep old frame pointer
52 0002 8180 SAR AR1,* ; Keep old stack pointer
53 0003 b001 LARK AR0,__F2407_EV1_qep_theta_calc_framesize ; Load AR0 with frame size
54 0004 00e8 LAR AR0,*0+,AR0 ; AR0->FP0 (new FP), ARP=
TMS320C1x/C2x/C2xx/C5x COFF Assembler Version 7.00 Tue May 6 12:42:10 2003
Copyright (c) 1987-1999 Texas Instruments Incorporated
f2407qep2.asm PAGE 2
55
56 ;================================================================================
57 0005 7c03 SBRK #3 ; ARP=AR0, AR0->FR0-3 (1st argument)
58 ;--------------------------------------------------------------------------------
59 0006 0280 LAR AR2,* ; ARP=AR0, AR0->dir_QEP, AR2->dir_QEP
60 ;--------------------------------------------------------------------------------
61 0007 7803 ADRK #3 ; Move AR0 back to FR0
62 ; ARP=AR0, AR0->FR0, AR2->dir_QEP
63 ;--------------------------------------------------------------------------------
64 0008 be47 SETC SXM ; Turn sign extension mode on
65 ; ARP=AR0, AR0->FR0, AR2->dir_QEP
66 ;--------------------------------------------------------------------------------
67 0009 8b8b MAR *,AR3 ; ARP=AR0, AR0->FR0, AR2->dir_QEP, ARP=AR3
68 ;--------------------------------------------------------------------------------
69 000a bf0b LAR AR3,#GPTCONA ; Point AR3 to GPTCON
000b 7400
70 ; ARP=AR3, AR0->FR0 AR2->dir_QEP, AR3->GPTCON
71 ;--------------------------------------------------------------------------------
72 000c 1280 LACC *,2 ; ACC = (GPTCON)*2^2
73 ; ARP=AR3, AR0->FR0 AR2->dir_QEP, AR3->GPTCON
74 ;--------------------------------------------------------------------------------
75 000d be81 AND #1,16 ; ACC = (GPTCON)*2^2 and 1
000e 0001
76 ; ARP=AR3, AR0->FR0 AR2->dir_QEP, AR3->GPTCON
77 ;--------------------------------------------------------------------------------
78 000f 8b8a MAR *,AR2 ; ARP=AR3, AR0->FR0, AR2->dir_QEP, AR3->GPTCON, ARP=AR2
79 ;--------------------------------------------------------------------------------
80 0010 98ab SACH *+,AR3 ; QEP_dir = ACC high
81 ; ARP=AR2, AR0->FR0, AR2->cal_angle, AR3->GPTCON, ARP=AR
82 ;--------------------------------------------------------------------------------
83 0011 bf0b LAR AR3,#T2CNT ; ARP=AR3, AR0->FR0 AR2->cal_angle, AR3->T2CNT
0012 7405
84 ;--------------------------------------------------------------------------------
85 0013 108a LACC *,AR2 ; LACC = T2CNT (Q0)
86 ; ARP=AR3, AR0->FR0 AR2->cal_angle, AR3->T2CNT, ARP=AR2
87 ;--------------------------------------------------------------------------------
88 0014 20a0 ADD *+ ; ACC = T2CNT + cal_angle (Q0)
89 ; ARP=AR2, AR0->FR0 AR2->theta_raw, AR3->T2CNT
90 ;--------------------------------------------------------------------------------
91 0015 9080 SACL * ; theta_raw = T2CNT + cal_angle (Q0)
92 ; ARP=AR2, AR0->FR0 AR2->theta_raw, AR3->T2CNT
93 ;--------------------------------------------------------------------------------
94 0016 73a0 LT *+ ; TREG = theta_raw (Q0)
95 ; ARP=AR2, AR0->FR0 AR2->mech_scale, AR3->T2CNT
96 ;--------------------------------------------------------------------------------
97 0017 54a0 MPY *+ ; PREG = theta_raw*mech_scale (Q26)
98 ; ARP=AR2, AR0->FR0 AR2->theta_mech, AR3->T2CNT
99 ;--------------------------------------------------------------------------------
100 0018 be03 PAC ; ACC = theta_raw*mech_scale (Q26)
101 ; ARP=AR2, AR0->FR0 AR2->theta_mech, AR3->T2CNT
102 ;--------------------------------------------------------------------------------
103 0019 bfbb AND #7FFFh,11 ; Modulo 360 degree in Q26
001a 7fff
104 ; ARP=AR2, AR0->FR0 AR2->theta_mech, AR3->T2CNT
TMS320C1x/C2x/C2xx/C5x COFF Assembler Version 7.00 Tue May 6 12:42:10 2003
Copyright (c) 1987-1999 Texas Instruments Incorporated
f2407qep2.asm PAGE 3
105 ;--------------------------------------------------------------------------------
106 001b 9d80 SACH *,5 ; theta_mech = theta_raw*mech_scale (Q15)
107 ; ARP=AR2, AR0->FR0 AR2->theta_mech, AR3->T2CNT
108 ;--------------------------------------------------------------------------------
109 001c 73a0 LT *+ ; TREG = theta_mech (Q15)
110 ; ARP=AR2, AR0->FR0 AR2->polepairs, AR3->T2CNT
111 ;--------------------------------------------------------------------------------
112 001d 54a0 MPY *+ ; PREG = theta_mech*polepairs (Q15)
113 ; ARP=AR2, AR0->FR0 AR2->theta_elec, AR3->T2CNT
114 ;--------------------------------------------------------------------------------
115 001e be03 PAC ; ACC = theta_mech*polepairs (Q15)
116 ; ARP=AR2, AR0->FR0 AR2->theta_elec, AR3->T2CNT
117 ;--------------------------------------------------------------------------------
118 001f bfb0 AND #7FFFh ; Modulo 360 degree in Q15
0020 7fff
119 ; ARP=AR2, AR0->FR0 AR2->theta_elec, AR3->T2CNT
120 ;--------------------------------------------------------------------------------
121 0021 9089 SACL *,AR1 ; theta_elec = theta_mech*polepairs (Q15)
122 ; ARP=AR2, AR0->FR0 AR2->theta_elec, AR3->T2CNT, ARP=AR1
123 ;--------------------------------------------------------------------------------
124 0022 _F2407_EV1_qep_theta_calc_end:
125
126 ; MAR *,AR1 ; can be removed if this condition is met on
127 ; ; every path to this code. (i.e., ARP=AR1 here)
128
129 0022 7c02 SBRK #(__F2407_EV1_qep_theta_calc_framesize+1)
130 0023 0090 LAR AR0,*-
131 0024 7680 PSHD *
132
133 0025 ef00 RET
134
135
136
137
138
No Errors, No Warnings
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -