Main Content

daq.Channel Properties

Channel object properties

Alphabetical listing of channel object properties. The type of channel determines which of these properties a particular instance has.

Channel Properties

expand all

Rising or falling edges of the EdgeCount signal, specified as 'Rising' or 'Falling'.

Example: Create an EdgeCount counter channel, and set its ActiveEdge.

s = daq.createSession('ni');
ch = addCounterInputChannel(s,'cDAQ1Mod5',0,'EdgeCount')
ch = 

Data acquisition counter input edge count channel 'ctr0' on device 'Dev2':

      ActiveEdge: Rising
  CountDirection: Increment
    InitialCount: 0
        Terminal: 'PFI8'
            Name: empty
              ID: 'ctr0'
          Device: [1x1 daq.ni.DeviceInfo]
 MeasurementType: 'EdgeCount'

Change the ActiveEdge property to 'Falling':

ch.ActiveEdge = 'Falling'
ch = 

Data acquisition counter input edge count channel 'ctr0' on device 'Dev2':

      ActiveEdge: Falling
  CountDirection: Increment
    InitialCount: 0
        Terminal: 'PFI8'
            Name: empty
              ID: 'ctr0'
          Device: [1x1 daq.ni.DeviceInfo]
 MeasurementType: 'EdgeCount'

Data Types: char | string

Pulse width measurement active level, specified as 'High' or 'Low'.

Example: Set active pulse level.

Create a session object, add a counter input channel, with the 'PulseWidth' MeasurementType.

s = daq.createSession('ni');
ch = addCounterInputChannel(s,'cDAQ1Mod5',0,'PulseWidth')
ch = 

Data acquisition counter input pulse width channel 'ctr0' on device 'cDAQ1Mod5':

       ActivePulse: High
        Terminal: 'PFI4'
            Name: empty
              ID: 'ctr1'
          Device: [1x1 daq.ni.DeviceInfo]
 MeasurementType: 'PulseWidth'

Change the ActivePulse property to 'Low'.

ch.ActivePulse = 'Low'
ch = 

Data acquisition counter input pulse width channel 'ctr0' on device 'cDAQ1Mod5':

     ActivePulse: Low
        Terminal: 'PFI4'
            Name: empty
              ID: 'ctr1'
          Device: [1x1 daq.ni.DeviceInfo]
 MeasurementType: 'PulseWidth'

Data Types: char | string

Timing mode of all channels in the device. You can set the ADCTimingMode to:

  • 'HighResolution'

  • 'HighSpeed'

  • 'Best50HzRejection'

  • 'Best60HzRejection'

ADCTimingMode must be the same for all channels on the device.

Example: Set channel timing mode

Create a session and add an analog input channel.

s = daq.createSession('ni');
ch = addAnalogInputChannel(s,'cDAQ1Mod1','ai1','Voltage')
ch = 

Data acquisition analog input voltage channel 'ai1' on device 'cDAQ1Mod1':

       Coupling: DC
 TerminalConfig: SingleEnded
          Range: -10 to +10 Volts
           Name: ''
             ID: 'ai1'
         Device: [1x1 daq.ni.CompactDAQModule]
MeasurementType: 'Voltage'
  ADCTimingMode: ''

Set the ADCTimingMode property to 'HighResolution'.

ch.ADCTimingMode = 'HighResolution';

Data Types: char | string

Specify the bridge mode, which represents the active gauge of the analog input channel. The default value is 'Unknown' when you add a bridge channel to the session. Change this value to a valid mode to use the channel. Valid bridge modes are:

  • 'Full' — All four gauges are active.

  • 'Half'— Only two bridges are active.

  • 'Quarter'— Only one bridge is active.

Example

Set the BridgeMode property of an analog input bridge measurement type channel.

Create a session and add an analog input Bridge channel.

s = daq.createSession('ni');
ch = addAnalogInputChannel(s,'cDAQ1Mod7',0,'Bridge');

Set the BridgeMode property to 'Full' and view the channel properties.

ch.BridgeMode = 'Full'
ch = 

Data acquisition analog input channel 'ai0' on device 'cDAQ1Mod7':

             BridgeMode: Full
       ExcitationSource: Internal
      ExcitationVoltage: 2.5
NominalBridgeResistance: 'Unknown'
                  Range: -0.063 to +0.063 VoltsPerVolt
                   Name: ''
                     ID: 'ai0'
                 Device: [1x1 daq.ni.CompactDAQModule]
        MeasurementType: 'Bridge'
          ADCTimingMode: HighResolution

Data Types: char | string

Direction of the channel counter, specified as 'Increment' (default) to count up, or 'Decrement', to count down.

Example

Create a session object, add a counter input channel, and change its CountDirection.

s = daq.createSession('ni');
ch = addCounterInputChannel (s,'cDAQ1Mod5', 0, 'EdgeCount')
ch = 

Data acquisition counter input edge count channel 'ctr0' on device 'cDAQ1Mod5':

      ActiveEdge: Rising
  CountDirection: Increment
    InitialCount: 0
        Terminal: 'PFI8'
            Name: empty
              ID: 'ctr0'
          Device: [1x1 daq.ni.DeviceInfo]
 MeasurementType: 'EdgeCount'

Change CountDirection to 'Decrement':

ch.CountDirection = 'Decrement'
ch = 

Data acquisition counter input edge count channel 'ctr0' on device 'cDAQ1Mod5':

      ActiveEdge: Rising
  CountDirection: Decrement
    InitialCount: 0
        Terminal: 'PFI8'
            Name: empty
              ID: 'ctr0'
          Device: [1x1 daq.ni.DeviceInfo]
 MeasurementType: 'EdgeCount'

Data Types: char | string

Coupling mode used for the analog input signal connection, specified as 'DC' or 'AC'. You cannot change the value for devices that support only one mode. For devices that support both AC and DC coupling, you can specify the mode by changing this property value.

  • If Coupling is set to 'DC', the signal input is connected directly to the amplifier, allowing measurement of the complete signal including its DC bias component. This is typically used with slowly changing signals such as temperature, pressure, or voltage readings.

  • If Coupling is set to 'AC', a series capacitor is inserted between the input connector and the amplifier, filtering out the DC bias component of the measured signal. This is typically used with dynamic signals such as audio.

