TI中文支持网
TI专业的中文技术问题搜集分享网站

SOLAR_CNTL_2P2Z.asm 问题

;=============================
SOLAR_CNTL_2P2Z .macro n
;=============================
; set up address pointers
MOVW DP, #_CNTL_2P2Z_Ref:n:
MOVL XAR0, @_CNTL_2P2Z_Ref:n: ; net pointer to Ref (XAR0)
MOVW DP,#_CNTL_2P2Z_Fdbk:n:
MOVL XAR1, @_CNTL_2P2Z_Fdbk:n: ; net pointer to Fdbk (XAR1)
MOVW DP,#_CNTL_2P2Z_DBUFF:n:
MOVL XAR4, #_CNTL_2P2Z_DBUFF:n: ; pointer to the DBUFF array (used internally by the module)
; calculate error (Ref – Fdbk)
MOVL ACC, *XAR0 ; ACC = Ref (Q24) = Q(24)
SUBL ACC, *XAR1 ; ACC = Ref(Q24) – Fdbk(Q24)= error(Q24)
LSL ACC, #6 ; Logical left shift by 6, Q{24}<<6 -> Q{30}

;store error in DBUFF MOVL *+XAR4[6], ACC ; e(n) = ACC = error Q{30}                                    ; *+XAR4[6]装载e(n)
MOV AR0,#8                                                                                                      
SUBL ACC, *+XAR4[AR0]                                                                              ;*+XAR4[8]装载e(n-2) 
ADDL ACC, *+XAR4[6] 
MOVL *+XAR4[4], ACC ;*+XAR4[4]—2e(n)-e(n-2)                                    
ADDL ACC, *+XAR4[6]                                                                                    ;*+XAR4[4]装载2e(n)-e(n-2) 
MOVW DP,#_CNTL_2P2Z_Out:n:
MOVL XAR2, @_CNTL_2P2Z_Out:n: ; net pointer to Out (XAR2)
MOVW DP,#_CNTL_2P2Z_Coef:n:
MOVL XAR3, @_CNTL_2P2Z_Coef:n: ; net pointer to Coef (XAR3)
ZAPA; compute 2P2Z filter
MOV AR0,#8
MOVL XT, *+XAR4[AR0]                                                                                                                ; XT = e(n-2)
QMPYL P, XT, *XAR3++                                                                                                                 ; P = e(n-2)Q30*B2{Q26} = I8Q24
MOVDL XT, *+XAR4[6]                                                                                                                   ; XT = e(n-1), e(n-2) = e(n-1)  这一句明显指 *+XAR4[6]装的是e(n-1),和上面                                                                                                                                                           ; 语句ADDL ACC, *+XAR4[6]    ;*+XAR4[4]装载2e(n)-e(n-2) 矛盾                                                                                                                                                                                                                                         
QMPYAL P, XT, *XAR3++ ; P = e(n-1)Q30*B1{Q26} = Q24, ACC=e(n-2)*B2
;MOVDL XT, *+XAR4[4] ; XT = e(n), e(n-1) = e(n) MOVL XT, *+XAR4[4] ; XT = e(n)
QMPYAL P, XT, *XAR3++ ; P = e(n)Q30*B0{Q26}= Q24, ACC = e(n-2)*B2 + e(n-1)*B1 MOVL XT,*+XAR4[2] ; XT = u(n-2)
QMPYAL P, XT, *XAR3++ ; P = u(n-2)*A2, ACC = e(n-2)*B2 + e(n-1)*B1 + e(n)*B0
MOVDL XT,*+XAR4[0] ; XT = u(n-1), u(n-2) = u(n-1)
QMPYAL P, XT, *XAR3++ ; P = u(n-1)*A1, ACC = e(n-2)*B2 + e(n-1)*B1 + e(n)*B0 + u(n-2)*A2
ADDL ACC, @P ; ACC = e(n-2)*B2 + e(n-1)*B1 + e(n)*B0 + u(n-2)*A2 + u(n-1)*A1

