Products & Services Solutions Academia Support User Community Company

Learn more about Data Acquisition Toolbox   

Configuring and Sampling Input Channels

Properties Associated with Configuring and Sampling Input Channels

The hardware you are using has characteristics that satisfy your specific application needs. Some of the most important hardware characteristics determine your configuration.

Analog Input Properties Related to Sampling Channels

Property Name

Description

ChannelSkew

Specify the time between consecutive scanned hardware channels.

ChannelSkewMode

Specify how the channel skew is determined.

InputType

Specify the analog input hardware channel configuration.

SampleRate

Specify the per-channel rate at which analog data is converted to digital data.

Input Channel Configuration

You can configure your hardware input channels with the InputType property. The device-specific values for this property are given below.

InputType Property Values

Vendor

InputType Value

Advantech

Differential|{SingleEnded}

Measurement Computing

{Differential}|SingleEnded

National Instruments

{Differential}|SingleEnded| NonReferencedSingleEnded|
PseudoDifferential

Sound Cards

AC-Coupled

The InputType value determines the number of hardware channels you can add to a device object. You can return the channel IDs with the daqhwinfo function. For example, suppose you create the analog input object ai for a National Instruments board. To display the differential channel IDs:

ai = analoginput('nidaq','Dev1');
hwinfo = daqhwinfo(ai);
hwinfo.DifferentialIDs
ans =
     0     1     2     3     4     5     6     7

In contrast, the single-ended channel IDs would be numbered 0 through 15.

Advantech and Measurement Computing Devices

For Advantech and Measurement Computing devices, InputType can be Differential or SingleEnded. Channels configured for differential input are not connected to a fixed reference such as earth, and the input signals are measured as the difference between two terminals. Channels configured for single-ended input are connected to a common ground, and input signals are measured with respect to this ground.

National Instruments Devices

For National Instruments devices, InputType can be Differential, SingleEnded, NonReferencedSingleEnded, or PseudoDifferential. Channels configured for differential input are not connected to a fixed reference such as earth, and input signals are measured as the difference between two terminals. Channels configured for single-ended input are connected to a common ground, and input signals are measured with respect to this ground. Channels configured for nonreferenced single-ended input are connected to their own ground reference, and input signals are measured with respect to this reference. The ground reference is tied to the negative input of the instrumentation amplifier. Channels configured for pseudodifferential input are all referred to a common ground but this ground is not connected to the computer ground.

The number of channels that you can add to a device object depends on the InputType property value. Most National Instruments boards have 16 or 64 single-ended inputs and 8 or 32 differential inputs, which are interleaved in banks of 8. This means that for a 64 channel board with single-ended inputs, you can add all 64 channels. However, if the channels are configured for differential input, you can only add channels 0-7, 16-23, 32-39, and 48-55.

Sound Cards

For sound cards, the only valid InputType value is AC-Coupled. When input channels are AC-coupled, they are connected so that constant (DC) signal levels are suppressed, and only nonzero AC signals are measured.

Sampling Rate

The sampling rate is defined as the per-channel rate (in samples/second) that an analog input subsystem converts analog data to digital data. You specify the sampling rate with the SampleRate property.

The maximum rate at which channels are sampled depends on the type of hardware you are using. If you are using simultaneous sample and hold (SS/H) hardware such as a sound card, then the maximum sampling rate for each channel is given by the maximum board rate. For example, suppose you create the analog input object ai for a sound card and configure it for stereo operation. If the device has a maximum rate of 48.0 kHz, then the maximum sampling rate per channel is 48.0 kHz.

ai = analoginput('winsound');
addchannel(ai,1:2);
set(ai,'SampleRate',48000)

If you are using scanning hardware such as a National Instruments board, then the maximum sampling rate your hardware is rated at typically applies for one channel. Therefore, the maximum sampling rate per channel is given by the formula

For example, suppose you create the analog input object ai for a National Instruments board and add 10 channels to it. If the device has a maximum rate of 100 kHz, then the maximum sampling rate per channel is 10 kHz.

ai = analoginput('nidaq','Dev1');
set(ai,'InputType','SingleEnded')
addchannel(ai,0:9);
set(ai,'SampleRate',10000)

Typically, you can achieve this maximum rate only under ideal conditions. In practice, the sampling rate depends on several characteristics of the analog input subsystem including the settling time, the gain, and the channel skew. Channel skew is discussed in Channel Skew.

Channel Skew

Many data acquisition devices have one A/D converter that is multiplexed to all input channels. If you sample multiple input channels from scanning hardware, then each channel is sampled sequentially following this procedure:

  1. A single input channel is sampled.

  2. The analog signal is converted to a digital value.

  3. The process is repeated for every input channel being used.

Because these channels cannot be sampled simultaneously, a time gap exists between consecutively sampled channels. This time gap is called the channel skew. The channel skew and the sample period are illustrated below.

As shown in the preceding figure, a scan occurs when all channels in a group are sampled once and the scan rate is defined as the rate at which every channel in the group is sampled. The properties associated with configuring the channel skew are given below.

Table 5-1. Channel Skew Properties

Property Name

Description

ChannelSkew

Specify the time between consecutive scanned hardware channels.

ChannelSkewMode

Specify how the channel skew is determined.

ChannelSkew and ChannelSkewMode are configurable only for scanning hardware and not for simultaneous sample and hold (SS/H) hardware. For SS/H hardware, ChannelSkewMode can only be None, and ChannelSkew can only be 0. The values for ChannelSkewMode are given below.

Table 5-2. ChannelSkewMode Property Values

ChannelSkewModeValue

Description

None

No channel skew is defined. This is the only valid value for simultaneous sample and hold (SS/H) hardware.

Equisample

The channel skew is automatically calculated as [(sampling rate)(number of channels)]-1.

Manual

The channel skew must be set with the ChannelSkew property.

Minimum

The channel skew is given by the smallest value supported by the hardware.

If ChannelSkewMode is Minimum or Equisample, then ChannelSkew indicates the appropriate read-only value. If ChannelSkewMode is set to Manual, you must specify the channel skew with ChannelSkew.

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS