:Revision=1
:html
<<
128.157
ME4000-Object|ME4000
--
The IP-Object ME4000 enables the access to the ME4000-Multifunction-IO-card

The hardware parts of the Multifunction card are addressed as sub-objects of the ME4000-Object.
>>

<<
128.157.1
ME4000.DIn|DIn
--
Digital inputs.

The 16 digital inputs are treated by the program as one 16 bit port, although they are spread in two 8 bit ports on the ME4000 card.

<!STBL>
<!+>Internal<br>Bit No.<!+>ME4000<br>Port<!+>Function<!>
<!+>15<!>DIO_B7<!>Alarm input<!>
<!+>14<!>DIO_B6<!>Backchannel UMS<!>
<!+>13<!>DIO_B5<!>IC 1 SDA In<!>
<!+>12<!>DIO_B4<!>IC 2 SDA In<!>
<!+>11<!>DIO_B3<!>DIN Bit 11<!>
<!+>10<!>DIO_B2<!>DIN Bit 10<!>
<!+>9<!>DIO_B1<!>DIN Bit 9<!>
<!+>8<!>DIO_B0<!>DIN Bit 8<!>
<!+>7<!>DIO_D7<!>DIN Bit 7<!>
<!+>6<!>DIO_D6<!>DIN Bit 6<!>
<!+>5<!>DIO_D5<!>DIN Bit 5<!>
<!+>4<!>DIO_D4<!>DIN Bit 4<!>
<!+>3<!>DIO_D3<!>DIN Bit 3<!>
<!+>2<!>DIO_D2<!>DIN Bit 2<!>
<!+>1<!>DIO_D1<!>DIN Bit 1<!>
<!+>0<!>DIO_D0<!>DIN Bit 0<!>
<!ETBL>

Of the 16 digital inputs, the lower 12 can be used freely, the upper 4 are used by the system and masked out.
>>
<<
128.157.1.1
ME4000.DIN.Get|Get
--
<!DEF>
function <!TW>ME4000.DIN.Get : real;
<!TXT>
Returns the bit pattern of the digital input of the ME4000 card.
The upper 4 bits used internally are masked out.
>>
<<
128.157.1.2
ME4000.DIN.MeasLowTime|MeasLowTime
--
<!DEF>
function <!TW>ME4000.DIN.MeasLowTime (rBit, rTimeout : real) : real;
<!TXT>
Determines the length of a LOW-Phase of an input signal at the digital input <!PW>rBit (0..11).

The time is returned in milliseconds. 

If the expected HIGH/LOW- and / or LOW/HIGH-transfers are not found (e.g. because there is no input signal), the measurement is aborted after <!PW>rTimeout milliseconds, and -1 is returned as result.
>>
<<
128.157.1.3
ME4000.DIN.MeasHighTime|MeasHighTime
--
<!DEF>
function <!TW>ME4000.DIN.MeasHighTime (rBit, rTimeout : real) : real;
<!TXT>
Determines the length of a HIGH-Phase of the input signal at the digital input <!PW>rBit (0..11).

The time is returned in milliseconds. 

If the expected HIGH/LOW- and / or LOW/HIGH-transfers are not found (e.g. because there is no input signal), the measurement is aborted after <!PW>rTimeout milliseconds, and -1 is returned as result.
>>
<<
128.157.1.4
ME4000.DIN.MeasLowHighTime|MeasLowHighTime
--
<!DEF>
function <!TW>ME4000.DIN.MeasLowHighTime (rBit, rTimeout : real [; rPeriods : real]) : real;
<!TXT>
Determines the length of an input signal period at the digital input <!PW>rBit (0..11), averaged over <!PW>rPeriods (Default=1).

The time is returned in milliseconds. 

If the expected HIGH/LOW- and / or LOW/HIGH-transfers are not found (e.g. because there is no input signal), the measurement is aborted after <!PW>rTimeout milliseconds, and -1 is returned as result.
>>

<<
128.157.2
ME4000.DOut|DOut
--
Digital outputs. 

