beautypg.com

5 sensor acquisition functions – Sensoray 2518 User Manual

Page 21

background image

Sensoray Model 2518/2519 Ethernet Smart A/D™

18

Programming

your application, you need not execute this function at
all.

Any attempt to declare an unsupported sensor type will
result in selection of the default sensor type.

Declaring a sensor type as “Disabled” inhibits scanning
of the corresponding channel, resulting in increased
throughput for all remaining active channels.

See “Sensor Specifications” on page 27 for a complete
list of supported sensor types. Refer to the API
documentation on the distribution diskette for a list of
sensor definition codes.

6.4.2 SetFilter()

Establishes a digital single-pole low-pass filter for the
specified channel. Filter weighting is specified by the
FilterConst

parameter, which may have any value

from 0 to 255. The relationship between FilterConst
and filter percentage is:

For example, a FilterConst value of 0x40 (64
decimal) results in a 25% filter. This means that the
sensor data value made available to the client is the sum
of 75% of the newest unfiltered value plus 25% of the
previous filtered value.

All filter constants default to zero upon board reset. This
value disables the filters, thereby maximizing the
frequency response of all channels.

A non-zero filter constant will roll off the channel
frequency response. Since the filter is implemented in
the digital domain, noise frequencies at or above nyquist
must be pre-filtered before arriving at the Smart A/D™.

Some applications require known filter time constants.
In such systems, you may use the following expression to
calculate the time constant (in seconds) as a function of
FilterConst

:

In the above expression NumActiveChans is the
number of channels in the scan loop (all channels that
have not been disabled), and ChanSlotTime is the
channel slot time, as described in Section 9.2.

It may not be practical to compute exact filter constants
in cases where the application doesn’t require a known
time constant. In such cases, you will probably find that
it is more effective to find the best filter weighting by
experimenting with different filter constants.

6.4.3 SetFailMode()

Specifies whether, in the event an open sensor is
detected, the sensor data value should default to a large
positive value (fail high) or a large negative value (fail
low).

The ChannelNumber argument designates the sensor
channel to be affected, while the boolean FailHigh
specifies whether the channel should fail high or low.

This function is useful for triggering alarms when open
sensors are detected, and for forcing the desired system
response to sensor fault conditions in closed-loop control
applications.

After a board reset, all channels are, by default,
programmed to fail high.

6.5 Sensor Acquisition Functions

6.5.1 GetAmbientTemp()

Returns the reference temperature, in degrees Centigrade,
from an optional Sensoray termination board.

This is useful for monitoring thermocouple reference
junctions and can also serve as a debugging aid during
Smart A/D™ installation and application development.

This function returns an indeterminate value if no
Sensoray termination board is connected to the Smart
A/D™.

Arguments:

ChannelNumber

FilterConst

Returns:

void

FilterPercentage

FilterConst

256

-------------------------------

=

τ

1.06

(

)

NumActiveChans

(

)

ChanSlotTime

(

)

FilterConst 256

(

)

ln

-----------------------------------------------------------------------------------------------------------------

Arguments:

ChannelNumber

FailHigh

Returns:

void

Arguments:

void

Returns:

Temperature

This manual is related to the following products: