:html
<<
128.165
Digital Input DIn-Object|DIn
--
The IP-Object <!RW>DIn controls the digital input cards of the universal measurement system.

An input card consists of 5 function blocks, which can be addressed individually:

<h5>1. Input multiplexer</h5>
Connects one of the 32 input channels (1-of-32) with the other electronic parts. It consists of two 1-of-16 multiplexers, which may be used to build differential input (1-of-16). However, the differential operation mode is not implemented in the interpreter software yet. The input multiplexer can be entirely switched off.

<h5>2. PGA (=Programmable Gain Amplifier)</h5>
An amplifier with programmable amplification. This module is optional. If it is not implemented, the amplification is 1 (no signal amplification). If PGA is implemented, then there are 2 amplification types available (1/2/4/8 and 1/10/100/1000). 
The output signal of the PGA is routed outside and can be e.g. applied on an A/D-converter. This way the input part of the DIn32-card can be used as front end of an A/D-converter card (extends an A/D-channel to 32 channels with adjustable amplification)

<h5>3. Test signal</h5>
For test purposes, the output signal of the multiplexer can be switched off and replaced by a defined voltage (2,5V). Thus the other electronic assembly 'sees' always this 2,5V independently of the multiplexer channel / input signal / PGA-adjustment.

<h5>4. Threshold voltage generator</h5>
With the help of a threshold voltage generator it is possible to adjust the level from which the card identifies a logical '1'. Voltages below the threshold value are identified as '0', voltages above the threshold value as logical '1'. The threshold can be adjusted within the range -10V to +10V. The threshold value voltage is routed outside.

<h5>5. Return channel</h5>
Since the number of return lines is limited in the MCD-Bus, several input cards may share one return channel. Therefore the cards have a switch which switches off their output. Normally, the software manages the allocation of the return channel automatically. 
>>
<<
128.165.1
Functions of the DIn-Object|Functions
--
>>
<<
128.165.1.1
DIn.Read|Read
--
<!DEF>
function <!TW>DIn.Read (aDIrChannelAddress : address) : real;
<!TXT>
The input channel specified in the address is activated; the voltage on the channel pin is compared with the threshold voltage and returned as logical value. 

<!DEF>
function <!TW>DIn.Read (aDInCardAddress : address; rChannel : real): real;
<!TXT>
As above, only that the channel is determined by card address and the numerical channel number.

<!DEF>
function <!TW>DIn.Read (aDInCardAddress : address) : real;
<!TXT>
As above, but the previously selected channel is used.
>>
<<
128.165.1.2
DIn.Scan|Scan
--
<!DEF>
function <!TW>DIn.Scan (aDIrChannelAddressFrom, aDIrChannelAddressTo : address) : real;
<!TXT>
Reads in consecutively all the channels from <!PW>aDIrChannelAddressFrom to <!PW>aDIrChannelAddressTo (inclusive) into a bit pattern value.

The lowest bit in the result (value 1) corresponds to the status of <!PW>aDIrChannelAddressFrom.

The number of significant bits in the result corresponds to the number of read channels. The higher (unused) bits are 0. 

<!PW>aDIrChannelAddressFrom must be less or equal than <!PW>aDIrChannelAddressTo. Both adresses must be on the same card.

<!DEF>
function <!TW>DIn.Schan (aDInCardAddress : address; rChannelFrom, rChannelTo : real) : real;
<!TXT>
As above, only that the channels are determined by the specification of the card address and numerical channel numbers.
>>
<<
128.165.1.3
DIn.MeasLowTime|MeasLowTime
--
<!DEF>
function <!TW>DIn.MeasLowTime (aDIrChannelAddress : address; rTimeout : real) : real;
<!TXT>
<!DEF>
function <!TW>DIn.MeasLowTime (aDInCardAddress : address; rTimeout : real) : real;
<!TXT>
Determines the LOW-Phase length of the input signal. 

If a channel address is specified, then the channel is activated. If a card address is specified, then the channel which is already set will be used.

First of all a HIGH/LOW-transfer is awaited, then the time measurement is started, then a LOW/HIGH-transfer is awaited and finally the time measurement is stopped. 