The 16 digital outputs are treated by the program as one 16 bit port, although they are spread in two 8 bit ports on the ME4000 card.

Out of the existing 16 digital outputs only the lower 8 can be used freely. The upper 8 bits used internally are masked out.

<!STBL>
<!+>Internal<br>Bit No.<!+>ME4000<br>Port<!+>Function<!>
<!+>15<!>DIO_A7<!>UMS adress A4<!>
<!+>14<!>DIO_A6<!>UMS address A3<!>
<!+>13<!>DIO_A5<!>UMS address A2<!>
<!+>12<!>DIO_A4<!>UMS address A1<!>
<!+>11<!>DIO_A3<!>UMS address A0<!>
<!+>10<!>DIO_A2<!>UMS data latch enable<!>
<!+>9<!>DIO_A1<!>UMS clock<!>
<!+>8<!>DIO_A0<!>UMS data<!>
<!+>7<!>DIO_C7<!>DOUT Bit 7<!>
<!+>6<!>DIO_C6<!>DOUT Bit 6<!>
<!+>5<!>DIO_C5<!>DOUT Bit 5<!>
<!+>4<!>DIO_C4<!>DOUT Bit 4<!>
<!+>3<!>DIO_C3<!>DOUT Bit 3<!>
<!+>2<!>DIO_C2<!>DOUT Bit 2<!>
<!+>1<!>DIO_C1<!>DOUT Bit 1<!>
<!+>0<!>DIO_C0<!>DOUT Bit 0<!>
<!ETBL>

>>

<<
128.157.2.1
ME4000.DOUT.Get|Get
--
<!DEF>
function <!TW>ME4000.DOUT.Get : real;
<!TXT>
Returns the bit pattern of the digital outputs of the ME4000 card.

The internally used upper 8 bits are masked out.
>>

<<
128.157.2.2
ME4000.DOut.Bits|Bits
--
<!DEF>
procedure <!TW>ME4000.DOUT.BITS (rBitPattern, rOperation : real);
<!TXT>
The bits returned in the <!PW>rBitPattern are combined, as specified in the <!PW>rOperation, with the digital outputs of the ME4000 card.

 <!PW>rOperation can be : <!RW>CLR | <!RW>SET | <!RW>FLIP | <!RW>NOP or 0..3

Only the lower 8 bits of <!PW>rBitPattern are used.
>>
<<
128.157.2.3
ME4000.DOut.Word|Word
--
<!DEF>
procedure <!TW>ME4000.DOut.WORD (rBitPattern : real);
<!TXT>
The digital outputs of the ME4000 card are set to the <!PW>rBitPattern.

Only the lower 8 bits of <!PW>rBitPattern are used.
>>
<<
128.157.3
ME4000.ADC|ADC
--
Analog inputs
>>

<<
128.157.3.1
ME4000.ADC.Setup|Setup
--
<!DEF>
procedure <!TW>ME4000.ADC.Setup (rChannel, rRange, rSingleDiff : real);
<!TXT>
Defines the characteristics of the AD-channel <!PW>rChannel (0..31).

 <!PW>rRange :
<!STBL>
<!+>Nr.<!+>Range<!+>
<!+>0<!> 10 V<!>
<!+>1<!> 2.5 V<!>    
<!+>2<!>0..10 V<!>
<!+>3<!>0..2.5 V<!>
<!ETBL>


 <!PW>rSingleDiff:
<!STBL>
<!+>Value<!+>Meaning<!>
<!c><!RW>false<!>single-ended<!>
<!c><!RW>true<!>differential<!>
<!ETBL>

Attention:
The <!SW>differential mode is only possible for the lower 16 channels. The corresponding channel 16 higher will be the negative input to the selected channel. E.g. Channel 21 (=5+16) will be the negative input if channel 5 is switched in the differential mode.
For <!SW>differential mode, one of the bipolar input ranges has to be selected ( 10V or  2.5V).

