:Revision=2
:html
<<
128.128
DAS4020-Object|DAS4020
--
The IP-Object <!RW>DAS4020 enables the access to the DAS4020 High Speed AD card.

The individual hardware modules of the multifunctional card are addressed as sub-objects of the DAS4020-Object.

However, at the moment, only the AD-converter is implemented in the interpreter software.
>>

<<
128.128.3
DAS4020.ADC|ADC
--
Analog inputs
>>

<<
128.128.3.1
DAS4020.ADC.Setup|Setup
--
<!DEF>
procedure <!TW>DAS4020.ADC.Setup (rChannel, rRange : real);
<!TXT>
Determines the characteristic of the AD-channel <!PW>rChannel (0..3).

This range selection is valid only for <!RW>DAS4020.ADC.Get operations. Sample-operations require a separate range specification.

<!STBL>
<!+>rRange<!>Input range<!>
<!c>0<!> 1 V<!>
<!c>1<!> 5 V<!>
<!ETBL>
>>
<<
128.128.3.2
DAS4020.ADC.Get|Get
--
<!DEF>
function <!TW>DAS4020.ADC.Get (rChannel : real [; rAverages : real]) : real;
<!TXT>
Returns the value of the AD-channel <!PW>rChannel (0..3).

If <PW>rAverages (1..1024) is specified, then an average value is calculated based on a corresponding number of separate values.
>>

<<
128.128.3.3
DAS4020.ADC.Sample|Sample
--
<!DEF>
<!TW>DAS4020.ADC.Sample.....
<!TXT>
Sampling - Registration of analog signals
>>
<<
128.128.3.3.1
DAS4020.ADC.Sample.Check|Check
--
<!DEF>
function <!TW>DAS4020.ADC.Sample.Check : real;
<!TXT>
Checks whether the made setup (channels, frequency, number of samples) is correct and the sampling can be started, and / or an already started sampling is still running or is already completed.

<!STBL>
<!+>Value<!+>Meaning<!>
<!c>1<!>Sampling already/still running<!>
<!c>0<!>everything OK, sampling can be started<!>
<!c>-1<!>20MHz sampling rate is not possible with 4 channels<!>
<!c>-2<!>number of samples is 0<!>
<!c>-3<!>sample frequency is too high<!>
<!c>-4<!>too many channels for the frequency<!>
<!c>-5<!>Start was not possible <!>
<!c>-6<!>DAS4020 card not active<!>
<!ETBL>
>>
<<
128.128.3.3.2
DAS4020.ADC.Sample.Setup|Setup
!128.128.3.5
--
<!DEF>
procedure <!TW>DAS4020.ADC.Sample.Setup (rFrequency, rSamples, rTrigger : real [; rTriggerLevel : real]);
<!TXT>
Determines the basic values for the sampling-process.

 <!PW>rFrequency : sampling rate in Hz (not total sampling rate!)
Minimum value : 1000 Hz
Maximum value : 20MHz (1 or 2 channels), 10MHz (4 channels)

 <!PW>rSamples : number of samples per channel
Maximum value 1.000.000 resp. depending on the memory
Memory must be reserved with Instacal!

 <!PW>rTrigger : type of triggering:
<!STBL>
<!>0<!>immediate with ADC.Sample.Start / Scan<!>
<!>1<!>rising edge of the digital trigger input<!>
<!>2<!>falling edge of the digital trigger input<!>
<!>3<!>rising edge of the analog trigger channel<!>
<!>4<!>falling edge of the analog trigger channel<!>
<!ETBL>
The trigger channel must be selected with Instacal or with the <!RW>Trigger.SetChannel command. 

 <!PW>rTriggerLevel:
Threshold value for the trigger modes 3 and 4 (trigger on analog trigger channel). The permitted range is according to the input range   1 or  5  as used with <!RW>ADC.Sample.Start/<!RW>Scan. The trigger level may be specified for every trigger mode, but it is used only for trigger mode 3 and 4.
>>
<<
128.128.3.3.3
DAS4020.ADC.Sample.Start|Start
!128.128.3.3.3 - Scan
--
<!DEF>
procedure <!TW>DAS4020.ADC.Sample.Start (rCurveSet, rChannelFrom, rChannelTo, rRange : real);
<!TXT>
Starts the sampling-process. 

Check first with <!RW>DAS4020.ADC.Sample.Check whether all the parameters for the sampling are valid. 

See also <!RW>DAS4020.ADC.Sample.Scan - another way of sampling.