The determined 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), then after <!PW>rTimeout milliseconds the command is aborted and -1 is returned as result.
>>
<<
128.165.1.4
DIn.MeasHighTime|MeasHighTime
--
<!DEF>
function <!TW>DIn.MeasHighTime (aDIrChannelAddress : address; rTimeout : real) : real;
<!TXT>
<!DEF>
function <!TW>DIn.MeasHighTime (aDInCardAddress : address; rTimeout : real) : real;
<!TXT>
Determines the HIGH-Phase length of the input signal. 

If a channel address is specified, then the channel is activated. If a card address is specified, then the channel which has been already set will be used.

First of all a LOW/HIGH-transfer is awaited, then the time measurement is started, then a HIGH/LOW-transfer is awaited and finally the time measurement is stopped. 

The determined time is returned in milliseconds. 

If the expected LOW/HIGH- and / or HIGH/LOW-transfers are not found (e.g. because there is no input signal), then after <!PW>rTimeout milliseconds the command is aborted and -1 is returned as result.
>>
<<
128.165.1.5
DIn.MeasLowHighTime|MeasLowHighTime
--
<!DEF>
function <!TW>DIn.MeasLowHighTime (aDIrChannelAddress : address; rTimeout : real) : real;
<!TXT>
<!DEF>
function <!TW>DIn.MeasLowHighTime (aDInCardAddress : address; rTimeout : real) : real;
<!TXT>
Determines the length of a period (LOW- and HIGH-Phase) of the input signal. 

If a channel address is specified, then the channel is activated. If a card address is specified, then the channel which has been already set will be used.

First of all a HIGH/LOW-transfer is awaited, then the time measurement is started, then a LOW/HIGH-transfer is awaited, another HIGH/LOW-transfer is awaited and finally the time measurement is stopped. 

The determined time is returned in milliseconds. 

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

<<
128.165.2
Procedures of the DIn-Object|Procedures
--
>>
<<
128.165.2.1
DIn.Init|Init
!128.165.2.2 - SetChannel
!128.165.2.3 - SetPGA
!128.165.2.4 - SetThreshold
--
<!DEF>
procedure <!TW>DIn.Init (aDIrChannelAddress : address; rThreshold, rPGA : real);
<!TXT>
<!DEF>
procedure <!TW>DIn.Init (aDInCardAddress : address; rThreshold, rPGA : real [; rChannel : real]);
<!TXT>
Combination of the <!RW>SetThreshold, <!RW>SetPGA and <!RW>SetChannel commands. For a more exact description see these. 

When the card address is specified the channel number is optional.If no channel number is specified, then the channel is not switched.
>>
<<
128.165.2.2
DIn.SetChannel|SetChannel
--
<!DEF>
procedure <!TW>DIn.SetChannel (aDIrChannelAddress : address);
<!TXT>
Sets the input multiplexer of the card on the requested channel.

<!DEF>
procedure <!TW>DIn.SetChannel (aDInCardAddress : address; rChannel : real);
<!TXT>
As above, only that the channel is specified by card address and numerical channel number.

For the channel number: 0 = multiplexer off, 1..32 = requested channel.
>>
<<
128.165.2.3
DIn.SetPGA|SetPGA
--
<!DEF>
procedure <!TW>DIn.SetPGA (aDInChannelAddress : address; rPGAStep : real);
<!TXT>
<!DEF>
procedure <!TW>DIn.SetPGA (aDInCardAddress : address; rPGAStep : real);
<!TXT>
Sets the PGA to the specified step. The card is selected either directly by the card address or by the card address implicitly contained in the channel address.

 <!PW>rPGAStep is a value between 1 and 4.

Relation rPGAStep/PGAType -> Amplification:
<!STBL>
<tr bgcolor=#f0f0f0 align=center><td rowspan=2 valign=bottom><b>PGA-Type</b></td><td colspan=4><b>rPGAStep =</b><!>
<tr align=center><td width=25><b>1</b></td><td width=25><b>2</b></td><td width=25><b>3</b></td><td width=25><b>4</b><!>
<tr align=center><td><b>1 / 10 / 100 / 1000</b><!>1<!>10<!>100<!>1000<!>
<tr align=center><td><b>1 / 2 / 4 / 8</b><!>1<!>2<!>4<!>8<!>
<tr align=center><td><b>keiner</b><!>1<!>1<!>1<!>1<!>
<!ETBL>
>>
<<
128.165.2.4
DIn.SetThreshold|SetThreshold
--
<!DEF>
procedure <!TW>DIn.SetThreshold (aDInChannelAddress : address; rThreshold : real);
<!TXT>
<!DEF>
procedure <!TW>DIn.SetThreshold (aDInCardAddress : address; rThreshold : real);
<!TXT>
Sets the threshold voltage generator to the specified voltage <!PW>rThreshold (-10V..+10V).