Example

Create a session and add an analog input channel. Then change the coupling mode to 'AC'.

s = daq.createSession('ni');
ch = addAnalogInputChannel(s,'Dev4','ai1','Voltage')

ch.Coupling = 'AC'

Data Types: char | string

This property is read-only.

Device information for the channel, returned as a DeviceInfo object.

Example

Create a session object, add a counter input channel, and view the channel Device property.

s = daq.createSession('ni');
ch = addCounterInputChannel(s,'cDAQ1Mod5',0,'EdgeCount');
ch.Device
ans = 

ni cDAQ1Mod5: National Instruments NI 9402
   Counter input subsystem supports:
      Rates from 0.1 to 80000000.0 scans/sec
      2 channels
      'EdgeCount','PulseWidth','Frequency','Position' measurement types
   
   Counter output subsystem supports:
      Rates from 0.1 to 80000000.0 scans/sec
      3 channels
      'PulseGeneration' measurement type
   
This module is in chassis 'cDAQ1', slot 5

When you specify a digital channel MeasurementType as Bidirectional, you can use the channel to input and output data. By default the channel Direction is set to 'Unknown'. Other possible values are 'Input' and 'Output'.

Example: Change Bidirectional Channel Direction

Change the direction of a bidirectional digital channel to Input.

Create a session and add a bidirectional digital channel.

s = daq.createSession('ni')
ch = addDigitalChannel(s, 'dev6', 'Port0/Line0', 'Bidirectional')
ch = 

Data acquisition digital bidirectional (unknown) channel 'port0/line0' on device 'Dev6':

      Direction: Unknown
           Name: ''
             ID: 'port0/line0'
         Device: [1x1 daq.ni.DeviceInfo]
MeasurementType: 'Bidirectional (Unknown)'

Change the channel direction to 'Input'. Note the impact on the display of the channel description, Direction, and MeasurementType.

ch.Direction = 'Input'
ch = 

Data acquisition digital bidirectional (input) channel 'port0/line0' on device 'Dev6':

      Direction: Input
           Name: ''
             ID: 'port0/line0'
         Device: [1x1 daq.ni.DeviceInfo]
MeasurementType: 'Bidirectional (Input)'

Data Types: char | string

Specify the fraction of time that the generated pulse is in active state.

Duty cycle is the ratio between the duration of the pulse and the pulse period. For example, if a pulse duration is 1 microsecond and the pulse period is 4 microseconds, the duty cycle is 0.25. In a square wave, the time the signal is high is equal to the time the signal is low, or duty cycle 0.5.

You can change the duty cycle of counter output channels while the session is running.

For function generation channels using Digilent devices, each waveform adopts the duty cycle.

Example

Create a session object and add a 'PulseGeneration' counter output channel.

s = daq.createSession('ni');
ch = addCounterOutputChannel(s,'cDAQ1Mod5', 'ctr0', 'PulseGeneration')
ch = 

Data acquisition counter output pulse generation channel 'ctr0' on device 'cDAQ1Mod5':

      IdleState: Low
   InitialDelay: 2.5e-08
      Frequency: 100
      DutyCycle: 0.5
       Terminal: 'PFI0'
           Name: ''
             ID: 'ctr0'
         Device: [1x1 daq.ni.CompactDAQModule]
MeasurementType: 'PulseGeneration'

Change the DutyCycle to 0.25.

ch.DutyCycle
ch = 

Data acquisition counter output pulse generation channel 'ctr0' on device 'cDAQ1Mod5':

      IdleState: Low
   InitialDelay: 2.5e-08
      Frequency: 100
      DutyCycle: 0.25
       Terminal: 'PFI0'
           Name: ''
             ID: 'ctr0'
         Device: [1x1 daq.ni.CompactDAQModule]
MeasurementType: 'PulseGeneration'

Specify the encoding type of the counter input 'Position' channel. Supported encoder types include:

  • 'X1'

  • 'X2'

  • 'X4'

  • 'TwoPulse'

Example

Create a session and add a counter input channel with Position measurement type.

s = daq.createSession('ni');
ch = addCounterInputChannel(s,'cDAQ1Mod5', 'ctr0', 'Position')
ch = 

Data acquisition counter input position channel 'ctr0' on device 'cDAQ1Mod5':

    EncoderType: X1
   ZResetEnable: 0
    ZResetValue: 0
ZResetCondition: BothHigh
      TerminalA: 'PFI0'
      TerminalB: 'PFI2'
      TerminalZ: 'PFI1'
           Name: ''
             ID: 'ctr0'
         Device: [1x1 daq.ni.CompactDAQModule]
MeasurementType: 'Position'

Change the channel encoder type to X2.

ch.EncoderType = 'X2'
ch = 

Data acquisition counter input position channel 'ctr0' on device 'cDAQ1Mod5':

    EncoderType: X2
   ZResetEnable: 0
    ZResetValue: 0
ZResetCondition: BothHigh
      TerminalA: 'PFI0'
      TerminalB: 'PFI2'
      TerminalZ: 'PFI1'
           Name: ''
             ID: 'ctr0'
         Device: [1x1 daq.ni.CompactDAQModule]
MeasurementType: 'Position

Data Types: char | string

Enable or disable the enhanced alias rejection on your DSA device’s analog channel. See Synchronize DSA Devices for more information. Enhanced alias reject is disabled by default. This property only takes logical values.

You cannot modify enhanced rejection mode if you are synchronizing your DSA device using AutoSyncDSA.

Example: Enable enhanced alias rejection on a DSA device.

Create a session and add an analog input voltage channel using a DSA device.

s = daq.createSession('ni');
ch = addAnalogInputChannel(s,'PXI1Slot2', 0, 'Voltage')
ch = 

Data acquisition analog input voltage channel 'ai0' on device 'PXI1Slot2':

                    Coupling: DC
              TerminalConfig: PseudoDifferential
                       Range: -42 to +42 Volts
                        Name: ''
                          ID: 'ai0'
                      Device: [1x1 daq.ni.PXIDSAModule]
             MeasurementType: 'Voltage'
