August
2005, Issue 181
Test Your EQ
Each
month, Test Your EQ presents some basic engineering
problems for you to test your Engineering Quotient.
What's your EQ?
|
Problem
1—What
sort of filter is this? What applications is it good for?
int
filter (int sample)
{
static int previous;
if (abs(sample - previous) > 1) previous =
sample;
return previous;
}
Answer
Problem
2What sort of filter is this?
int
filter (int sample)
{
static int previous;
previous = (previous >> 2) + (sample >>
2);
return previous;
}
Answer
Problem 3What is a median-value filter? For what
sort of applications is it well suited?
Answer
Problem
4Write a C preprocessor macro that produces a
mask for a bit field, given the numbers of the leftmost
and rightmost bits in the field. In other words, FIELD_MASK(7,4)
should produce the value 0x00F0.
Answer
Previous Month
|