The card is selected either directly by the card address or by the card address implicitly contained in the channel address.
>>
<<
128.165.2.5
DIn.SetTestMode|SetTestMode
--
<!DEF>
procedure <!TW>DIn.SetTestmode (aDInChannelAddress : address; rOn : real);
<!TXT>
<!DEF>
procedure <!TW>DIn.SetTestmode (aDInCardAddress : address; rOn : real);
<!TXT>
Switches between test signal (2.5V) and the output of the multiplexer.

<!STBL>
<!+>rOn<!+>Result<!>
<!c><!RW>ON resp. 1<!>Test signal on<!>
<!c><!RW>OFF resp. 0<!>normale operation<!>
<!ETBL>

The card is selected either directly by the card address or by the card address implicitly contained in the channel address.
>>
<<
128.165.2.6
DIn.SetBackChannel|SetBackChannel
--
<!DEF>
procedure <!TW>DIn.SetBackChannel (aDInChannelAddress : address; rOn : real);
<!TXT>
<!DEF>
procedure <!TW>DIn.SetBackChannel (aDInCardAddress : address; rOn : real);
<!TXT>
Enables / disables the return channel of the card.

<!STBL>
<!+>rOn<!+>Result<!>
<!c><!RW>ON resp. 1<!>return channel on<!>
<!c><!RW>OFF resp. 0<!>return channel off<!>
<!ETBL>

The commands which read in data from the card (<!RW>READ and <!RW>SCAN) also switch on the return channel independently. 

If the return channel is switched on while another card has already switched to this channel, the other card is switched off automatically by the system. However, this implies that the definition of the cards is correct (UMSCards.DAT). 

The card is selected either directly by the card address or by the card address implicitly contained in the channel address.
>>
<<
128.165.2.7
DIn.SettlingTime|SettlingTime
--
<!DEF>
procedure <!TW>DIn.SettlingTime (aDInChannelAddress : address; rTime : real);
<!TXT>
<!DEF>
procedure <!TW>DIn.SettlingTime (aDInCardAddress : address; rTime : real);
<!TXT>
Sets the delay before the reading of a value that takes place after a channel switch. <!PW>rTime indicates the time in <b>micro</b>seconds (range 0..20000).

The time is effective only in case of a real channel switch, not when the same channel is reselected. The time starts automatically running with the selection of the channel and the delay is not repeated before each access. Default value is 100s.

The card is selected either directly by the card address or by the card address implicitly contained in the channel address.
>>
<<
128.165.3
Upgrading of IP-Steps of the old Windows-System|Upgrade
--
In the following, new equivalents are specified for the 'old' commands:

<!CODE>
 UMS.DIGInInit -> DIn.Init
The parameter <i>system</i> is not implemented.
<!TXT>

<!CODE>
UMS.SetDataToPIO -> DIn.SetBackChannel
<!TXT>
Normally, the command can be omitted since the switch is administerd automatically.

<!CODE>
UMS.DIGInBit -> DIn.Read
<!TXT>

<!CODE>
UMS.DIGInWord -> DIn.Scan 
                 DIn.SetThreshold 
                 DIn.SetPGA
<!TXT>
The threshold and PGA can be set independently with the corresponding commands. The parameter <i>system</i> is not implemented.

<!CODE>
UMS.DIGInTestImpuls -> not supported
<!TXT>

<!CODE>
UMS.MeasLowTime     -> DIn.MeasLowTime
UMS.MeasHighTime    -> DIn.MeasHighTime
UMS.MeasLowHighTime -> DIn.MeasLowHighTime
<!TXT>
The timeout periods are centralized and one value is established each time (because there is only one system).
>>