EnhancedAliasRejectionEnable: 0

Enable enhanced alias rejection.

ch.EnhancedAliasRejectionEnable = true
ch = 

Data acquisition analog input voltage channel 'ai0' on device 'PXI1Slot2':

                    Coupling: DC
              TerminalConfig: PseudoDifferential
                       Range: -42 to +42 Volts
                        Name: ''
                          ID: 'ai0'
                      Device: [1x1 daq.ni.PXIDSAModule]
             MeasurementType: 'Voltage'
EnhancedAliasRejectionEnable: 1

Data Types: logical

The current in amperes to excite an IEPE accelerometer, IEPE microphone, generic IEPE sensor, or RTD.

The default ExcitationCurrent is typically determined by the device. If the device supports a range of excitation currents, the default is the lowest available value in the range.

Example: Change the excitation current value of a microphone channel

Create a session and add an analog input microphone channel.

s = daq.createSession('ni');
ch = addAnalogInputChannel(s,'cDAQ1Mod3', 0, 'Microphone')
ch = 

Data acquisition analog input microphone channel 'ai0' on device 'cDAQ1Mod3':

          Sensitivity: 'Unknown'
MaxSoundPressureLevel: 'Unknown'
    ExcitationCurrent: 0.002
     ExcitationSource: Internal
             Coupling: AC
       TerminalConfig: PseudoDifferential
                Range: -5.0 to +5.0 Volts
                 Name: ''
                   ID: 'ai0'
               Device: [1x1 daq.ni.CompactDAQModule]
      MeasurementType: 'Microphone'
        ADCTimingMode: ''

Change the excitation current value to 4 milliamps.

ch.ExcitationCurrent = .004
ch = 

Data acquisition analog input microphone channel 'ai0' on device 'cDAQ1Mod3':

          Sensitivity: 'Unknown'
MaxSoundPressureLevel: 'Unknown'
    ExcitationCurrent: 0.004
     ExcitationSource: Internal
             Coupling: AC
       TerminalConfig: PseudoDifferential
                Range: -5.0 to +5.0 Volts
                 Name: ''
                   ID: 'ai0'
               Device: [1x1 daq.ni.CompactDAQModule]
      MeasurementType: 'Microphone'
        ADCTimingMode: ''

Data Types: double

The source of ExcitationVoltage for bridge measurements or ExcitationCurrent for IEPE sensors and RTDs. Excitation source can be:

  • Internal

  • External

  • None

  • Unknown

By default, ExcitationSource is set to 'Unknown'.

Example: Change the excitation source of a microphone channel

Create a session and add an analog input microphone channel.

s = daq.createSession('ni');
ch = addAnalogInputChannel(s,'cDAQ1Mod3',0,'Microphone')
ch = 

Data acquisition analog input microphone channel 'ai0' on device 'cDAQ1Mod3':

          Sensitivity: 'Unknown'
MaxSoundPressureLevel: 'Unknown'
    ExcitationCurrent: 0.004
     ExcitationSource: Unknown
             Coupling: AC
       TerminalConfig: PseudoDifferential
                Range: -5.0 to +5.0 Volts
                 Name: ''
                   ID: 'ai0'
               Device: [1x1 daq.ni.CompactDAQModule]
      MeasurementType: 'Microphone'
        ADCTimingMode: ''

Change the excitation source value to 'Internal'.

ch.ExcitationSource = 'Internal'
ch = 

Data acquisition analog input microphone channel 'ai0' on device 'cDAQ1Mod3':

          Sensitivity: 'Unknown'
MaxSoundPressureLevel: 'Unknown'
    ExcitationCurrent: 0.004
     ExcitationSource: Internal
             Coupling: AC
       TerminalConfig: PseudoDifferential
                Range: -5.0 to +5.0 Volts
                 Name: ''
                   ID: 'ai0'
               Device: [1x1 daq.ni.CompactDAQModule]
      MeasurementType: 'Microphone'
        ADCTimingMode: ''

Data Types: char | string

The excitation voltage value to apply to bridge measurements.

The default ExcitationVoltage is typically determined by the device. If the device supports a range of excitation voltages, the default is the lowest available value in the range.

Data Types: double

On counter output channels, use the Frequency property to set the pulse repetition rate. You can change the channel frequency while the session is running when using counter output channels.

On function generation channels use the Frequency property to specify the waveform frequency. You can set each channel frequency individually.

The frequency value must fall within the specified FrequencyLimit values.

Example: Set the Frequency of a Counter Output Channel

Create a session object and add a 'PulseGeneration' counter output channel:

s = daq.createSession('ni');
ch = addCounterOutputChannel(s,'cDAQ1Mod5', 'ctr0', 'PulseGeneration');

Change the Frequency to 200.

ch.Frequency = 200
ch = 

Data acquisition counter output pulse generation channel 'ctr0' on device 'cDAQ1Mod5':

       IdleState: Low
    InitialDelay: 2.5e-008
       Frequency: 200
       DutyCycle: 0.5
        Terminal: 'PFI12'
            Name: empty
              ID: 'ctr0'
          Device: [1x1 daq.ni.DeviceInfo]
 MeasurementType: 'PulseGeneration'

Example: Set the Frequency of a Function Generator Channel

Create a waveform generation channel, and change the generation rate to 20000 scans per second.

s = daq.createSession('digilent'):
fgenCh = addFunctionGeneratorChannel(s, 'AD1', 1, 'Sine');
fgenCh.Frequency = 20000
fgenCh = 

Data acquisition sine waveform generator '1' on device 'AD1':

              Phase: 0
              Range: -5.0 to +5.0 Volts
     TerminalConfig: SingleEnded
               Gain: 1
             Offset: 0
          Frequency: 20000
       WaveformType: Sine
     FrequencyLimit: [0.0 25000000.0]
               Name: ''
                 ID: '1'
             Device: [1x1 daq.di.DeviceInfo]
    MeasurementType: 'Voltage'

Data Types: double

This property is read-only.

The minimum and maximum rates that the function generation channel supports. FrequencyLimit changes dynamically as the channel configuration changes.

Example

View the frequency limits of a waveform function generation channel.

s = daq.createSession('digilent')
fgenCh = addFunctionGeneratorChannel(s, 'AD1', 1, 'Sine');
fgenCh.FrequencyLimit
ans = 

[0.0 25000000.0]

Data Types: double

When using waveform function channels to generate standard waveforms, Gain sets the peak amplitude. For arbitrary waveforms, Gain prepresents the value by which the data is multiplied to generate the output waveform.

The waveform gain can range from –5 to 5. Be sure that for any instantaneous output point Gain x Voltage + Offset falls within the valid output voltage range of the device.

Example

Change the gain of a waveform function generation channel for an amplitude of 2 volts.

s = daq.createSession('digilent');
fgenCh = addFunctionGeneratorChannel(s, 'AD1', 1, 'Sine');
fgenCh.Gain = 2
fgenCh = 

Data acquisition sine waveform generator '1' on device 'AD1':

              Phase: 0
              Range: -5.0 to +5.0 Volts
     TerminalConfig: SingleEnded
               Gain: 2
             Offset: 0
          Frequency: 4096
       WaveformType: Sine
     FrequencyLimit: [0.0 25000000.0]
               Name: ''
                 ID: '1'
             Device: [1x1 daq.di.DeviceInfo]
    MeasurementType: 'Voltage'

Data Types: double

This property is read-only.

Identifier of the channel, returned as a character array. The ID specifies a particular channel in the device subsystem. Use the channel ID when you add the channel to a session object.

Example

Create a session object, and add a counter input channel with the ID 'ctr0'.

s = daq.createSession('ni');
ch = addCounterInputChannel (s,'cDAQ1Mod5', 'ctr0', 'EdgeCount')
ch= 

Data acquisition counter input edge count channel 'ctr0' on device 'cDAQ1Mod5':

      ActiveEdge: Rising
  CountDirection: Increment
    InitialCount: 0
        Terminal: 'PFI8'
            Name: empty
              ID: 'ctr0'
          Device: [1x1 daq.ni.DeviceInfo]
 MeasurementType: 'EdgeCount'

Data Types: char | string

Default state of the counter output channel with a 'PulseGeneration' measurement type, when the counter is not active, specified as 'Low' or 'High'.

Example

Create a session object and add a 'PulseGeneration' counter output channel.

s = daq.createSession('ni');
ch = s.addCounterOutputChannel('cDAQ1Mod5', 'ctr0', 'PulseGeneration');

Change the IdleState property to 'High'.

ch.IdleState = 'High'
ans = 

Data acquisition counter output pulse generation channel 'ctr0' on device 'cDAQ1Mod5':

       IdleState: High
    InitialDelay: 2.5e-008
       Frequency: 100
       DutyCycle: 0.5
        Terminal: 'PFI12'
            Name: empty
              ID: 'ctr0'
          Device: [1x1 daq.ni.DeviceInfo]
 MeasurementType: 'PulseGeneration'

Data Types: char | string

Point from which the device starts the counter, specified as a numeric value.

Example

Create a session object and add a counter input channel.

s = daq.createSession('ni');
ch = addCounterInputChannel(s,'cDAQ1Mod5',0,'EdgeCount')
ch = 

Data acquisition counter input edge count channel 'ctr0' on device 'cDAQ1Mod5':

      ActiveEdge: Rising
  CountDirection: Increment
    InitialCount: 0
        Terminal: 'PFI8'
            Name: empty
              ID: 'ctr0'
          Device: [1x1 daq.ni.DeviceInfo]
 MeasurementType: 'EdgeCount'

Change the InitialCount value to 15.

ch.InitialCount = 15
ch = 

Data acquisition counter input edge count channel 'ctr0' on device 'cDAQ1Mod5':

      ActiveEdge: Rising
   CountDirection: Increment
    InitialCount: 15
        Terminal: 'PFI8'
            Name: empty
              ID: 'ctr0'
          Device: [1x1 daq.ni.DeviceInfo]
 MeasurementType: 'EdgeCount'

Delay before counter output channel generates pulses, specified in seconds.

Example

Set the initial delay on a counter output channel to 3 seconds.

Create a session and add a counter output channel.

s = daq.createSession('ni');
ch = addCounterOutputChannel(s,'cDAQ1Mod5','ctr0','PulseGeneration');

Set the initial delay.

ch.InitialDelay = 3
ch = 

Data acquisition counter output pulse generation channel 'ctr0' on device 'cDAQ1Mod5':

      IdleState: Low
   InitialDelay: 3
      Frequency: 100
      DutyCycle: 0.5
       Terminal: 'PFI0'
           Name: ''
             ID: 'ctr0'
         Device: [1x1 daq.ni.CompactDAQModule]
MeasurementType: 'PulseGeneration'

Specify the maximum sound pressure of the microphone channel in decibels. The maximum sound pressure level is based on the sensitivity and the voltage range of your device. When you set your device Sensitivity, the MaxSoundPressureLevel value is automatically corrected to match the specified sensitivity value and the device voltage range. You can also specify any acceptable pressure level in decibels. Refer to your microphone specifications for more information.

Example

Change the Sensitivity of a microphone channel and set the maximum sound pressure level to 10.

Create a session and add a microphone channel.

s = daq.createSession('ni');
ch = addAnalogInputChannel(s,'cDAQ1Mod3', 0, 'Microphone')
ch = 

Data acquisition analog input microphone channel 'ai0' on device 'cDAQ1Mod3':

          Sensitivity: 'Unknown'
MaxSoundPressureLevel: 'Unknown'
    ExcitationCurrent: 0.002
     ExcitationSource: Internal
             Coupling: AC
       TerminalConfig: PseudoDifferential
                Range: -5.0 to +5.0 Volts
                 Name: ''
                   ID: 'ai0'
               Device: [1x1 daq.ni.CompactDAQModule]
      MeasurementType: 'Microphone'
        ADCTimingMode: ''

Set the channel Sensitivity to 0.037.

ch.Sensitivity = 0.037
ch = 

