PLL_TRACE_BP:
POINT_P16
LACC _Vbpa_16
POINT_P19
SACL _IntAx_19
B PHASE_TRACE_BEGIN
;*******************************************
PLL_TRACE_OUT:
POINT_P16
LACC _Vouta_16
POINT_P19
SACL _IntAx_19
PHASE_TRACE_BEGIN:
SETC SXM
MAR *,AR6
LACC #_Buffer_2124
ADD _Index_19
SACL _IntBx_19
LAR AR6,_IntBx_19
LACC _IntAx_19 ;检测输入
SACL *
LACC _Index_19
ADD #1
SACL _Index_19 ;索引加1
LACC _IntAx_19
BCND VLargeZero,GT
B NOverZero
VLargeZero:
LACC _IntAxBak_19 ;采样旧值
BCND OverZero,LEQ
B NOverZero
OverZero:
MOV _Index_19,_PrdCnt_19
SPLK #0, _Index_19
NOverZero:
LACC _PrdCnt_19,14
SACH _IntBx_19 ;1/4PrdCnt
LACC _Index_19
SUB _IntBx_19
BCND OverPoint,GEQ
ADD _PrdCnt_19
OverPoint:
SACL _IndexNew_19 ;1/4Index
LACC #_Buffer_2124
ADD _IndexNew_19
SACL _IntBx_19
LAR AR6,_IntBx_19
LACC *
SACL _Ubata_19 ;Ubata
LACC _IntAx_19
SACL _Ualfa_19 ;Ualfa
SACL _IntAxBak_19
LT _Ualfa_19
POINT_P17
MPY _CosQ0Ref_17;
POINT_P19
LTP _Ubata_19
POINT_P17
MPY _SinQ0Ref_17;
APAC
POINT_P19
SACH _Vd_19,4 ;Vd
LT _Ubata_19;
POINT_P17
MPY _CosQ0Ref_17;
POINT_P19
LTP _Ualfa_19
POINT_P17
MPY _SinQ0Ref_17;
SPAC
POINT_P19
SACL _Vq_19,4 ;Vq
LACC _Vq_19
BCND QSMALL,LT
LACC _Vd_19
BCND DSMALL,LT
MOV _Vq_19,_Theta_19
B QUAD_PRO
DSMALL: ;q>0 d<0
LACC #5792,1
SUB _Vq_19
SACL _Theta_19
B QUAD_PRO
QSMALL:
LACC _Vd_19
BCND ALLSMALL,LT ;q<0,d>0
MOV _Vq_19,_Theta_19
B QUAD_PRO
ALLSMALL: ;q<0,d<0
LACC #-5792,1
SUB _Vq_19
SACL _Theta_19
QUAD_PRO:
ZAC
SUB _Theta_19
SACL _PllErr_19
BLDD #1229,_IntAx_19 ;Q12
BLDD #206,_IntBx_19 ;Q16
LACC _IntgPhase_19,12 ;积分
LT _PllErr_19
MPY _IntAx_20 ;Q12
APAC ;控制器输出
SACH _PhaseCtrlOut_19,4 ;电流环给定交流
UPDNLMT _PhaseCtrlOut_19,#768,#-768
LT _PllErr_19 ;电压和参考电压差
MPY _IntBx_19 ;Q16
PAC
ADD _IntgPhase_19,16 ;4.28FORMAT
ADDS _IntgPhaseL_19
SACH _IntgPhase_19
SACL _IntgPhaseL_19
UPDNLMT _IntgPhase_19,#768,#-768
|