; scale u(n):Q24, saturate (max>u(n)>min0), and save history
MINL ACC, *XAR3++ ; saturate to < max (Q24)
MAXL ACC, *XAR3 ; saturate to > min (Q24)

; write controller result to output terminal (Q24)
MOVL *XAR2, ACC ; output control effort to terminal net

; Convert the u(n) to Q30 format and store in the data buffer
LSL ACC, #6 ; Logical left shift by 6, Q{24}<<6 -> Q{30}
MOVL *XAR4, ACC ; u(n-1) = u(n) = ACC

.endm
; end of file

上面一段程序表明 *+XAR4[6]装载e(n) ,*+XAR4[4]装载2e(n)-e(n-2) ,到了下面的那一段计算程序,明显是*+XAR4[4]装载e(n) ,*+XAR4[6]装载e(n-1),请解读一下,谢谢!

Jack Tan2:建议查看c2000的汇编指令手册,那里有你知道的内容。

;=============================
SOLAR_CNTL_2P2Z .macro n
;=============================
; set up address pointers
MOVW DP, #_CNTL_2P2Z_Ref:n:
MOVL XAR0, @_CNTL_2P2Z_Ref:n: ; net pointer to Ref (XAR0)
MOVW DP,#_CNTL_2P2Z_Fdbk:n:
MOVL XAR1, @_CNTL_2P2Z_Fdbk:n: ; net pointer to Fdbk (XAR1)
MOVW DP,#_CNTL_2P2Z_DBUFF:n:
MOVL XAR4, #_CNTL_2P2Z_DBUFF:n: ; pointer to the DBUFF array (used internally by the module)
; calculate error (Ref – Fdbk)
MOVL ACC, *XAR0 ; ACC = Ref (Q24) = Q(24)
SUBL ACC, *XAR1 ; ACC = Ref(Q24) – Fdbk(Q24)= error(Q24)
LSL ACC, #6 ; Logical left shift by 6, Q{24}<<6 -> Q{30}

;store error in DBUFF MOVL *+XAR4[6], ACC ; e(n) = ACC = error Q{30}                                    ; *+XAR4[6]装载e(n)
MOV AR0,#8                                                                                                      
SUBL ACC, *+XAR4[AR0]                                                                              ;*+XAR4[8]装载e(n-2) 
ADDL ACC, *+XAR4[6] 
MOVL *+XAR4[4], ACC ;*+XAR4[4]—2e(n)-e(n-2)                                    
ADDL ACC, *+XAR4[6]                                                                                    ;*+XAR4[4]装载2e(n)-e(n-2) 
MOVW DP,#_CNTL_2P2Z_Out:n:
MOVL XAR2, @_CNTL_2P2Z_Out:n: ; net pointer to Out (XAR2)
MOVW DP,#_CNTL_2P2Z_Coef:n:
MOVL XAR3, @_CNTL_2P2Z_Coef:n: ; net pointer to Coef (XAR3)
ZAPA; compute 2P2Z filter
MOV AR0,#8
MOVL XT, *+XAR4[AR0]                                                                                                                ; XT = e(n-2)
QMPYL P, XT, *XAR3++                                                                                                                 ; P = e(n-2)Q30*B2{Q26} = I8Q24
MOVDL XT, *+XAR4[6]                                                                                                                   ; XT = e(n-1), e(n-2) = e(n-1)  这一句明显指 *+XAR4[6]装的是e(n-1),和上面                                                                                                                                                           ; 语句ADDL ACC, *+XAR4[6]    ;*+XAR4[4]装载2e(n)-e(n-2) 矛盾                                                                                                                                                                                                                                         
QMPYAL P, XT, *XAR3++ ; P = e(n-1)Q30*B1{Q26} = Q24, ACC=e(n-2)*B2
;MOVDL XT, *+XAR4[4] ; XT = e(n), e(n-1) = e(n) MOVL XT, *+XAR4[4] ; XT = e(n)
QMPYAL P, XT, *XAR3++ ; P = e(n)Q30*B0{Q26}= Q24, ACC = e(n-2)*B2 + e(n-1)*B1 MOVL XT,*+XAR4[2] ; XT = u(n-2)
QMPYAL P, XT, *XAR3++ ; P = u(n-2)*A2, ACC = e(n-2)*B2 + e(n-1)*B1 + e(n)*B0
MOVDL XT,*+XAR4[0] ; XT = u(n-1), u(n-2) = u(n-1)
QMPYAL P, XT, *XAR3++ ; P = u(n-1)*A1, ACC = e(n-2)*B2 + e(n-1)*B1 + e(n)*B0 + u(n-2)*A2
ADDL ACC, @P ; ACC = e(n-2)*B2 + e(n-1)*B1 + e(n)*B0 + u(n-2)*A2 + u(n-1)*A1

; scale u(n):Q24, saturate (max>u(n)>min0), and save history
MINL ACC, *XAR3++ ; saturate to < max (Q24)
MAXL ACC, *XAR3 ; saturate to > min (Q24)

; write controller result to output terminal (Q24)
MOVL *XAR2, ACC ; output control effort to terminal net

; Convert the u(n) to Q30 format and store in the data buffer
LSL ACC, #6 ; Logical left shift by 6, Q{24}<<6 -> Q{30}
MOVL *XAR4, ACC ; u(n-1) = u(n) = ACC

.endm
; end of file

上面一段程序表明 *+XAR4[6]装载e(n) ,*+XAR4[4]装载2e(n)-e(n-2) ,到了下面的那一段计算程序,明显是*+XAR4[4]装载e(n) ,*+XAR4[6]装载e(n-1),请解读一下,谢谢!

Qingyun Li:

回复 Jack Tan2:

我核对过这些指令和TI的相关库,还是觉得有问题,和算法不符,可否解释;store error in DBUFF以下六行程序,谢谢!

;=============================
SOLAR_CNTL_2P2Z .macro n
;=============================
; set up address pointers
MOVW DP, #_CNTL_2P2Z_Ref:n:
MOVL XAR0, @_CNTL_2P2Z_Ref:n: ; net pointer to Ref (XAR0)
MOVW DP,#_CNTL_2P2Z_Fdbk:n:
MOVL XAR1, @_CNTL_2P2Z_Fdbk:n: ; net pointer to Fdbk (XAR1)
MOVW DP,#_CNTL_2P2Z_DBUFF:n:
MOVL XAR4, #_CNTL_2P2Z_DBUFF:n: ; pointer to the DBUFF array (used internally by the module)
; calculate error (Ref – Fdbk)
MOVL ACC, *XAR0 ; ACC = Ref (Q24) = Q(24)
SUBL ACC, *XAR1 ; ACC = Ref(Q24) – Fdbk(Q24)= error(Q24)
LSL ACC, #6 ; Logical left shift by 6, Q{24}<<6 -> Q{30}

;store error in DBUFF MOVL *+XAR4[6], ACC ; e(n) = ACC = error Q{30}                                    ; *+XAR4[6]装载e(n)
MOV AR0,#8                                                                                                      
SUBL ACC, *+XAR4[AR0]                                                                              ;*+XAR4[8]装载e(n-2) 
ADDL ACC, *+XAR4[6] 
MOVL *+XAR4[4], ACC ;*+XAR4[4]—2e(n)-e(n-2)                                    
ADDL ACC, *+XAR4[6]                                                                                    ;*+XAR4[4]装载2e(n)-e(n-2) 
MOVW DP,#_CNTL_2P2Z_Out:n:
MOVL XAR2, @_CNTL_2P2Z_Out:n: ; net pointer to Out (XAR2)
MOVW DP,#_CNTL_2P2Z_Coef:n:
MOVL XAR3, @_CNTL_2P2Z_Coef:n: ; net pointer to Coef (XAR3)
ZAPA; compute 2P2Z filter
MOV AR0,#8
MOVL XT, *+XAR4[AR0]                                                                                                                ; XT = e(n-2)
QMPYL P, XT, *XAR3++                                                                                                                 ; P = e(n-2)Q30*B2{Q26} = I8Q24
MOVDL XT, *+XAR4[6]                                                                                                                   ; XT = e(n-1), e(n-2) = e(n-1)  这一句明显指 *+XAR4[6]装的是e(n-1),和上面                                                                                                                                                           ; 语句ADDL ACC, *+XAR4[6]    ;*+XAR4[4]装载2e(n)-e(n-2) 矛盾                                                                                                                                                                                                                                         
QMPYAL P, XT, *XAR3++ ; P = e(n-1)Q30*B1{Q26} = Q24, ACC=e(n-2)*B2
;MOVDL XT, *+XAR4[4] ; XT = e(n), e(n-1) = e(n) MOVL XT, *+XAR4[4] ; XT = e(n)
QMPYAL P, XT, *XAR3++ ; P = e(n)Q30*B0{Q26}= Q24, ACC = e(n-2)*B2 + e(n-1)*B1 MOVL XT,*+XAR4[2] ; XT = u(n-2)
QMPYAL P, XT, *XAR3++ ; P = u(n-2)*A2, ACC = e(n-2)*B2 + e(n-1)*B1 + e(n)*B0
MOVDL XT,*+XAR4[0] ; XT = u(n-1), u(n-2) = u(n-1)
QMPYAL P, XT, *XAR3++ ; P = u(n-1)*A1, ACC = e(n-2)*B2 + e(n-1)*B1 + e(n)*B0 + u(n-2)*A2
ADDL ACC, @P ; ACC = e(n-2)*B2 + e(n-1)*B1 + e(n)*B0 + u(n-2)*A2 + u(n-1)*A1

; scale u(n):Q24, saturate (max>u(n)>min0), and save history
MINL ACC, *XAR3++ ; saturate to < max (Q24)
MAXL ACC, *XAR3 ; saturate to > min (Q24)

; write controller result to output terminal (Q24)
MOVL *XAR2, ACC ; output control effort to terminal net

; Convert the u(n) to Q30 format and store in the data buffer
LSL ACC, #6 ; Logical left shift by 6, Q{24}<<6 -> Q{30}
MOVL *XAR4, ACC ; u(n-1) = u(n) = ACC

.endm
; end of file

上面一段程序表明 *+XAR4[6]装载e(n) ,*+XAR4[4]装载2e(n)-e(n-2) ,到了下面的那一段计算程序,明显是*+XAR4[4]装载e(n) ,*+XAR4[6]装载e(n-1),请解读一下,谢谢!

Qingyun Li:

回复 Jack Tan2:

你好,位置如下:Chinese\开发工具\太阳能\高压太阳能DC/AC逆变器套件\示例项目\高压太阳能DC/AC逆变器示例Piccolo F2803x\我是以前拷的源代码,如下。;———————————————————————————-
; FILE:SOLAR_CNTL_2P2Z.asm
;
; Description: 2nd Order Control Law Macro Module
;
; Version:2.0
;
;Target:F2802x / F2803x
;
;———————————————————————————-
;Copyright Texas Instruments2010
;———————————————————————————-
;Revision History:
;———————————————————————————-
;Date| Description
;———————————————————————————-
;06/15/10| Release 2.0(MB)
;———————————————————————————-
;=============================
SOLAR_CNTL_2P2Z_INIT .macro n
;=============================
; allocate memory space for data & terminal pointers
_CNTL_2P2Z_Ref:n: .usect"CNTL_2P2Z_Section",2,1,1; reference input terminal
_CNTL_2P2Z_Fdbk:n: .usect"CNTL_2P2Z_Section",2,1,1; feedback input terminal
_CNTL_2P2Z_Out:n: .usect"CNTL_2P2Z_Section",2,1,1; output terminal
_CNTL_2P2Z_Coef:n: .usect"CNTL_2P2Z_Section",2,1,1; coefficients & saturation limits (14 words)
_CNTL_2P2Z_DBUFF:n: .usect"CNTL_2P2Z_InternalData",10,1,1; internal Data BUFF

; publish terminal pointers for access from the C environment.def_CNTL_2P2Z_Ref:n:.def_CNTL_2P2Z_Fdbk:n:.def_CNTL_2P2Z_Out:n:.def_CNTL_2P2Z_Coef:n:.def_CNTL_2P2Z_DBUFF:n:

; set terminal pointers to ZeroNetMOVL XAR2, #ZeroNetMOVW DP, #_CNTL_2P2Z_Ref:n:MOVL @_CNTL_2P2Z_Ref:n:, XAR2MOVW DP, #_CNTL_2P2Z_Fdbk:n:MOVL @_CNTL_2P2Z_Fdbk:n:, XAR2MOVW DP, #_CNTL_2P2Z_Out:n:MOVL @_CNTL_2P2Z_Out:n:, XAR2

; zero data bufferMOVW DP, #_CNTL_2P2Z_DBUFF:n:MOVLXAR2,#_CNTL_2P2Z_DBUFF:n:RPT#9; 10 times|| MOV*XAR2++, #0.endm

;====================================
SOLAR_CNTL_2P2Z_RESET .macro n
;====================================

; zero data bufferMOVW DP, #_CNTL_2P2Z_DBUFF:n:MOVLXAR2,#_CNTL_2P2Z_DBUFF:n:RPT#9; 10 times|| MOV*XAR2++, #0.endm

;———————————————————————————-
;=============================
SOLAR_CNTL_2P2Z .macro n
;=============================
; set up address pointersMOVW DP, #_CNTL_2P2Z_Ref:n:MOVLXAR0, @_CNTL_2P2Z_Ref:n:; net pointer to Ref (XAR0)MOVW DP,#_CNTL_2P2Z_Fdbk:n:MOVLXAR1, @_CNTL_2P2Z_Fdbk:n:; net pointer to Fdbk (XAR1)MOVW DP,#_CNTL_2P2Z_DBUFF:n:MOVL XAR4, #_CNTL_2P2Z_DBUFF:n:; pointer to the DBUFF array (used internally by the module)
; calculate error (Ref – Fdbk)MOVL ACC, *XAR0; ACC = Ref (Q24) = Q(24)SUBL ACC, *XAR1; ACC = Ref(Q24) – Fdbk(Q24)= error(Q24)LSLACC, #6; Logical left shift by 6,Q{24}<<6 -> Q{30}
;store error in DBUFF ;MOVL *+XAR4[4], ACC; e(n) = ACC = error Q{30} MOVL *+XAR4[6], ACC; e(n) = ACC = error Q{30} *+XAR4[6]—e(n)MOVAR0,#8SUBLACC, *+XAR4[AR0];*+XAR4[8]—e(n-2)ACC— e(n)-e(n-2)ADDLACC, *+XAR4[6]; ACC— 2e(n)-e(n-2)MOVL*+XAR4[4], ACC;*+XAR4[4]—2e(n)-e(n-2)MOVW DP,#_CNTL_2P2Z_Out:n:MOVLXAR2, @_CNTL_2P2Z_Out:n:; net pointer to Out (XAR2)MOVW DP,#_CNTL_2P2Z_Coef:n:MOVLXAR3, @_CNTL_2P2Z_Coef:n:; net pointer to Coef (XAR3)ZAPA
; compute 2P2Z filterMOVAR0,#8MOVL XT, *+XAR4[AR0]; XT= e(n-2)QMPYL P, XT, *XAR3++; P= e(n-2)Q30*B2{Q26} = I8Q24MOVDL XT, *+XAR4[6]; XT= e(n-1), e(n-2) = e(n-1)QMPYAL P, XT, *XAR3++; P= e(n-1)Q30*B1{Q26} = Q24, ACC=e(n-2)*B2;MOVDL XT, *+XAR4[4]; XT= e(n), e(n-1) = e(n) MOVL XT, *+XAR4[4]; XT= e(n)QMPYAL P, XT, *XAR3++; P= e(n)Q30*B0{Q26}= Q24, ACC = e(n-2)*B2 + e(n-1)*B1 MOVL XT,*+XAR4[2]; XT= u(n-2)QMPYAL P, XT, *XAR3++; P= u(n-2)*A2, ACC = e(n-2)*B2 + e(n-1)*B1 + e(n)*B0MOVDL XT,*+XAR4[0]; XT= u(n-1), u(n-2) = u(n-1)QMPYAL P, XT, *XAR3++; P= u(n-1)*A1, ACC = e(n-2)*B2 + e(n-1)*B1 + e(n)*B0 + u(n-2)*A2ADDL ACC, @P; ACC = e(n-2)*B2 + e(n-1)*B1 + e(n)*B0 + u(n-2)*A2 + u(n-1)*A1

