Setfilter – Sensoray 118 User Manual
Page 22

Sensoray Model 118 Smart A/D™ Instruction Manual
20
Commands: Channel Configuration
6.2.3 SetFilter
Establishes a software single-pole low-pass filter for the
specified channel. The second command byte specifies a
filter factor, F, which may have any value from 0 to 255,
inclusive. The approximate relationship between F and
filter percentage, P, is:
All filter constants default to zero after a reset. This
effectively disables the software filters, thereby
maximizing the frequency response of all channels.
Applying a non-zero factor in electrically noisy
environments may help to reduce measurement noise.
Rather than computing the theoretical value of filter
constants, we recommend that you experiment with
different filter constants to find the best
response-time/noise-immunity tradeoff point.
Some applications require the use of a specific filter time
constant value. This function describes the relationship
between time constant and filter factor:
where:
t is the time constant in seconds
F is the filter factor in the range 0 to 255
N is the number of active channels.
Driver
// Set the filter factor for the specified channel.
VOID SetFilter( USHORT BasePort, UCHAR Channel, UCHAR FiltFactor )
{
SendByte( BasePort, Channel | CMD_SET_FILT ); // send channel & opcode
SendByte( BasePort, FiltFactor ); // send filter factor
}
Example
// Set up channel 4 with a 12.5 percent low-pass filter.
SetFilter( MyBasePort, 4, (UCHAR)( 12.5 * 2.55 ) );
Command: (96 + Chan),(FilterFactor)
Response:
None
P
2.55
F
×
=
t
N
–
45ln
F
256
---------
--------------------------
=