<!STBL>
<!>Channel<!>Mode<!>possible ranges<!>
<tr><td rowspan=2 align=center ><b>0<br>:<br>15</b><!>single-ended<!> 10 V<br> 2.5 V<br>0..10 V<br>0..2.5 V<!>
<!>differential<!> 10 V<br> 2.5 V<!>
<tr><td rowspan=2 align=center ><b>16<br>:<br>31</b><!>single-ended<!> 10 V<br> 2.5 V<br>0..10 V<br>0..2.5 V<!>
<!>differential<!><font color=#ff0000>not allowed!<font><!>
<!ETBL>
>>
<<
128.157.3.2
ME4000.ADC.Get|Get
--
<!DEF>
function <!TW>ME4000.ADC.Get (rChannel : real [; rAverages : real]);
<!TXT>
Returns the value of the AD-channel <!PW>rChannel (0..31). 

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

<<
128.157.3.3
ME4000.ADC.Sample|Sample
--
Sampling - recording of analog signals
>>
<<
128.157.3.3.1
ME4000.ADC.Sample.Check|Check
--
<!DEF>
function <!TW>ME4000.ADC.Sample.Check : real;
<!TXT>
Check whether the sampling can be started with the made setup (channels, frequency, number of samples) resp. an already started sampling is still running or has already ended.

Result:
<!STBL>
<!+>Value<!+>Meaning<!>
<!c>1<!>Sampling already / still running<!>
<!c>0<!>averything OK, sampling can be started<!>
<!c>-1<!>no channel in the channel list<!>
<!c>-2<!>Sample frequency too high<!>
<!c>-3<!>too many channels for the frequency<!>
<!c>-4<!>number of samples is 0<!>
<!c>-5<!>the memory is not enough<!>
<!c>-6<!>start was not possible<!>
<!c>-7<!>ME4000 card not active<!>
<!c>-8<!>Single-Ended and Differential channels have been mixed<!>
<!ETBL>
>>
<<
128.157.3.3.2
ME4000.ADC.Sample.Setup|Setup
--
<!DEF>
procedure <!TW>ME4000.ADC.Sample.Setup (rFrequency, rSamples, rTrigger : real);
<!TXT>
Defines the parameters for the sampling process.

 <!PW>rFrequency : sampling rate in Hz (not total sampling rate !)
Maximum value depends on the number of channels         

 <!PW>rSamples : number of samples per channel
Maximum value 1.000.000 (depends on the memory too)

 <!PW>rTrigger : type of triggering:
<!STBL>
<!+>Value<!+>Meaning<!>
<!c>0<!>internal, immediately on <!RW>ME4000.ADC.START/<!RW>SCAN<!>
<!c>1<!>analoge trigger input, rising edge<!>
<!c>2<!>analoge trigger input, falling edge<!>
<!c>3<!>analoge trigger input, any edge<!>
<!c>4<!>digital trigger input, rising edge<!>
<!c>5<!>digital trigger input, falling edge<!>
<!c>6<!>digital trigger input, any edge<!>
<!ETBL>
>>
<<
128.157.3.3.3
ME4000.ADC.Sample.Start|Start
!128.157.3.3.4 - Start
--
<!DEF>
procedure <!TW>ME4000.ADC.Sample.Start (rCurveSet : real);
<!TXT>
Starts the sampling process. 

Check first with <a href="128.157.3.3.1">ME4000.ADC.Sample.Check</a> whether all parameters are valid for the sampling. 

See also <a href="128.157.3.3.5">ME4000.ADC.Sample.Scan</a> - another way of sampling.

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

 <!PW>rCurveSet indicates the Curve-Set that will hold the samples curves. At the moment it must be always 1.
>>
<<
128.157.3.3.4
ME4000.ADC.Sample.Scan|Scan
!128.157.3.3.3 - Start
--
<!DEF>
procedure <!TW>ME4000.ADC.Sample.Scan (rCurveSet : real);
<!TXT>
Starts the sampling process. 

Check first with <a href="128.157.3.3.1">ME4000.ADC.Sample.Check</a> whether all the parameters are valid for the sampling. 

 <!RW>ME4000.ADC.Sample.Scan is different from <a href="128.157.3.3.3">ME4000.ADC.Sample.Start</a>  in the way the scan time is distributed on the individual channels. If there is only one channel is the channel list both procedures are identical.

