контроль вентилятора и чопера
This commit is contained in:
parent
0b491c0a8b
commit
7cf989b182
@ -142,7 +142,7 @@ void InitEPwm3Gpio(void)
|
||||
// Comment out other unwanted lines.
|
||||
//
|
||||
GpioCtrlRegs.GPAPUD.bit.GPIO4 = 1; // Disable pull-up on GPIO4 (EPWM3A)
|
||||
// GpioCtrlRegs.GPAPUD.bit.GPIO5 = 1; // Disable pull-up on GPIO5 (EPWM3B)
|
||||
GpioCtrlRegs.GPAPUD.bit.GPIO5 = 1; // Disable pull-up on GPIO5 (EPWM3B)
|
||||
// GpioCtrlRegs.GPEPUD.bit.GPIO149 = 1; // Disable pull-up on GPIO149 (EPWM3A)
|
||||
// GpioCtrlRegs.GPEPUD.bit.GPIO150 = 1; // Disable pull-up on GPIO150 (EPWM3B)
|
||||
|
||||
@ -152,7 +152,7 @@ void InitEPwm3Gpio(void)
|
||||
// Comment out other unwanted lines.
|
||||
//
|
||||
GpioCtrlRegs.GPAMUX1.bit.GPIO4 = 1; // Configure GPIO4 as EPWM3A
|
||||
// GpioCtrlRegs.GPAMUX1.bit.GPIO5 = 1; // Configure GPIO5 as EPWM3B
|
||||
GpioCtrlRegs.GPAMUX1.bit.GPIO5 = 1; // Configure GPIO5 as EPWM3B
|
||||
// GpioCtrlRegs.GPEMUX2.bit.GPIO149 = 1; // Configure GPIO149 as EPWM3A
|
||||
// GpioCtrlRegs.GPEMUX2.bit.GPIO150 = 1; // Configure GPIO150 as EPWM3B
|
||||
|
||||
|
@ -70,7 +70,7 @@ void PWMAllInit(void)
|
||||
PWMInit(PWM_B, PwmMotor100, COMPLIMENTARY);//ØÈÌ
|
||||
PWMInit(PWM_C, PwmMotor100, COMPLIMENTARY);//ØÈÌ
|
||||
PWMInit(PWM_BRAKE, PwmBrake100, INDEPENDED);//Òîðìîç
|
||||
PWMInit(3, PwmMotor100, COMPLIMENTARY);//âåíòèëÿòîð
|
||||
PWMInit(3, PwmMotor100, INDEPENDED);//âåíòèëÿòîð è ÷îïïåð
|
||||
|
||||
//11 è 12 äëÿ SDFM
|
||||
PWMInit(11, PwmMotor100, INDEPENDED);
|
||||
@ -192,8 +192,16 @@ void PWMInit(uint16_t Num, uint16_t Period, uint16_t Independed)
|
||||
{
|
||||
EPwmRegs[Num]->AQCTLA.bit.CAU = AQ_SET; // Set PWMxA on Zero
|
||||
EPwmRegs[Num]->AQCTLA.bit.CAD = AQ_CLEAR;
|
||||
EPwmRegs[Num]->AQCTLB.bit.CAU = AQ_CLEAR; // Set PWMxA on Zero
|
||||
EPwmRegs[Num]->AQCTLB.bit.CAD = AQ_SET;
|
||||
if(Independed)
|
||||
{
|
||||
EPwmRegs[Num]->AQCTLB.bit.CBU = AQ_SET; // Set PWMxA on Zero
|
||||
EPwmRegs[Num]->AQCTLB.bit.CBD = AQ_CLEAR;
|
||||
}
|
||||
else
|
||||
{
|
||||
EPwmRegs[Num]->AQCTLB.bit.CAU = AQ_CLEAR; // Set PWMxA on Zero
|
||||
EPwmRegs[Num]->AQCTLB.bit.CAD = AQ_SET;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -209,9 +217,11 @@ void PWMInit(uint16_t Num, uint16_t Period, uint16_t Independed)
|
||||
if(Independed)
|
||||
{
|
||||
EPwmRegs[Num]->CMPA.bit.CMPA = Period;
|
||||
EPwmRegs[Num]->CMPB.bit.CMPB = Period;
|
||||
EPwmRegs[Num]->DBCTL.bit.POLSEL = DB_ACTV_HI; //DB_ACTV_HI - independ
|
||||
EPwmRegs[Num]->DBRED.bit.DBRED = 0;
|
||||
EPwmRegs[Num]->DBFED.bit.DBFED = 0;
|
||||
EPwmRegs[Num]->DBCTL.bit.OUT_MODE = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -37,7 +37,8 @@ typedef struct
|
||||
volatile strPWMABC PWM_motor = {PERIOD_2, PERIOD_2, PERIOD_2};
|
||||
|
||||
int16_t A_proc,B_proc,C_proc;
|
||||
uint16_t PWM_brake = PERIOD_MOTOR;
|
||||
uint16_t PWM_Vent = PERIOD_MOTOR;
|
||||
uint16_t PWM_Chop = PERIOD_MOTOR;
|
||||
|
||||
void pwm_set_volt_3F(float phaseA, float phaseB, float phaseC, float Udc)
|
||||
{
|
||||
@ -78,7 +79,8 @@ void pwm_set_volt_3F(float phaseA, float phaseB, float phaseC, float Udc)
|
||||
EPwmRegs[PWM_B]->CMPA.bit.CMPA = PERIOD_MOTOR - PWM_motor.UB;
|
||||
EPwmRegs[PWM_C]->CMPA.bit.CMPA = PERIOD_MOTOR - PWM_motor.UC;
|
||||
|
||||
EPwmRegs[3]->CMPA.bit.CMPA = PERIOD_MOTOR - PWM_brake;
|
||||
EPwmRegs[3]->CMPA.bit.CMPA = PERIOD_MOTOR - PWM_Vent;
|
||||
EPwmRegs[3]->CMPB.bit.CMPB = PERIOD_MOTOR - PWM_Chop;
|
||||
}
|
||||
|
||||
|
||||
@ -137,6 +139,8 @@ __interrupt void epwm2_isr(void)
|
||||
PWM_motor.UB = PERIOD_2;
|
||||
PWM_motor.UC = PERIOD_2;
|
||||
vectorFault();
|
||||
EPwmRegs[3]->CMPA.bit.CMPA = PERIOD_MOTOR - PWM_Vent;
|
||||
EPwmRegs[3]->CMPB.bit.CMPB = PERIOD_MOTOR - PWM_Chop;
|
||||
Test_ADC_PWM_Synch1++;
|
||||
if(TestStopSync == 2) TestStopSync = 3;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user