; scale u(n):Q24, saturate (max>u(n)>min0), and save historyMINL ACC, *XAR3++; saturate to < max (Q24)MAXL ACC, *XAR3; saturate to > min (Q24)

; write controller result to output terminal (Q24)MOVL *XAR2, ACC; output control effort to terminal net

; Convert the u(n) to Q30 format and store in the data bufferLSLACC, #6; Logical left shift by 6, Q{24}<<6 -> Q{30}MOVL *XAR4, ACC; u(n-1) = u(n) = ACC
.endm
; end of file

但另一个2P2Z就是没有疑问的,也在这个项目里面,如下:

;———————————————————————————-
; FILE:CNTL_2P2Z.asm
;
; Description: 2nd Order Control Law Macro Module
;
; Version:2.0
;
;Target:F2802x / F2803x
;
;———————————————————————————-
;Copyright Texas Instruments2010
;———————————————————————————-
;Revision History:
;———————————————————————————-
;Date| Description
;———————————————————————————-
;06/15/10| Release 2.0(MB)
;———————————————————————————-
;============================= 汇编宏定义 CNTL_2P2Z 初始化
CNTL_2P2Z_INIT .macro n
;=============================
; allocate memory space for data & terminal pointers

_CNTL_2P2Z_Ref:n: .usect"CNTL_2P2Z_Section",2,1,1; reference input terminal
_CNTL_2P2Z_Fdbk:n: .usect"CNTL_2P2Z_Section",2,1,1; feedback input terminal
_CNTL_2P2Z_Out:n: .usect"CNTL_2P2Z_Section",2,1,1; output terminal
_CNTL_2P2Z_Coef:n: .usect"CNTL_2P2Z_Section",2,1,1; coefficients & saturation limits (14 words)
_CNTL_2P2Z_DBUFF:n: .usect"CNTL_2P2Z_InternalData",10,1,1; internal Data BUFF
; publish terminal pointers for access from the C environment
.def_CNTL_2P2Z_Ref:n:.def_CNTL_2P2Z_Fdbk:n:.def_CNTL_2P2Z_Out:n:.def_CNTL_2P2Z_Coef:n:.def_CNTL_2P2Z_DBUFF:n:

; set terminal pointers to ZeroNetMOVL XAR2, #ZeroNetMOVW DP, #_CNTL_2P2Z_Ref:n:MOVL @_CNTL_2P2Z_Ref:n:, XAR2MOVW DP, #_CNTL_2P2Z_Fdbk:n:MOVL @_CNTL_2P2Z_Fdbk:n:, XAR2MOVW DP, #_CNTL_2P2Z_Out:n:MOVL @_CNTL_2P2Z_Out:n:, XAR2

; zero data bufferMOVW DP, #_CNTL_2P2Z_DBUFF:n:MOVLXAR2,#_CNTL_2P2Z_DBUFF:n:RPT#9; 10 times|| MOV*XAR2++, #0.endm

;====================================
CNTL_2P2Z_RESET .macro n
;====================================

; zero data bufferMOVW DP, #_CNTL_2P2Z_DBUFF:n:MOVLXAR2,#_CNTL_2P2Z_DBUFF:n:RPT#9; 10 times|| MOV*XAR2++, #0.endm