The sampling runs independently of the interpreter in the background. With <!RW>DAS4020.ADC.Sample.Check it can be checked whether the sampling has been already completed.

 <!PW>rCurveSet indicates the curve set that will receive the samples curves. For the moment it is always 1.

 <!PW>rChannelFrom, <!PW>rChannelTo (je 0..3) specify the first resp. the last sampled channel. If there is only one channel both values are equal.  <!PW>rChannelTo must be greater than or equal to <!PW>rChannelFrom. It is not possible to sample 3 channels!

 <!PW>rRange specifies the input range of the channels. It is not possible to sample, e.g channel 1 with 1V and channel 2 with 5V.
<!STBL>
<!+>rRange<!+>input range<!>
<!c>0<!> 1 V<!>
<!c>1<!> 5 V<!>
<!ETBL>
>>
<<
128.128.3.3.4
DAS4020.ADC.Sample.Stop|Stop
--
<!DEF>
procedure <!TW>DAS4020.ADC.Sample.Stop
<!TXT>
Stops a running sampling-process. 

Already sampled values are not transfered to the curve-set.

<font color=#cc0000>
<h3>Attention!</h3>
If any setup value of the card (trigger channel, input range, sampling channels etc.) has been changed and a sampling was started, it may take up to 4 seconds for the driver to setup the card with the new data. If a <!RW>DAS4020.ADC.Sample.Stop is made in this period the whole PC may crash,  (bluescreen, reboot, loss of data etc.). 
Therefore, we do not recommend the use of the DAS4020 any more. Be carefull to wait at least 5 seconds after the start of a sampling, before you use the Stop command.
</font>
>>

<<
128.128.3.3.5
DAS4020.ADC.Sample.Scan|Scan
!128.128.3.3.3 - Start
--
<!DEF>
procedure <!TW>DAS4020.ADC.Sample.Scan (rCurveSet, rChannelFrom, rChannelTo, rRange : real);
<!TXT>
Starts the sampling-process. 

Check first with DAS4020.ADC.Sample.Check that all parameters for the sampling are valid. 

 <!RW>DAS4020.ADC.Sample.Scan is different from <RW>DAS4020.ADC.Sample.Start in the way the scan time is distributed on the separate channels. If there is only one channel in the channel list, both procedures are identical.

The graphic below represents this in a more clear way. The X on the time line indicates the selected sample interval. When the process is started all the selected channels (here 4) are sampled consecutively as quickly as possible - so, if possible, simultaneously. This means that in case of channels 2-4 the settling time of the multiplexer is very short. In case of Scan, the channels are distributed preferably simultaneously on the sample time. Thus, the cahnnels have the same settling time, but the sampling is shifted.

<!CODE>
Time-> X---------------X---------------X-------------->
Start: 1234------------1234------------1234------------
Scan : 1---2---3---4---1---2---3---4---1---2---3---4---
<!TXT>

The sampling runs independently of the interpreter in the background. With <!RW>DAS4020.ADC.Sample.Check it can be checked whether the sampling has been already completed.

 <!PW>rCurveSet indicates the curve set that will receive the samples curves. For the moment it is always 1.

 <!PW>rChannelFrom, <!PW>rChannelTo (je 0..3) specify the first resp. the last sampled channel. If there is only one channel both values are equal.  <!PW>rChannelTo must be greater than or equal to <!PW>rChannelFrom. It is not possible to sample 3 channels!

 <!PW>rRange specifies the input range of the channels. It is not possible to sample, e.g channel 1 with 1V and channel 2 with 5V.
<!STBL>
<!+>rRange<!+>input range<!>
<!c>0<!> 1 V<!>
<!c>1<!> 5 V<!>
<!ETBL>
>>
<<
128.128.3.5
DAS4020.ADC.Trigger.SetChannel|Trigger.SetChannel
--
<!DEF>
procedure <!TW>DAS4020.ADC.Trigger.SetChannel (rAnalogTriggerChannel : real);
<!TXT>
Sets the analog trigger-channel (0..3) by changing the configuration data file and reloading it. To be used only if really, really necessary!
The DAS4020 driver library proviodes no easy way to change the channel.

The set channel is of interest only for trigger mode 3 (rising edge of the analog trigger channel) and 4 (falling edge of the analog trigger channel).
>>
<<
128.128.6
DAS4020.IsActive|IsActive
--
<!DEF>
function <!TW>DAS4020.IsActive : real;
<!TXT>
Returns <!RW>TRUE, if the DAS4020 is activated and ready for operation.
>>
