:Revision=2
:html
<<
128.136
ExacqDA-Object|ExacqDA
--
The IP object <!RW>ExacqDA gives access to an Exacq high speed data acquisition card.
>>

<<
128.136.3
ExacqDA.ADC|ADC
--
Analoge Inputs
>>

<<
128.136.3.1
ExacqDA.ADC.Setup|Setup
--
<!DEF>
procedure <!TW>ExacqDA.ADC.Setup (rChannel, rRange : real [, rCoupling : real]);
<!TXT>
Selects the characteristic of ADC channel <!PW>rChannel (0..15).

 <!PW>rRange :
<!STBL>
<!+>Nr.<!+>Range<!+>
<!c>-1<!>don't change range<!>
<!c>0<!> 50 mV<!>
<!c>1<!> 100 mV<!>    
<!c>2<!> 200 mV<!>    
<!c>3<!> 500 mV<!>
<!c>4<!> 1 V<!>
<!c>5<!> 2 V<!>
<!c>6<!> 5 V<!>
<!ETBL>

 <!PW>rCoupling:
<!STBL>
<!+>Value</b><!><b>Meaning</b><!>
<!c>-1<!>don't change coupling<!>
<!c>0<!>DC coupled<!>
<!c>1<!>AC coupled<!>
<!c>2<!>DC coupled and terminated<!>
<!ETBL>

>>
<<
128.136.3.2
ExacqDA.ADC.Get|Get
--
<!DEF>
function <!TW>ExacqDA.ADC.Get (rChannel : real [; rAverages : real]);
<!TXT>
Reads a value from ADC channel <!PW>rChannel (0..1).

If <!PW>rAverages (1..1024) is given, the result is the average of <!PW>rAverages single measurements.
>>

<<
128.136.3.3
ExacqDA.ADC.Sample|Sample
--
Sampling of analoge signals
>>
<<
128.136.3.3.1
ExacqDA.ADC.Sample.Check|Check
--
<!DEF>
function <!TW>ExacqDA.ADC.Sample.Check : real;
<!TXT>
Check, if the setup (channels, frequency, number o samples) are correct and allow the start of the sampling, resp. if a started sampling is still running or has finished.

Return values:
<!STBL>
<!+>Value</b><!><b>Meaning</b><!>
<!c> 1<!>Sampling already/still running<!>
<!c> 0<!>no error, start of sampling possible resp. sampling has finished<!>
<!c>-1<!>no channel in channel list<!>
<!c>-2<!>number of samples is 0<!>
<!c>-3<!>invalid trigger threshold<!>
<!c>-4<!>not enough memory<!>
<!c>-5<!>can't start sampling<!>
<!c>-6<!>ExacqDA card is not active<!>
<!c>-7<!>sampling frequency to high for one channel<!>
<!c>-8<!>sampling frequency to high for two channels<!>
<!c>-9<!>sampling frequency to low<!>
<!ETBL>
>>
<<
128.136.3.3.2
ExacqDA.ADC.Sample.Setup|Setup
--
<!DEF>
procedure <!TW>ExacqDA.ADC.Sample.Setup (rFrequency, rSamples, rTrigger : real [; rLevel : real]);
<!TXT>
Defines the parameter of sampling.

 <!PW>rFrequency : channel sampling frequency in Hz (not the sum rate!)
  Minimal 10000 Hz (10 kHz)
  Maximal for one channel  : 25000000 Hz (25 MHz)
  Maximal for two channels : 20000000 Hz (20 MHz)

 <!PW>rSamples : number of samples per channel
  Maximal 2.048.000 (if memory allows). The number of samples is rounded up to the next multiple of 2048. (Cards needs it this way)

 <!PW>rTrigger selects the trigger mode
<!STBL>
<!+>Value</b><!><b>Meaning</b><!>
<!c> 0<!>immeditely with <!RW>ADC.Sample.Start (no trigger signal)<!>
<!c> 1<!>falling edge on selected channel<!>
<!c> 2<!>rising edge on selected channel<!>
<!ETBL>

 <!PW>rLevel defined the trigger threshold: -4V .. 4V.

The trigger channel is defined with <!RW>ExacqDA.ADC.Trigger.SetChannel 
>>
<<
128.136.3.3.3
ExacqDA.ADC.Sample.Start|Start
--
<!DEF>
procedure <!TW>ExacqDA.ADC.Sample.Start (rCurveSet : real);
<!TXT>
Starts the sampling.
Check with <a href="128.136.3.3.1">ExacqDA.ADC.Sample.Check</a>, that all parameters are valid.

Sampling is done in the background. Use <!RW>ExacqDA.ADC.Sample.Check to check if the sampling is finished.

 <!PW>rCurveSet selects the curve set that will get the data. Has to be 1 at the moment.
>>

<<
128.136.3.3.4
ExacqDA.ADC.Sample.Stop|Stop
--
<!DEF>
procedure <!TW>ExacqDA.ADC.Sample.Stop;
<!TXT>
Aborts a running sampling.