Data acquisition analog input microphone channel 'ai0' on device 'cDAQ1Mod3':

          Sensitivity: 0.037
MaxSoundPressureLevel: 136
    ExcitationCurrent: 0.002
     ExcitationSource: Internal
             Coupling: AC
       TerminalConfig: PseudoDifferential
                Range: -135 to +135 Pascals
                 Name: ''
                   ID: 'ai0'
               Device: [1x1 daq.ni.CompactDAQModule]
      MeasurementType: 'Microphone'
        ADCTimingMode: ''

Set the channel maximum sound pressure to 10 dB.

ch.MaxSoundPressureLevel = 10
ch = 

Data acquisition analog input microphone channel 'ai0' on device 'cDAQ1Mod3':

          Sensitivity: 0.037
MaxSoundPressureLevel: 10
    ExcitationCurrent: 0.002
     ExcitationSource: Internal
             Coupling: AC
       TerminalConfig: PseudoDifferential
                Range: -135 to +135 Pascals
                 Name: ''
                   ID: 'ai0'
               Device: [1x1 daq.ni.CompactDAQModule]
      MeasurementType: 'Microphone'
        ADCTimingMode: ''

This property is read-only.

Specified measurement type for the channel. Some channels support many measurement types:

Counter measurement types include:

  • 'EdgeCount' (input)

  • 'PulseWidth' (input)

  • 'Frequency'(input)

  • 'Position'(input)

  • 'PulseGeneration' (output)

Analog measurement types include:

  • 'Voltage' (input and output)

  • 'Thermocouple' (input)

  • 'Current' (input and output)

  • 'Accelerometer' (input)

  • 'RTD' (input)

  • 'Bridge' (input)

  • 'Microphone' (input)

  • 'IEPE' (input)

Example

Create a session object, add a counter input channel with an 'EdgeCount' MeasurementType.

s = daq.createSession('ni');
ch = addCounterInputChannel (s, 'cDAQ1Mod5', 0, 'EdgeCount')
ch = 

Data acquisition counter input edge count channel 'ctr0' on device 'cDAQ1Mod5':

      ActiveEdge: Rising
  CountDirection: Increment
    InitialCount: 0
        Terminal: 'PFI8'
            Name: empty
              ID: 'ctr0'
          Device: [1x1 daq.ni.DeviceInfo]
 MeasurementType: 'EdgeCount'

Data Types: char

Descriptive name for the channel, specified as a character vector or string. By default there is no name assigned to a channel. You can change the value of Name at any time.

Example

Create a session and add an analog input channel.

s = daq.createSession('ni');
ch = addAnalogInputChannel(s,'Dev1', 0, 'Voltage')
ch = 

Data acquisition analog input voltage channel 'ai0' on device 'Dev1':

       Coupling: DC
 TerminalConfig: Differential
          Range: -10 to +10 Volts
           Name: ''
             ID: 'ai0'
         Device: [1x1 daq.ni.DeviceInfo]
MeasurementType: 'Voltage'

Change the channel Name to 'AI-Voltage'.

ch.Name = 'AI-Voltage'
ch = 

Data acquisition analog input voltage channel 'ai0' on device 'Dev1':

       Coupling: DC
 TerminalConfig: Differential
          Range: -10 to +10 Volts
           Name: 'AI-Voltage'
             ID: 'ai0'
         Device: [1x1 daq.ni.DeviceInfo]
MeasurementType: 'Voltage'

Data Types: char | string

Resistance of a bridge based sensor, specified in ohms. This value is used to calculate voltage.

You can specify any accepted positive value in ohms. The default value is 0, until you change it. You must set the resistance to use the channel.

When using waveform function generation channels, Offset specifies the DC offset voltage of a signal from zero, or the mean value of the waveform.

The waveform offset can be from –5 to 5 volts. Be sure that Gain x Voltage + Offset falls within the valid range of output voltage of the device.

Example

Change the offset of the waveform function generation channel to 2 volts.

s = daq.createSession('digilent');
fgenCh = addFunctionGeneratorChannel(s, 'AD1', 1, 'Sine');
fgenCh.Offset = 2
fgenCh = 

Data acquisition sine waveform generator '1' on device 'AD1':

              Phase: 0
              Range: -5.0 to +5.0 Volts
     TerminalConfig: SingleEnded
               Gain: 0
             Offset: 2
          Frequency: 4096
       WaveformType: Sine
     FrequencyLimit: [0.0 25000000.0]
               Name: ''
                 ID: '1'
             Device: [1x1 daq.di.DeviceInfo]
    MeasurementType: 'Voltage'

In a function generation channel, the Phase property specifies the waveform phase shift in degrees.

Example

Set the phase shift of a waveform function generation channel to 90°.

s = daq.createSession('digilent');
fgenCh = addFunctionGeneratorChannel(s, 'AD1', 1,'Sine');
fgenCh.Phase = 90
fgenCh = 

Data acquisition sine waveform generator '1' on device 'AD1':

              Phase: 90
              Range: -5.0 to +5.0 Volts
     TerminalConfig: SingleEnded
               Gain: 1
             Offset: 0
          Frequency: 4096
       WaveformType: Sine
     FrequencyLimit: [0.0 25000000.0]
               Name: ''
                 ID: '1'
             Device: [1x1 daq.di.DeviceInfo]
    MeasurementType: 'Voltage'

Specify the 0° resistance of the device in ohms. When you add an RTD channel, the resistance is initially unknown and the R0 property displays Unknown. Before any measurement, you must change this value to correspond to the resistance of the device. For more information, see https://en.wikipedia.org/wiki/Resistance_thermometer.

Example

Create a session and add an RTD channel.

s = daq.createSession('ni');
ch = addAnalogInputChannel(s,'cDAQ1Mod7',3,'RTD');

For a standard 100Ω probe, change the channel 0° resistance to 100Ω.

ch.R0 = 100
ch = 

Data acquisition analog input RTD channel 'ai3' on device 'cDAQ1Mod7':

            Units: Celsius
          RTDType: Unknown
 RTDConfiguration: Unknown
               R0: 100
