求高手指点该程序,是什么功能,意思。新手。谢谢。
时间:10-02
整理:3721RD
点击:
short Max11046DataAvr(int16 data[],uint8 length,uint16 zero_channel)
{
uint8 i,j,len;
short temp_val,min_index;
int32 sum_val;
int16 AD_val;
int16 data_tmp[SAMP_COUNT_ALL]; //120
len = length;
for (i=0; i<len; i++)
{
data_tmp = data;
}
for (i=0; i<len-1; i++)
{
min_index = i;
for (j=i+1; j<len; j++)
{
if (data_tmp[j]<data_tmp[min_index])
{
min_index = j;
}
}
if(min_index != i)
{
temp_val = data_tmp;
data_tmp = data_tmp[min_index];
data_tmp[min_index] = temp_val;
}
}
sum_val = 0;
for (i=(len-COUNTSAMPINDEX)/2; i<(len+COUNTSAMPINDEX)/2; i++)
{
if (data_tmp>=zero_channel)
{
data_tmp = data_tmp - zero_channel;
sum_val += data_tmp;
}
else
{
data_tmp = zero_channel - data_tmp;
sum_val -= data_tmp;
}
}
AD_val = sum_val / COUNTSAMPINDEX;
return AD_val;
}
{
uint8 i,j,len;
short temp_val,min_index;
int32 sum_val;
int16 AD_val;
int16 data_tmp[SAMP_COUNT_ALL]; //120
len = length;
for (i=0; i<len; i++)
{
data_tmp = data;
}
for (i=0; i<len-1; i++)
{
min_index = i;
for (j=i+1; j<len; j++)
{
if (data_tmp[j]<data_tmp[min_index])
{
min_index = j;
}
}
if(min_index != i)
{
temp_val = data_tmp;
data_tmp = data_tmp[min_index];
data_tmp[min_index] = temp_val;
}
}
sum_val = 0;
for (i=(len-COUNTSAMPINDEX)/2; i<(len+COUNTSAMPINDEX)/2; i++)
{
if (data_tmp>=zero_channel)
{
data_tmp = data_tmp - zero_channel;
sum_val += data_tmp;
}
else
{
data_tmp = zero_channel - data_tmp;
sum_val -= data_tmp;
}
}
AD_val = sum_val / COUNTSAMPINDEX;
return AD_val;
}
你这问的太宽泛了 你可以指出你不懂的一部分拿出来问
谢谢,还是看不懂这个程序的意思
谢谢,还是看不懂这个程序的意思