A graphic should clarify this better. The X on the time line indicates the selected sample interval. When <!RW>START is used, all the selected channels (here 4) are sampled consecutively as quickly as possible - assimultaneously as possible. Thus for channels 2-4 this yields only a very short settling-time of the multiplexer. When SCAN is used the channels are distributed on the sample time line. Thus all the channels have the same settling-time, but will be sampled time 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>ME4000.ADC.Sample.Check it can be checked whether the sampling has been already ended.

 <!PW>rCurveSet indicates the curve-set that will hold the sampled curves. At the moment it is always 1.
>>

<<
128.157.3.3.5
ME4000.ADC.Sample.Stop|Stop
--
<!DEF>
procedure <!TW>ME4000.ADC.Sample.Stop;
<!TXT>
Aborts a running sampling process. 

Already sampled values are transferred to the curve-set, values which have not been measured yet are filled with undefined data. Therefore use the curve-set with precaution or, best, do not use it at all.
>>

<<
128.157.3.4
ME4000.ADC.List|List
--
List - administers the list of channels processed during the sampling
>>
<<
128.157.3.4.1
ME4000.ADC.List.Clear|Clear
--
<!DEF>
procedure <!TW>ME4000.ADC.List.Clear;
<!TXT>
Deletes the list of channels processed during the sampling. Directly after this command it is not possible to do a sampling because there is no channel selected.
>>
<<
128.157.3.4.2
ME4000.ADC.List.Add|Add
--
<!DEF>
procedure <!TW>ME4000.ADC.List.Add (rChannel : real);
<!TXT>
Adds the channel <!PW>rChannel (0..31) to the list of the sampled channels.

If the channel is already in the list, nothing happens.

Please note:
Channels in <!SW>Single-Ended mode must not be mixed with channels in <!SW>Differentiell in the channel list.
>>

<<
128.157.4
ME4000.DAC|DAC
--
Analog outputs

Note:
The analoge outputs of the ME4000 have only one output range of 10V. 
So there is no <!RW>ME4000.DAC.SETUP command.
>>

<<
128.157.4.2
ME4000.DAC.Set|Set
--
<!DEF>
procedure <!TW>ME4000.DAC.Set (rChannel, rValue : real);
<!TXT>
Sets the output of the DA-channel <!PW>rChannel (0..3) to <!PW>rValue Volt.

If a curve output is running, it will be stopped.
>>

<<
128.157.4.3
ME4000.DAC.Curve|Curve
--
Administers the output of a cyclic signal on a DAC-channel.

Therefore an internal curve is generated and transferred to the FIFO-buffer of the ME4000-card for output.
Every DAC Channel has its own FIFO and can be programmed independently of the other channels.

Independently of the output, the internal curve form can be further processed already.

The size of the internal FIFO is 4096 samples.

The FIFO elements can be processed by the DAC with up to 500000 Hz. The highest producible frequency is so a square wave with 250 kHz (2 samples). The FIFO can be build up element by element, or the system can calculate a complete, predefined wave form (sine wave, square wave, triangle wave). If the elements are defined by the interpreter, take care that the maximum output frequency is limited by the number of elements: fMax := 500kHz / number of elements. If the system calculates the wave form, it will optimze the number of elements against the wanted frequency. A calculated curve can be transmitted with any freuncy unless it is lower than the limit given by the number of elements. 

Example:
<!CODE>
// Sweep with a sinus curve
ME4000.DAC.Curve.Sin (0, 5, 0, 5000);      // calculate a sinus for 5kHz
for rFreq:=100 to 5000 step 100 do begin
  ME4000.DAC.Curve.Start (0, rFreq)
end;
<!TXT>
>>
<<
128.157.4.3.1
ME4000.DAC.Curve.Clear|Clear
--
<!DEF>
procedure <!TW>ME4000.DAC.Curve.Clear (rChannel : real);
<!TXT>
Deletes the internal curve memory of channel <!PW>rChannel, a possible running output is not influenced.