ExcitationCurrent: 0.0005
 ExcitationSource: Internal
         Coupling: DC
   TerminalConfig: Differential
            Range: -200 to +660 Celsius
             Name: ''
               ID: 'ai3'
           Device: [1x1 daq.ni.CompactDAQModule]
  MeasurementType: 'RTD'
    ADCTimingMode: HighResolution

Specify the measurement range of a channel, as a vector of numeric values.

For analog channels, the value is dependent on the measurement type. This property is read-only for all measurement types except 'Voltage'. You can specify a range in volts for analog channels. Range is not applicable for counter channels.

Example: Specify the range of an analog input voltage channel

Create a session and add an analog input channel.

s = daq.createSession('ni');
ch = addAnalogInputChannel(s,'cDAQ1Mod7',3,'voltage');

Set a range of -60 to +60 volts.

ch.Range = [-60, 60];

Example: Examine supported ranges

Create a session and add an analog input channel.

s = daq.createSession('ni');
ch = addAnalogInputChannel(s,'Dev1',3,'voltage');

Display the channel device.

ch.Device
ans = 

ni: National Instruments USB-6211 (Device ID: 'Dev1')
   Analog input subsystem supports:
      4 ranges supported
      Rates from 0.1 to 250000.0 scans/sec
      16 channels ('ai0' - 'ai15')
      'Voltage' measurement type
   
   Analog output subsystem supports:
      -10 to +10 Volts range
      Rates from 0.1 to 250000.0 scans/sec
      2 channels ('ao0','ao1')
      'Voltage' measurement type
   
   Digital subsystem supports:
      8 channels ('port0/line0' - 'port1/line3')
      'InputOnly','OutputOnly' measurement types
   
   Counter input subsystem supports:
      Rates from 0.1 to 80000000.0 scans/sec
      2 channels ('ctr0','ctr1')
      'EdgeCount','PulseWidth','Frequency','Position' measurement types
   
   Counter output subsystem supports:
      Rates from 0.1 to 80000000.0 scans/sec
      2 channels ('ctr0','ctr1')
      'PulseGeneration' measurement type

View the device subsystems.

sub = ch.Device.Subsystems
sub = 

Analog input subsystem supports:
   4 ranges supported
   Rates from 0.1 to 250000.0 scans/sec
   16 channels ('ai0' - 'ai15')
   'Voltage' measurement type
Properties, Methods, Events

Analog output subsystem supports:
   -10 to +10 Volts range
   Rates from 0.1 to 250000.0 scans/sec
   2 channels ('ao0','ao1')
   'Voltage' measurement type
Properties, Methods, Events

Digital subsystem supports:
   8 channels ('port0/line0' - 'port1/line3')
   'InputOnly','OutputOnly' measurement types
Properties, Methods, Events

Counter input subsystem supports:
   Rates from 0.1 to 80000000.0 scans/sec
   2 channels ('ctr0','ctr1')
   'EdgeCount','PulseWidth','Frequency','Position' measurement types
Properties, Methods, Events

Counter output subsystem supports:
   Rates from 0.1 to 80000000.0 scans/sec
   2 channels ('ctr0','ctr1')
   'PulseGeneration' measurement type
Properties, Methods, Events

Display the ranges available on the analog input subsystem.

sub(1).RangesAvailable
ans = 

-0.20 to +0.20 Volts,-1.0 to +1.0 Volts,-5.0 to +5.0 Volts,-10 to +10 Volts

When you create an RTD channel, the wiring configuration is unknown and the RTDConfiguration property displays Unknown. You must change this to one of the following valid configurations:

  • TwoWire

  • ThreeWire

  • FourWire

Example: Specify an RTD channel wiring configuration

Create a session and add an RTD channel.

s = daq.createSession('ni');
ch = addAnalogInputChannel(s,'cDAQ1Mod7',3, 'RTD');

Change the RTDConfiguration to ThreeWire.

ch.RTDConfiguration = 'ThreeWire'
ch = 

Data acquisition analog input RTD channel 'ai3' on device 'cDAQ1Mod7':

            Units: Celsius
          RTDType: Unknown
 RTDConfiguration: ThreeWire
               R0: 'Unknown'
ExcitationCurrent: 0.0005
 ExcitationSource: Internal
         Coupling: DC
   TerminalConfig: Differential
            Range: -200 to +660 Celsius
             Name: ''
               ID: 'ai3'
           Device: [1x1 daq.ni.CompactDAQModule]
  MeasurementType: 'RTD'
    ADCTimingMode: HighResolution

Specify the sensitivity of a standard RTD sensor. A standard RTD sensor is defined as a 100–ohm platinum sensor.

When you create an RTD channel, the sensitivity is unknown and the RTDType property displays Unknown. You must change this to one of these supported values:

  • Pt3750

  • Pt3851

  • Pt3911

  • Pt3916

  • Pt3920

  • Pt3928

Example: Set an RTD sensor sensitivity type

Create a session and add an RTD channel.

s = daq.createSession('ni');
ch = addAnalogInputChannel(s,'cDAQ1Mod7',3,'RTD');

Set the RTDType property to Pt3851.

ch.RTDType = 'Pt3851'
ch = 

Data acquisition analog input RTD channel 'ai3' on device 'cDAQ1Mod7':

            Units: Celsius
          RTDType: Pt3851
 RTDConfiguration: ThreeWire
               R0: 'Unknown'
ExcitationCurrent: 0.0005
 ExcitationSource: Internal
         Coupling: DC
   TerminalConfig: Differential
            Range: -200 to +660 Celsius
             Name: ''
               ID: 'ai3'
           Device: [1x1 daq.ni.CompactDAQModule]
  MeasurementType: 'RTD'
    ADCTimingMode: HighResolution

Data Types: char | string

Specify the accelerometer or microphone sensor channel sensitivity.

Sensitivity in an accelerometer channel is expressed as volts per g-force, V/g.

Sensitivity in a microphone channel is expressed as volts per pascal, V/Pa.

Example

Create a session object, add an analog input channel, with a MeasurementType of 'accelerometer'.

