你好,我想问一下,2p2z、3p3z这种应该如何使用?我最近写的一个程序,需要使用4个pid,所以我在原有的2p2z(只能定义两个,定义到CNTL_2P2Z_Ref3开始报错)基础上,参照2p2z的使用方法,使用了3p3z,但是发现3p3z控制器并没有工作,只是按照最小占空比输出。
// CONTROL_2P2Z
extern volatile long *CNTL_2P2Z_Ref1; // instance #1
extern volatile long *CNTL_2P2Z_Out1; // instance #1
extern volatile long *CNTL_2P2Z_Fdbk1; // instance #1
extern volatile long *CNTL_2P2Z_Coef1; // instance #1
extern volatile long CNTL_2P2Z_DBUFF1[5];
// CONTROL_2P2Z
extern volatile long *CNTL_2P2Z_Ref2; // instance #2
extern volatile long *CNTL_2P2Z_Out2; // instance #2
extern volatile long *CNTL_2P2Z_Fdbk2; // instance #2
extern volatile long *CNTL_2P2Z_Coef2; // instance #2
extern volatile long CNTL_2P2Z_DBUFF2[5];
// CONTROL_3P3Z1, Output Current Regulation Loop
extern volatile long *CNTL_3P3Z_Ref1; // instance #1
extern volatile long *CNTL_3P3Z_Out1; // instance #1
extern volatile long *CNTL_3P3Z_Fdbk1; // instance #1
extern volatile long *CNTL_3P3Z_Coef1; // instance #1
extern volatile long CNTL_3P3Z_DBUFF1[5];
// CONTROL_3P3Z1, Output Voltage Regulation Loop
extern volatile long *CNTL_3P3Z_Ref2; // instance #2
extern volatile long *CNTL_3P3Z_Out2; // instance #2
extern volatile long *CNTL_3P3Z_Fdbk2; // instance #2
extern volatile long *CNTL_3P3Z_Coef2; // instance #2
extern volatile long CNTL_3P3Z_DBUFF2[5];
user4465600:
DPLib.pdf
你好,我想问一下,2p2z、3p3z这种应该如何使用?我最近写的一个程序,需要使用4个pid,所以我在原有的2p2z(只能定义两个,定义到CNTL_2P2Z_Ref3开始报错)基础上,参照2p2z的使用方法,使用了3p3z,但是发现3p3z控制器并没有工作,只是按照最小占空比输出。
// CONTROL_2P2Z
extern volatile long *CNTL_2P2Z_Ref1; // instance #1
extern volatile long *CNTL_2P2Z_Out1; // instance #1
extern volatile long *CNTL_2P2Z_Fdbk1; // instance #1
extern volatile long *CNTL_2P2Z_Coef1; // instance #1
extern volatile long CNTL_2P2Z_DBUFF1[5];
// CONTROL_2P2Z
extern volatile long *CNTL_2P2Z_Ref2; // instance #2
extern volatile long *CNTL_2P2Z_Out2; // instance #2
extern volatile long *CNTL_2P2Z_Fdbk2; // instance #2
extern volatile long *CNTL_2P2Z_Coef2; // instance #2
extern volatile long CNTL_2P2Z_DBUFF2[5];
// CONTROL_3P3Z1, Output Current Regulation Loop
extern volatile long *CNTL_3P3Z_Ref1; // instance #1
extern volatile long *CNTL_3P3Z_Out1; // instance #1
extern volatile long *CNTL_3P3Z_Fdbk1; // instance #1
extern volatile long *CNTL_3P3Z_Coef1; // instance #1
extern volatile long CNTL_3P3Z_DBUFF1[5];
// CONTROL_3P3Z1, Output Voltage Regulation Loop
extern volatile long *CNTL_3P3Z_Ref2; // instance #2
extern volatile long *CNTL_3P3Z_Out2; // instance #2
extern volatile long *CNTL_3P3Z_Fdbk2; // instance #2
extern volatile long *CNTL_3P3Z_Coef2; // instance #2
extern volatile long CNTL_3P3Z_DBUFF2[5];
user4465600:Solar_DC_DC-DPL-ISR.asm中:
_DPL_Init:ZAPAMOVL XAR0, #ZeroNetMOVL *XAR0, ACC
; Initialize all the DP library macro used here
;———————————————————
;ADCDRV_1ch_INIT 0 ; IL2
;ADCDRV_1ch_INIT 1 ; IL
;ADCDRV_1ch_INIT 2 ; Vb
;ADCDRV_1ch_INIT 3 ; Vp
;ADCDRV_1ch_INIT 4 ; Vp2MATH_EMAVG_INIT 1MATH_EMAVG_INIT 2MATH_EMAVG_INIT 3CNTL_2P2Z_INIT 1CNTL_2P2Z_INIT 2
CNTL_3P3Z_INIT 1CNTL_3P3Z_INIT 2
PWMDRV_DualUpDwnCnt_INIT 2 ; PWM1A;PWMDRV_LLC_ComplPairDB_INIT 3;LRETR
;—————————————————————————————–
; Digital Power library – Interrupt Service Routine
.sect "ramfuncs"; label to DP ISR Run function.def _DPL_ISR
_DPL_ISR:; full context save – push any unprotected registers onto stackPUSHAR1H:AR0HPUSHXAR2PUSHXAR3PUSHXAR4PUSHXAR5PUSHXAR6PUSHXAR7PUSHXTSPM0; set C28 modeCLRCAMODECLRCPAGE0,OVM
;CLRC INTM; clear interrupt mask – comment if ISR non-nestable
;—————————————————————————————–
; call DP library modules
;———————————————————
;ADCDRV_1ch 0 ; IL2
;ADCDRV_1ch 1 ; IL
;ADCDRV_1ch 2 ; Vb
;ADCDRV_1ch 3 ; Vp
;ADCDRV_1ch 4 ; Vp2
;—————————————————-;Subtract IL CS amplifier offset and calculate IL
********
采样标定部分程序
********
;———————————————————
; Run the control laws
;———————————————————MATH_EMAVG1MATH_EMAVG2MATH_EMAVG3
CNTL_2P2Z1CNTL_2P2Z2;Volt loop controllerCNTL_3P3Z1CNTL_3P3Z2;Volt loop controller
PWMDRV_DualUpDwnCnt 2; PWM1A;PWMDRV_1ch_UpDwnCnt 2; PWM2A;PWMDRV_LLC_ComplPairDB 3 ;
;—————————————————————————————–
; Interrupt management before exit
MOVWDP,#_EPwm2Regs.ETCLRMOV@_EPwm2Regs.ETCLR,#0x01; Clear EPWM2 Int flagMOVWDP,#_PieCtrlRegs.PIEACK; Acknowledge PIE interrupt Group 3MOV@_PieCtrlRegs.PIEACK, #0x4
;—————————————————————————————–
; full context restore
;SETC INTM; set INTM to protect context restorePOPXTPOPXAR7POPXAR6POPXAR5POPXAR4POPXAR3POPXAR2POPAR1H:AR0HIRET; return from interrupt.end
; end of file