If <!PW>rChannel is -1, the memory of all channels will be cleared.
>>
<<
128.157.4.3.2
ME4000.DAC.Curve.Start|Start
--
<!DEF>
procedure <!TW>ME4000.DAC.Curve.Start (rChannel, rFrequency : real);
<!TXT>
Starts the output of the previously defined curve on the <!PW>rChannel with the frequency (repeat frequency of the complete curve) <!PW>rFrequency Hz.

The maximum frequency is 500 kHz / number of points on the curve.

It is not necessary to stop a possible running output before.

Example output sinus 150Hz, 4Vpp, 2.5Voffs:
(Consider the amplification of the output driver for amplitude and Offset)
<!CODE>
ME4000.DAC.Curve.Sin (0, 2, 2.5, 150);
ME4000.DAC.Curve.Start (0, 150);
<!TXT>
>>
<<
128.157.4.3.3
ME4000.DAC.Curve.Stop|Stop
--
<!DEF>
procedure <!TW>ME4000.DAC.Curve.Stop (rChannel : real);
<!TXT>
Ends the output of the curve on channel <!PW>rChannel.

The DAC-converter will produce 0V.

 If <!PW>rChannel is -1, all channles will be stopped.

>>
<<
128.157.4.3.4
ME4000.DAC.Curve.Sin|Sin
--
<!DEF>
procedure <!TW>ME4000.DAC.Curve.Sin (rChannel, rAmp, rOffs : real [; rFreq : real]);
<!TXT>
Calculates a sinusperiod in the internal curve memory of channel  <!PW>rChannel.

The amplitude and the Offset are given by <!PW>rAmp and <!PW>rOffs. The peaks (Minima and Maxima) of the curve are at <!PW>rOffs+<!PW>rAmp resp. <!PW>rOffs-<!PW>rAmp.

 <!PW>rFreq defines the frequency for which the number of sampling points is optimized and should be ALWAYS specified, because otherwise the curve is calculated with 4096 sampling points and it is possible that this curve cannot be put out with the wanted frequency.

If the curve is put out as sweep, then the highest wanted frequency should be specified as <!PW>rFreq.
>>
<<
128.157.4.3.5
ME4000.DAC.Curve.Sqr|Sqr
--
<!DEF>
procedure <!TW>ME4000.DAC.Curve.Sqr (rChannel, rAmp, rOffs, rDuty : real [; rFreq : real]);
<!TXT>
Calculates a period of a rectangle curve in the internal curve memory of channel <!PW>rChannel.

The amplitude and the offset are given by <!PW>rAmp and <!PW>rOffs. The peaks (Minima and Maxima) of the curve are at <!PW>rOffs+<!PW>rAmp resp. <!PW>rOffs-<!PW>rAmp.

 <!PW>rDuty (0..100) defines the duration of the High-Phase (as percentage of the complete period). <!PW>rDuty=50 generates a symetric rectangle (+- one sampling point in case of an odd sampling point number)

 <!PW>rFreq defines the frequency for which the number of sample points is optimized and should be ALWAYS specified because otherwise the curve is calculated with 4096 sample points and it is possible that this curve cannot be put out with the wanted frequency.

If the curve is put out as sweep, then the highest wanted frequency should be specified as <!PW>rFreq.
>>
<<
128.157.4.3.6
ME4000.DAC.Curve.Saw|Saw
--
<!DEF>
procedure <!TW>ME4000.DAC.Curve.Saw (rChannel, rAmp, rOffs, rRise : real [; rFreq : real]);
<!TXT>
Calculates a period of a rectangle curve in the internal curve memory of Channel<!PW>rChannel.

