请问是否有函数库或者直接调用函数,对DSP28335计算均方根值,或者能提供对应C的算法
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
没有这个函数,只有平方根的。你可以自己编程实现,就是复制一点,,涉及①平方②求和③均分④开方。
我找了一下,在controlSUITE\development_kits\HV_SOLAR_DC_AC_v1.1\SolarHv_DCAC_PiccoloB_Rev_02的SolarHv_DCAC-main.c内有相关的计算函数,您可以参考一下
/*------------------------------------------------------------------------
* Function Name: sRMSCal
* Description: Calculate the RMS value of the AC sample
* Parameter: dwSum --- The squre sum of the AC sample
* dwRatio -- Q24 * dwRatio = Real value
* wFormat -- The float point
* -----------------------------------------------------------------------*/
int16 sRMSCal(long dwSum,long dwRatio,int wFormat)
{
_iq24 sqrt_in,sqrt_out;
long dwTemp;
int16 wTemp;
sqrt_in = (long)(dwSum/wSumCnt);
sqrt_out = _IQ24sqrt(sqrt_in);
dwTemp = _IQ7mpyIQX(sqrt_out,24,dwRatio,18);
wTemp = (int16)((long)dwTemp*wFormat>>7);
return wTemp;
}