Is especially necessary, when the sampling is waiting for a trigger event that would never happen.
>>

<<
128.136.3.4
ExacqDA.ADC.List|List
--
List - Manages a list aof channels to be sampled.
>>
<<
128.136.3.4.1
ExacqDA.ADC.List.Clear|Clear
--
<!DEF>
procedure <!TW>ExacqDA.ADC.List.Clear;
<!TXT>
Clear the list of channels to be sampled (remove all entries).
>>
<<
128.136.3.4.2
ExacqDA.ADC.List.Add|Add
--
<!DEF>
procedure <!TW>ExacqDA.ADC.List.Add (rChannel : real);
<!TXT>
Add channel <!PW>rChannel (0..1) to the list of channels that will be sampled.
If the channel is already in the list, nothing happens.
>>

<<
128.136.3.5
ExacqDA.ADC.Trigger.SetChannel|Trigger.SetChannel
--
<!DEF>
procedure <!TW>ExacqDA.ADC.Trigger.SetChannel (rChannel : real);
<!TXT>
 <!PW>rChannel is the trigger channel

Select from:
<!STBL>
<!+>Value</b><!><b>Meaning</b><!>
<!c> 0<!>Analog channel 0<!>
<!c> 1<!>Analog channel 1<!>
<!c> 2<!>External trigger input<!>
<!ETBL>

This selection is only used, when <!RW>ExacqDA.Sample.Start does not select the internal trigger.
>>

<<
128.136.6
ExacqDA.IsActive|IsActive
--
<!DEF>
function <!TW>ExacqDA.IsActive : real;
<!TXT>
Returns <!RW>TRUE, if the ExacqDA card is active and ready.
>>

<<
128.136.7
ExacqDA Kalibration|Kalibration
--
Every combination of channel range and coupling can be calibrated.
The calibration data is managed by the Calibration IP object.
>>

<<
128.136.7.1
ExacqDA Kalibration AD-Wandler|ADWs
!128.138
--
The software calibration of an ADC is based on two values:

<ul indent="15">
<li><b>Offset</b><br>
Value returned by an uncalibrated channel, if the input voltage is 0V<br>
</li>
<li><b>Gain</b><br>
Relation between the Voltage on the input of an ADC and the value retuned by this ADC (offset corrected)
</li></ul>

For the calculation of the voltage displayed for an ADC the following formula is used:
<!STBL>
<!>U<sub>display</sub> = (U<sub>ADC</sub> - <!RW>Offset) * <!RW>Gain<!>
<!ETBL>

How to do the calibraton
<!STBL>
<!>1.<!>Reset calibration values<!><!RW>Calibration.Set <tt>('ExacqDA', 'ADC.Offset.DC.0', rChannel, 0);</tt><br>^
                                         <!RW>Calibration.Set <tt>('ExacqDA', 'ADC.Gain.DC.0', &nbsp;&nbsp;rChannel, 1);</tt><!>
<!>2.<!>Supply 0V on the input<!>&nbsp;<!>
<!>3.<!>Read offset value of the ADC<!><tt>rOffset:=</tt><!RW>ExacqDA.ADC.Get<tt> (rChannel, 1024);</tt><!>
<!>4.<!>Set offset value<!><!RW>Calibration.Set <tt>('ExacqDA', 'ADC.Offset.DC.0', rChannel, rOffset);</tt><!>
<!>5.<!>Supply voltage close to the end of the input range<!><tt>rSoll:=0.045;&nbsp;&nbsp;&nbsp;// Example</tt><!>
<!>6.<!>Read ADC value<!><tt>rMeas:=</tt><!RW>ExacqDA.ADC.Get<tt> (rChannel, 1024);</tt><!>
<!>7.<!>Calculate and set gain<!><!RW>Calibration.Set <tt>('ExacqDA', 'ADC.Gain.DC.0', &nbsp;&nbsp;rChannel, rSoll/rMeas);</tt><!>
<!ETBL> 

The ValueNames for the commands <!RW>Calibration.Set and <!RW>Calibration.Get have the following structure:
<!CODE>
<b>ADC</b>.&lt;<i>Type</i>&gt;.&lt;<i>Coupling</i>&gt;.&lt;<i>Range</i>&gt;
<!TXT>

&lt;<i>Type</i>&gt; can be: <b>OFFSET</b> or <b>GAIN</b>,
&lt;<i>Coupling</i>&gt; can be: <b>DC</b>, <b>AC</b> or <b>TERM</b>
&lt;<i>Range</i>&gt; is the input range
<!STBL>
<!+>Range<!+>Input Range<!+>
<!c>0<!> 50 mV<!>
<!c>1<!> 100 mV<!>    
<!c>2<!> 200 mV<!>    
<!c>3<!> 500 mV<!>
<!c>4<!> 1 V<!>
<!c>5<!> 2 V<!>
<!c>6<!> 5 V<!>
<!ETBL>
>>