The amplitude and the offset are given by <!PW>rAmp and <!PW>rOffs. The peaks (Minima and Maxima) of the curve are at <!PW>rOffs+<!PW>rAmp resp. <!PW>rOffs-<!PW>rAmp.

 <NOBR><!PW>rRise (0..100) determines the duration of the rising edge (as percentage of the whole period). </NOBR> 
 <NOBR><!PW>rRise=0 generates a pure falling sawtooth,   </NOBR> 
 <NOBR><!PW>rRise=50 generates a symetric triangle (+- one sampling point in case of an odd number of sampling point)</NOBR> 
 <NOBR><!PW>rRise=100 generates a pure rising sawtooth </NOBR> 

 <!PW>rFreq determines the frequency for which the number of sampling points is optimized and should be ALWAYS specified, because otherwise the curve is calculated with 4096 sample points and it is possible that this curve cannot be put out with the wanted frequency.

If the curve is put out as sweep, then the highest wanted frequency should be specified as <!PW>rFreq.
>>
<<
128.157.4.3.7
ME4000.DAC.Curve.Add|Add
--
<!DEF>
procedure <!TW>ME4000.DAC.Curve.Add (rChannel, rAmp : real);
<!TXT>
Adds an point to the curve in the internal buffer of channel <!PW>rChannel. 

 <!PW>rAmp determines the amplitude in this sampling point (-10..10 V).
If more points are added than the FIFO can register (4096), then the points will be ignored.

Arbitrary curve forms are generated with <!RW>ME4000.DAC.Curve.Clear and <!RW>ME4000.DAC.Curve.Add.
>>
<<
128.157.5
ME4000.PWM|PWM
--
 <b>P</b>ulse <b>W</b>idth <b>M</b>odulated Output

The ME4000 card needs additional hardware to produce PWM signals.

<h2><font color=#cc0000>PWM is not supported yet!</font></h2>
>>
<<
128.157.5.1
ME4000.PWM.Setup|Setup
!128.157.5.3
!128.157.5.2
--
<!DEF>
procedure <!TW>ME4000.PWM.Setup (rFrequency, rDuty, rInverted : real);
<!TXT>
Sets the PWM-output of the ME4000 card on the specified value.

 <!PW>rFrequency : 0<sup><b>*</b></sup>..30000 (Hz)

 <!PW>rDuty      : 1..99 (%)

 <!PW>rInverted  : <!RW>true/<!RW>false

<h2><font color=#cc0000>PWM is not supported yet!</font></h2>
>>
<<
128.157.5.2
ME4000.PWM.Start|Start
--
<!DEF>
procedure <!TW>ME4000.PWM.Start;
<!TXT>
Activates the PWM output

<h2><font color=#cc0000>PWM is not supported yet!</font></h2>
>>
<<
128.157.5.3
ME4000.PWM.Stop|Stop
--
<!DEF>
procedure <!TW>ME4000.PWM.Stop;
<!TXT>
Deactivates the PWM-output

<h2><font color=#cc0000>PWM is not supported yet!</font></h2>
>>
<<
128.157.6
ME4000.IsActive|IsActive
--
<!DEF>
function <!TW>ME4000.IsActive : real;
<!TXT>
Returns <!RW>TRUE, if the ME4000 is active and ready for operation.
>>

<<
128.157.7
Calibration
--
The ME4000 calibration data is managed by the Calibration IP object.
>>

<<
128.157.7.1
AD-Converter|ADCs
--
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>

Way of calibration
<!STBL>
<!>1.<!>Reset calibration values<!><!RW>Calibration.Set <tt>('ME4000', 'ADC.Offset.0', rChannel, 0);</tt>
                                   <!RW>Calibration.Set <tt>('ME4000', 'ADC.Gain.0', &nbsp;&nbsp;rChannel, 1);</tt><!>
<!>2.<!>Supply 0V at the input terminals<!>&nbsp;<!>
<!>3.<!>Read value of the ADC<!><tt>rOffset:=</tt><!RW>ME4000.ADC.Get<tt> (rChannel, 1024);</tt><!>
<!>4.<!>Set this value as offset value<!><!RW>Calibration.Set <tt>('ME4000', 'ADC.Offset.0', rChannel, rOffset);</tt><!>
<!>5.<!>Supply a stable voltage (close to the end of the input range) at the input terminals<!><tt>rSet:=9.5;&nbsp;&nbsp;&nbsp;// Ecxample</tt><!> 
<!>6.<!>Read value of the ADC<!><tt>rMeas:=</tt><!RW>ME4000.ADC.Get<tt> (rChannel, 1024);</tt><!>
<!>7.<!>Calculate and set gain<!><!RW>Calibration.Set <tt>('ME4000', 'ADC.Gain.0', &nbsp;&nbsp;rChannel, rSet/rMeas);</tt><!>
<!ETBL> 

