User`s manual

PK2100
Software Reference s 5-5
This relationship is shown in Figure 5-1 for Channel 1.
U1HIGH = up_uncal( 8000 );
U1LOW = up_uncal( 7900 );
U1IN = up_adrd (1) > U1LOW; // get immediate
// value of U1
while(1) OUT2=U1IN; // output 2 enabled whenever
// U1 is greater than 800 mV
Note that the thresholds are expressed as raw (uncalibrated) values. This
saves computation time in the interrupt routine. Use the routine
up_uncal to compute the raw values from the desired calibrated values.
Figure 5-1. Universal Input Hysteresis
1
U1HIGH
0
U1LOW
INPUT
OUTPUT
Analog Output
Analog output consists of the DAC output channel, which can be set up as
either a current or a voltage output. There is also an option for the UEXP
output to be used as a voltage DAC output if the universal input is
configured as a digital-only input. Only direct drivers are available for
analog output.
Direct Driver
void up_daccal ( int value )
Sends a calibrated value to the DAC output channel. A calibrated
voltage is a value expressed in millivolts. (10,000 for 10 volts).
void up_dacout ( int rawval )
Sends a raw value to the DAC output channel. Each count represents
an increment of 0.01 volts over the count range 01023.