;———————————————————————————-
;=============================
CNTL_2P2Z .macro n
;=============================
; set up address pointers建立地址指针MOVW DP, #_CNTL_2P2Z_Ref:n:MOVLXAR0, @_CNTL_2P2Z_Ref:n:; net pointer to Ref (XAR0)MOVW DP,#_CNTL_2P2Z_Fdbk:n:MOVLXAR1, @_CNTL_2P2Z_Fdbk:n:; net pointer to Fdbk (XAR1)MOVW DP,#_CNTL_2P2Z_DBUFF:n:MOVL XAR4, #_CNTL_2P2Z_DBUFF:n:; pointer to the DBUFF array (used internally by the module)
; calculate error (Ref – Fdbk)MOVL ACC, *XAR0; ACC = Ref (Q24) = Q(24)XAR0指向内容装载SUBL ACC, *XAR1; ACC = Ref(Q24) – Fdbk(Q24)= error(Q24)LSLACC, #6; Logical left shift by 6,Q{24}<<6 -> Q{30}
;store error in DBUFF MOVL *+XAR4[4], ACC; e(n) = ACC = error Q{30}MOVW DP,#_CNTL_2P2Z_Out:n:MOVLXAR2, @_CNTL_2P2Z_Out:n:; net pointer to Out (XAR2)MOVW DP,#_CNTL_2P2Z_Coef:n:MOVLXAR3, @_CNTL_2P2Z_Coef:n:; net pointer to Coef (XAR3)ZAPA
; compute 2P2Z filterMOVAR0,#8MOVL XT, *+XAR4[AR0]; XT= e(n-2)QMPYL P, XT, *XAR3++; P= e(n-2)Q30*B2{Q26} = I8Q24XAR3–>B1MOVDL XT, *+XAR4[6]; XT= e(n-1), e(n-2) = e(n-1)XAR4–>e(n-1)QMPYAL P, XT, *XAR3++; P= e(n-1)Q30*B1{Q26} = Q24, ACC=e(n-2)*B2XAR3–>B0MOVDL XT, *+XAR4[4]; XT= e(n), e(n-1) = e(n)XAR4–>e(n)QMPYAL P, XT, *XAR3++; P= e(n)Q30*B0{Q26}= Q24, ACC = e(n-2)*B2 + e(n-1)*B1XAR3–>A2MOVL XT,*+XAR4[2]; XT= u(n-2)QMPYAL P, XT, *XAR3++; P= u(n-2)*A2, ACC = e(n-2)*B2 + e(n-1)*B1 + e(n)*B0MOVDL XT,*+XAR4[0]; XT= u(n-1), u(n-2) = u(n-1)QMPYAL P, XT, *XAR3++; P= u(n-1)*A1, ACC = e(n-2)*B2 + e(n-1)*B1 + e(n)*B0 + u(n-2)*A2ADDL ACC, @P; ACC = e(n-2)*B2 + e(n-1)*B1 + e(n)*B0 + u(n-2)*A2 + u(n-1)*A1

; scale u(n):Q24, saturate (max>u(n)>min0), and save historyMINL ACC, *XAR3++; saturate to < max (Q24)MAXL ACC, *XAR3; saturate to > min (Q24)

; write controller result to output terminal (Q24)MOVL *XAR2, ACC; output control effort to terminal net

; Convert the u(n) to Q30 format and store in the data bufferLSLACC, #6; Logical left shift by 6, Q{24}<<6 -> Q{30}MOVL *XAR4, ACC; u(n-1) = u(n) = ACC
.endm
; end of file

SOLAR_CNTL_2P2Z.asm这个文件只是下面几句有疑问,后面的计算没有疑问。;store error in DBUFF ;MOVL *+XAR4[4], ACC; e(n) = ACC = error Q{30} MOVL *+XAR4[6], ACC; e(n) = ACC = error Q{30} *+XAR4[6]—e(n)MOVAR0,#8SUBLACC, *+XAR4[AR0];*+XAR4[8]—e(n-2)ACC— e(n)-e(n-2)ADDLACC, *+XAR4[6]; ACC— 2e(n)-e(n-2)MOVL*+XAR4[4], ACC;*+XAR4[4]—2e(n)-e(n-2)
谢谢!

赞(0)
未经允许不得转载:TI中文支持网 » SOLAR_CNTL_2P2Z.asm 问题
分享到: 更多 (0)