s = daq.createSession('ni');
ch = addAnalogInputChannel(s ,'Dev4', 'ai0', 'accelerometer')
s = 
Data acquisition session using National Instruments hardware:
   Will run for 1 second (2000 scans) at 2000 scans/second.
   Number of channels: 1
      index Type Device Channel      MeasurementType             Range        Name
      ----- ---- ------ ------- -------------------------- ------------------ ----
      1     ai   Dev4   ai0     Accelerometer (PseudoDiff) -5.0 to +5.0 Volts

Change the channel Sensitivity to 10.2e-3 V/g:

ch.Sensitivity = 10.2e-3
s = 
Data acquisition session using National Instruments hardware:
   Will run for 1 second (2000 scans) at 2000 scans/second.
   Number of channels: 1
      index Type Device Channel      MeasurementType               Range          Name
      ----- ---- ------ ------- -------------------------- ---------------------- ----
      1     ai   Dev4   ai0     Accelerometer (PseudoDiff) -490 to +490 Gravities

On an analog input current channel, specify if the shunt resistor is located internally on the device or externally with a property value of 'Internal' or 'External'.

If your device supports an internal shunt resistor, this property is set to Internal by default. If the shunt location is external, you must specify the shunt resistance value.

Example

Set the shunt location of an analog input current channel.

Create a session and add an analog input current channel.

s = daq.createSession('ni')
ch = addAnalogInputChannel(s,'cDAQ1Mod7',0,'Current');

Set the ShuntLocation to Internal.

ch.ShuntLocation = 'Internal'
ch = 

Data acquisition analog input current channel 'ai0' on device 'cDAQ1Mod7':

  ShuntLocation: Internal
ShuntResistance: 20
       Coupling: DC
 TerminalConfig: Differential
          Range: -0.025 to +0.025 A
           Name: ''
             ID: 'ai0'
         Device: [1x1 daq.ni.CompactDAQModule]
MeasurementType: 'Current'
  ADCTimingMode: HighResolution

Data Types: char | string

Analog input current channel resistance in ohms. This value is automatically set if the shunt resistor is located internally on the device and is read-only.

Before starting an analog output channel with an external shunt resistor, specify the shunt resistance value.

Example

Set the shunt resistance of an analog input current channel.

Create a session and add an analog input current channel.

s = daq.createSession('ni')
ch = addAnalogInputChannel(s,'cDAQ1Mod7',0,'Current');

Set the ShuntLocation to External, and the ShuntResistance to 20 ohms.

ch.ShuntLocation = 'External';
ch.ShuntResistance = 20
ch = 

Data acquisition analog input current channel 'ai0' on device 'cDAQ1Mod7':

  ShuntLocation: External
ShuntResistance: 20
       Coupling: DC
 TerminalConfig: Differential
          Range: -0.025 to +0.025 A
           Name: ''
             ID: 'ai0'
         Device: [1x1 daq.ni.CompactDAQModule]
MeasurementType: 'Current'
  ADCTimingMode: HighResolution

This property is read-only.

The Terminal property indicates the counter subsystem’s corresponding PFI terminal.

Example: Determine Counter Input Channel Terminal

Create a session and add a counter input channel.

s = daq.createSession('ni');
ch = addCounterInputChannel(s,'cDAQ1Mod5','ctr0','PulseWidth');

Examine the Terminal property of the channel.

ch.Terminal
ans =

    PFI1

Use the TerminalConfig property to specify the configuration of your analog channel. The property displays the hardware default configuration. You can change this to one of the following:

  • SingleEnded

  • SingleEndedNonReferenced

  • Differential

  • PseudoDifferential

Example: Change the terminal configuration of an analog input channel

Create a session and add an analog input voltage channel.

s = daq.createSession('ni');
ch = addAnalogInputChannel(s,'dev5',0,'voltage')
ch = 

Data acquisition analog input voltage channel 'ai0' on device 'Dev5':

       Coupling: DC
 TerminalConfig: Differential
          Range: -10 to +10 Volts
           Name: ''
             ID: 'ai0'
         Device: [1x1 daq.ni.DeviceInfo]
MeasurementType: 'Voltage'

Change the channel TerminalConfig property to SingleEnded.

ch.TerminalConfig = 'SingleEnded'
ch = 

Data acquisition analog input voltage channel 'ai0' on device 'Dev5':

       Coupling: DC
 TerminalConfig: SingleEnded
          Range: -10 to +10 Volts
           Name: ''
             ID: 'ai0'
         Device: [1x1 daq.ni.DeviceInfo]
MeasurementType: 'Voltage'

Data Types: char | string

Specify the type of thermocouple you used in making your measurements. Select the type based on the temperature range and sensitivity you need, according to the NIST Thermocouple Types Definitions.

Supported ThermocoupleType values are:

  • 'J'

  • 'K'

  • 'N'

  • 'R'

  • 'S'

  • 'T'

  • 'B'

  • 'E'

By default the thermocouple type is 'Unknown'.

Example

Create a session and add an analog input channel with 'Thermocouple' measurement type.

s = daq.createSession('ni');
ch = addAnalogInputChannel(s,'cDAQ1Mod6','ai1','Thermocouple')
ch = 

Data acquisition analog input thermocouple channel 'ai1' on device 'cDAQ1Mod6':

           Units: Celsius
ThermocoupleType: Unknown
           Range: -210 to +1200 Celsius
            Name: ''
              ID: 'ai1'
          Device: [1x1 daq.ni.CompactDAQModule]
 MeasurementType: 'Thermocouple'
   ADCTimingMode: HighResolution

Set the ThermocoupleType property to 'J'.

ch.Thermocoupletype = 'J'
ch = 

Data acquisition analog input thermocouple channel 'ai1' on device 'cDAQ1Mod6':

           Units: Celsius
ThermocoupleType: J
           Range: -210 to +1200 Celsius
            Name: ''
              ID: 'ai1'
          Device: [1x1 daq.ni.CompactDAQModule]
 MeasurementType: 'Thermocouple'
   ADCTimingMode: HighResolution

Data Types: char | string

Specify the temperature unit of the analog input channel with RTD measurement type. Supported temperature units are:

  • Celsius (Default)

  • Fahrenheit

  • Kelvin

  • Rankine

