#include "IQmathLib.h" // Include header for IQmath library
// Don't forget to set a proper GLOBAL_Q in "IQmathLib.h" file
#include "vhzprof.h"
#include <stdlib.h>
void vhz_prof_calc(VHZPROF *v)
{
_iq VfSlope, AbsFreq;
// Take absolute frequency to allow the operation of both rotational directions
AbsFreq = labs(v->Freq);
if (AbsFreq <= v->LowFreq)
// Compute output voltage in profile #1
v->VoltOut = v->VoltMin;
else if ((AbsFreq > v->LowFreq)&(AbsFreq <= v->HighFreq))
{
// Compute slope of V/f profile
VfSlope = _IQdiv((v->VoltMax - v->VoltMin),(v->HighFreq - v->LowFreq));
// Compute output voltage in profile #2
v->VoltOut = v->VoltMin + _IQmpy(VfSlope,(AbsFreq-v->LowFreq));
}
else if ((AbsFreq > v->HighFreq)&(AbsFreq < v->FreqMax))
// Compute output voltage in profile #3
v->VoltOut = v->VoltMax;
}
请问高手,以上代码是干什么用的?谢谢!