Assume that the data is read from an 8-bit analog-to-digital (AD) converter, and if a higher-order AD can define the data type as integer, the function used to retrieve the data is called get_ad();
1. Limited Secondary Filtering
2. Median Value Filtering Method
/* N value can be adjusted based on actual requirements */
/* Sorting using bubble sort method */
#define N 11
char filter()
{
char value_buf[N];
char count, i, j, temp;
for (count = 0; count < N; count++)
{
value_buf[count] = get_ad();
Delay();
}
for (j = 0; j < N - 1; j++)
{
for (i = 0; i < N - j - 1; i++)
{
if (value_buf[i] > value_buf[i + 1])
{
temp = value_buf[i];
value_buf[i] = value_buf[i + 1];
value_buf[i + 1] = temp;
}
}
}
return value_buf[(N - 1) / 2];
}
3. Arithmetic Average Filtering Method
4. Recursive Average Filtering Method (Also Known as Sliding Average Filtering Method)
5. Median Average Filtering Method (Also Known as Anti-Pulse Interference Average Filtering Method)
/* This method combines median and average techniques to reduce noise and pulse interference */
#define N 12
char filter()
{
char count, i, j;
char value_buf[N];
int sum = 0;
for (count = 0; count < N; count++)
{
value_buf[count] = get_ad();
Delay();
}
for (j = 0; j < N - 1; j++)
{
for (i = 0; i < N - j - 1; i++)
{
if (value_buf[i] > value_buf[i + 1])
{
char temp = value_buf[i];
value_buf[i] = value_buf[i + 1];
value_buf[i + 1] = temp;
}
}
}
for (count = 1; count < N - 1; count++)
{
sum += value_buf[count];
}
return (char)(sum / (N - 2));
}
Portable Monitor Holder For Laptop,Adjustable Portable Laptop Holder,Adjustable Ergonomic Portable Aluminum Laptop Holder,Foldable Portable Desktop Laptop Holder,etc.
Shenzhen Chengrong Technology Co.ltd is a high-quality enterprise specializing in metal stamping and CNC production for 12 years. The company mainly aims at the R&D, production and sales of Notebook Laptop Stands and Mobile Phone Stands. From the mold design and processing to machining and product surface oxidation, spraying treatment etc ,integration can fully meet the various processing needs of customers. Have a complete and scientific quality management system, strength and product quality are recognized and trusted by the industry, to meet changing economic and social needs .
Portable Monitor Holder For Laptop,Adjustable Portable Laptop Holder,Adjustable Ergonomic Portable Aluminum Laptop Holder,Foldable Portable Desktop Laptop Holder
Shenzhen ChengRong Technology Co.,Ltd. , https://www.laptopstandsupplier.com