User`s manual

PK2100
5-4 s Software Reference
int up_adtest( int channel, int testval )
Returns 1 if external voltage is greater than test value expressed as an
uncalibrated 01023 value. Use up_uncal routine to compute test
value. For example up_adtest(2,up_uncal(2600)) returns 1 if
the Channel 2 input is greater than 2.60 volts.
int up_uncal( int calval )
Returns uncalibrated value 01023 given calibrated value in millivolts,
010,000. This function is used to generate a raw threshold value,
corresponding to a calibrated value, for use with the universal input
channels and the high-gain channel.
up_docal( int calval )
Generates calibrated value 010,000 millivolts given uncalibrated
value 01023. This can be used with up_adrd(channel) when data
are collected in uncalibrated form.
float up_higain( int mode )
Returns a value from the high-gain differential analog input. There are
three modes of operation, all of which assume Jumper H7 is removed.
Mode 1 assumes AD is grounded and returns voltage on AD+ in the
range 01 volts. Mode 2 returns the difference voltage ((AD+)
(AD)). The possible voltage range depends on the common-mode
voltage, varying from 01 volts when AD is at ground, from 0.5 to
+0.5 volts when AD is at -0.5 volts, and from -1to 0 volts when AD
is at -1.0 volt. Mode 3 returns the input voltage on AD+ in the range
010 volts. The function returns the input voltage at AD+ if the output
of the amplifier is out of range.
Virtual Driver for Universal Inputs
The virtual driver assesses the state of universal inputs 16. Each of these
channels has a high and low threshold, and a flag to indicate the relation-
ship of the incoming signal to the thresholds.
The incoming analog signal is compared with the high and low threshold
every tick of the virtual driver (25 milliseconds). For example, the flag
U1IN is set to 1 if the signal on Channel 1 is above the high threshold, and
is set to 0 if the signal is below the low threshold. The flag is not altered
when the signal is in the hysteresis region. In addition, the flag is not
altered unless the new condition that requires the flag to be altered persists
for two clock ticks (2550milliseconds). A program such as the one in
the following example can set the thresholds to any desired level and then
check the associated flag.