我需要电机进行正反转,使用lab11e例程,该例程中有一段是霍尔线的接法可以改变电机的运行方向,但在应用中不切实际,所以需要通过霍尔信号实现电机的正反转,但我有一段程序具体不太清楚,需要各位详细说一下每一句的含义,谢谢!
void HALLBLDC_Ctrl_PwmSet(uint16_t PwmState, _iq PwmDuty)
{
switch(PwmState)
{
case 0: // V+/W-
{
PWM_setOneShotTrip(hal.pwmHandle[PWM_Number_1]);
PWM_clearOneShotTrip(hal.pwmHandle[PWM_Number_2]);
PWM_clearOneShotTrip(hal.pwmHandle[PWM_Number_3]);
{
switch(PwmState)
{
case 0: // V+/W-
{
PWM_setOneShotTrip(hal.pwmHandle[PWM_Number_1]);
PWM_clearOneShotTrip(hal.pwmHandle[PWM_Number_2]);
PWM_clearOneShotTrip(hal.pwmHandle[PWM_Number_3]);
gPwmData.Tabc.value[0] = _IQ(0.0);
gPwmData.Tabc.value[1] = PwmDuty;
gPwmData.Tabc.value[2] = -PwmDuty;
gPwmData.Tabc.value[1] = PwmDuty;
gPwmData.Tabc.value[2] = -PwmDuty;
gHall_BLDC_Flag_Is_fdb = 1;
break;
}
case 1: // U+/W-
{
PWM_clearOneShotTrip(hal.pwmHandle[PWM_Number_1]);
PWM_setOneShotTrip(hal.pwmHandle[PWM_Number_2]);
PWM_clearOneShotTrip(hal.pwmHandle[PWM_Number_3]);
break;
}
case 1: // U+/W-
{
PWM_clearOneShotTrip(hal.pwmHandle[PWM_Number_1]);
PWM_setOneShotTrip(hal.pwmHandle[PWM_Number_2]);
PWM_clearOneShotTrip(hal.pwmHandle[PWM_Number_3]);
gPwmData.Tabc.value[0] = PwmDuty;
gPwmData.Tabc.value[1] = _IQ(0.0);
gPwmData.Tabc.value[2] = -PwmDuty;
gPwmData.Tabc.value[1] = _IQ(0.0);
gPwmData.Tabc.value[2] = -PwmDuty;
gHall_BLDC_Flag_Is_fdb = 0;
break;
}
break;
}
Annie Liu:
为更加有效地解决您的问题,我们建议您将问题发布在E2E英文技术论坛上https://e2e.ti.com/support/microcontrollers/c2000/f/171,将由资深的工程师为您提供帮助。我们的E2E英文社区有TI专家进行回复,并得到全球各地工程师的支持,分享他们的知识和经验。