Example

Set the unit of an RTD channel.

Create a session, add an analog input RTD channel, and display channel properties.

s = daq.createSession('ni');
ch = addAnalogInputChannel(s,'cDAQ1Mod7', 0, 'RTD')
ch = 

Data acquisition analog input RTD channel 'ai0' on device 'cDAQ1Mod7':

            Units: Celsius
          RTDType: Unknown
 RTDConfiguration: Unknown
               R0: 'Unknown'
ExcitationCurrent: 0.0005
 ExcitationSource: Internal
         Coupling: DC
   TerminalConfig: Differential
            Range: -200 to +660 Celsius
             Name: ''
               ID: 'ai0'
           Device: [1x1 daq.ni.CompactDAQModule]
  MeasurementType: 'RTD'
    ADCTimingMode: HighResolution

Change the Units property from Celsius to Fahrenheit Notice the impact on the Range property value.

ch.Units = 'Fahrenheit'
ch = 

Data acquisition analog input RTD channel 'ai0' on device 'cDAQ1Mod7':

            Units: Fahrenheit
          RTDType: Unknown
 RTDConfiguration: Unknown
               R0: 'Unknown'
ExcitationCurrent: 0.0005
 ExcitationSource: Internal
         Coupling: DC
   TerminalConfig: Differential
            Range: -328 to +1220 Fahrenheit
             Name: ''
               ID: 'ai0'
           Device: [1x1 daq.ni.CompactDAQModule]
  MeasurementType: 'RTD'
    ADCTimingMode: HighResolution

Data Types: char | string

This property is read-only.

Indicate the channel waveform type that was specified when the function generator channel was created. Supported waveform types are:

  • 'Sine'

  • 'Square'

  • 'Triangle'

  • 'RampUp'

  • 'RampDown'

  • 'DC'

  • 'Arbitrary'

Display the channel waveform type.

fgenCh.WaveformType
ans = 

    Sine

Data Types: char

Specify reset conditions for Z-indexing of counter Input 'Position' channels. Supported values are:

  • 'BothHigh'

  • 'BothLow'

  • 'AHigh'

  • 'BHigh'

Example: Specify Counter Channel Z Reset Condition

Create a session and add a counter input 'Position' channel.

s = daq.createSession('ni');
ch = addCounterInputChannel(s,'cDAQ1Mod5',0,'Position')
ch = 

Data acquisition counter input position channel 'ctr0' on device 'cDAQ1Mod5':

    EncoderType: X1
   ZResetEnable: 0
    ZResetValue: 0
ZResetCondition: BothHigh
      TerminalA: 'PFI0'
      TerminalB: 'PFI2'
      TerminalZ: 'PFI1'
           Name: ''
             ID: 'ctr0'
         Device: [1x1 daq.ni.CompactDAQModule]
MeasurementType: 'Position'

Change the channel ZResetCondition to 'BothLow'.

ch.ZResetCondition = 'BothLow'
ch = 

Data acquisition counter input position channel 'ctr0' on device 'cDAQ1Mod5':

    EncoderType: X1
   ZResetEnable: 0
    ZResetValue: 0
ZResetCondition: BothLow
      TerminalA: 'PFI0'
      TerminalB: 'PFI2'
      TerminalZ: 'PFI1'
           Name: ''
             ID: 'ctr0'
         Device: [1x1 daq.ni.CompactDAQModule]
MeasurementType: 'Position'

Data Types: char | string

Allow the Z-indexing to be reset on a counter input 'Position' channel, specified as false or true.

Example: Reset Z Indexing on Counter Channel

Create a session and add a counter input 'Position' channel.

s = daq.createSession('ni');
ch = addCounterInputChannel(s,'cDAQ1Mod5',0,'Position')
ch = 

Data acquisition counter input position channel 'ctr0' on device 'cDAQ1Mod5':

    EncoderType: X1
   ZResetEnable: 0
    ZResetValue: 0
ZResetCondition: BothHigh
      TerminalA: 'PFI0'
      TerminalB: 'PFI2'
      TerminalZ: 'PFI1'
           Name: ''
             ID: 'ctr0'
         Device: [1x1 daq.ni.CompactDAQModule]
MeasurementType: 'Position'

Change the ZResetEnable property value to true.

ch.ZResetEnable = true
ch = 

Data acquisition counter input position channel 'ctr0' on device 'cDAQ1Mod5':

    EncoderType: X1
   ZResetEnable: 1
    ZResetValue: 0
ZResetCondition: BothHigh
      TerminalA: 'PFI0'
      TerminalB: 'PFI2'
      TerminalZ: 'PFI1'
           Name: ''
             ID: 'ctr0'
         Device: [1x1 daq.ni.CompactDAQModule]
MeasurementType: 'Position'

Data Types: logical

Specify the reset value for Z-indexing on a counter input 'Position' channel.

Example

Create a session and add a counter input 'Position' channel.

s = daq.createSession('ni');
ch = addCounterInputChannel(s,'cDAQ1Mod5',0,'Position')
ch = 

Data acquisition counter input position channel 'ctr0' on device 'cDAQ1Mod5':

    EncoderType: X1
   ZResetEnable: 0
    ZResetValue: 0
ZResetCondition: BothHigh
      TerminalA: 'PFI0'
      TerminalB: 'PFI2'
      TerminalZ: 'PFI1'
           Name: ''
             ID: 'ctr0'
         Device: [1x1 daq.ni.CompactDAQModule]
MeasurementType: 'Position'

Change the ZResetValue to 62. Notice also the change in ZResetEnable.

ch.ZResetValue = 62
ch = 

Data acquisition counter input position channel 'ctr0' on device 'cDAQ1Mod5':

    EncoderType: X1
   ZResetEnable: 1
    ZResetValue: 62
ZResetCondition: BothHigh
      TerminalA: 'PFI0'
      TerminalB: 'PFI2'
      TerminalZ: 'PFI1'
           Name: ''
             ID: 'ctr0'
         Device: [1x1 daq.ni.CompactDAQModule]
MeasurementType: 'Position'

Version History

Introduced in R2010b