/* -------------------------- (C) COPYRIGHT 2020 Fortiortech ShenZhen…
- User
/* -------------------------- (C) COPYRIGHT 2020 Fortiortech ShenZhen ---------------------------/ / File Name : SpeedControl.c /* Author : Fortiortech Appliction Team /* Version : V1.0 /* Date : 2020-03-24 /* Description : This file contains speed-control function used for Motor Control. /* ----------------------------------------------------------------------------------------------/ / All Rights Reserved /* ----------------------------------------------------------------------------------------------*/
/* Includes ----------------------------------------------------------------------------*/ #include <Myproject.h>
/* Private variables -------------------------------------------------------------------*/
MCRAMP xdata MotorSpeed; uint16 xdata VSP;
/* ------------------------------------------------------------------------------------------------- Function Name : HW_One_PI Description : PI控制函数 Date : 2020-09-22 Parameter : Xn1: [输入/出] ------------------------------------------------------------------------------------------------- / int16 HW_One_PI(int16 Xn1) { PI_EK = Xn1; / filling-in Err / SetBit(PI_CR, PISTA); / Start PI Module */ nop(); nop(); nop(); nop(); return PI_UK; }
/---------------------------------------------------------------------------/ /* Name : void VSPSample(void) /* Input : NO /* Output : NO /* Description: 电位器调速 /---------------------------------------------------------------------------/ void VSPSample(void) { if(VSP >= ON_Duty) //电机开机 { MotorSpeed.FlagONOFF = 1; } else //电机停机 { MotorSpeed.FlagONOFF = 0; }
if(MotorSpeed.FlagONOFF == 1) { if(VSP > MAX_Duty) //最大转速运行 { MotorSpeed.BLDC_Value = MAX_BLDC_Duty; } else if(VSP > MIN_Duty) //调速 { Muilt_H_MDU(VSP-MIN_Duty , BLDC_K, MotorSpeed.TargetValue); MotorSpeed.BLDC_Value = MIN_BLDC_Duty + MotorSpeed.TargetValue; } else //最小转速运行 { MotorSpeed.BLDC_Value = MIN_BLDC_Duty; } } else { MotorSpeed.BLDC_Value = 0; }}
请将上述代码的中文注释翻译为英文
- Assistant
- User
/* -------------------------- (C) COPYRIGHT 2020 Fortiortech ShenZhen ---------------------------*/ /* File Name : SpeedControl.c /* Author : Fortiortech Appliction Team /* Version : V1.0 /* Date : 2020-03-24 /* Description : This file contains speed-control function used for Motor Control. /* ----------------------------------------------------------------------------------------------*/ /* All Rights Reserved /* ----------------------------------------------------------------------------------------------*/ /* Includes ----------------------------------------------------------------------------*/ #include <Myproject.h> /* Private variables -------------------------------------------------------------------*/ MCRAMP xdata MotorSpeed; uint16 xdata VSP; /* ------------------------------------------------------------------------------------------------- Function Name : HW_One_PI Description : PI控制函数 Date : 2020-09-22 Parameter : Xn1: [输入/出] ------------------------------------------------------------------------------------------------- */ int16 HW_One_PI(int16 Xn1) { PI_EK = Xn1; /* filling-in Err */ SetBit(PI_CR, PISTA); /* Start PI Module */ _nop_(); _nop_(); _nop_(); _nop_(); return PI_UK; } /*---------------------------------------------------------------------------*/ /* Name : void VSPSample(void) /* Input : NO /* Output : NO /* Description: 电位器调速 /*---------------------------------------------------------------------------*/ void VSPSample(void) { if(VSP >= ON_Duty) //电机开机 { MotorSpeed.FlagONOFF = 1; } else //电机停机 { MotorSpeed.FlagONOFF = 0; } if(MotorSpeed.FlagONOFF == 1) { if(VSP > MAX_Duty) //最大转速运行 { MotorSpeed.BLDC_Value = MAX_BLDC_Duty; } else if(VSP > MIN_Duty) //调速 { Muilt_H_MDU(VSP-MIN_Duty , BLDC_K, MotorSpeed.TargetValue); MotorSpeed.BLDC_Value = MIN_BLDC_Duty + MotorSpeed.TargetValue; } else //最小转速运行 { MotorSpeed.BLDC_Value = MIN_BLDC_Duty; } } else { MotorSpeed.BLDC_Value = 0; } } - Assistant