For the commands <!RW>Calibration.Set and <!RW>Calibration.Get the following names and channels are defined:
<!STBL>
<!+>ValueName<!+>Chanalnumber(s)<!+>Description<!>
<!c>ADC.Offset.<i>Range</i><!c>0 .. 15/31<!>Offset correction value of ADC channel 0..15/31<!>
<!c>ADC.Gain.<i>Range</i><!c>0 .. 15/31<!>Gain  correction value of ADC channel 0..15/31<!>
<!ETBL>
Range defines the input range the calibration is made for.
In Single-Ended mode, all 32 channels (channel number 0..31) can be used, for differential mode, only the first 16 channles (channel numbers 0..15) can be used.

<!STBL>
<!+>Range<!+>Input range<!+>
<!c>0<!> 10 V<!>
<!c>1<!> 5 V<!>    
<!c>2<!> 2.5 V<!>    
<!c>3<!> 1.25 V<!>
<!c>4<!>0..10 V<!>
<!c>5<!>0..5 V<!>
<!ETBL>
>>

<<
128.157.7.2
DA-Converter|DACs
--
The software calibration of an DAC is based on two values:

<ul indent="15">
<li><b>Offset</b><br>
Value an the output terminal of the DAC, when it is set to 0V<br>
</li>
<li><b>Gain</b><br>
Relation between the value on the output terminal of a (offset corrected) DAC and the set point of the DAC
</li></ul>

The calculation of the corrected set point of the DAC uses this formula:
<!STBL>
<!>U<sub>DAW</sub> = (U<sub>Set</sub> - <!RW>Offset) * <!RW>Gain<!>
<!ETBL>

Way of calibration:
<!STBL>
<!>1.<!>Reset calibration values<!><!RW>Calibration.Set <tt>('ME4000', 'DAC.Offset.0', rChannel, 0);</tt>
                                   <!RW>Calibration.Set <tt>('ME4000', 'DAC.Gain.0', &nbsp;&nbsp;rChannel, 1);</tt><!>
<!>2.<!>Set DAC to produce 0V<!><!RW>ME4000.DAC.Set<tt> (rChannel, 0);</tt><!>
<!>3.<!>Measure voltage on terminals<!><tt>rMeas:=</tt><!RW>IEC.GetValue<tt> ('Calibrator', -9999)</tt><!>
<!>4.<!>Set this value as calibration offset<!><!RW>Calibration.Set <tt>('ME4000', 'DAC.Offset.0', rChannel, rMeas);</tt><!>
<!>5.<!>Set DAC to a value close to the end of the output range<!><tt>rSet:=9.5;</tt><br>
                                                                 <!RW>ME4000.DAC.Set<tt> (rChannel, rSoll);</tt><!> 
<!>6.<!>Measure voltage on terminals<!><tt>rMeas:=</tt><!RW>IEC.GetValue<tt> ('Calibrator', -9999)</tt><!>
<!>7.<!>Calculate and set gain<!><!RW>Calibration.Set <tt>('ME4000', 'DAC.Gain.0', rChannel, rSet/rMeas)</tt><!>
<!ETBL> 

For the commands <!RW>Calibration.Set and <!RW>Calibration.Get the following names and channels are defined:
<!STBL>
<!+>ValueName<!+>Chanalnumber(s)<!+>Description<!>
<!c>DAC.Offset.0<!c>0 .. 3<!>Offset correction value of DAC channel 0..3<!>
<!c>DAC.Gain.0<!c>0 .. 3<!>Gain correction value of DAC channel 0..3<!>
<!ETBL>
>>

