Skip to Main Content Skip to Search
Product Documentation

addCounterInputChannel - Class: daq.Session
Package: daq

Add counter input channel

Syntax

s.addCounterInputChannel(deviceID, channelID, measurementType)
ch = s.addCounterInputChannel(deviceID, channelID, measurementType)
[ch, idx] = s.addCounterInputChannel(deviceID, channelID, measurementType)

Description

s.addCounterInputChannel(deviceID, channelID, measurementType) adds a counter channel on the device represented by deviceID, with the specified channelID, and channel measurement type, represented by measurementType, to the session s. Measurement types are vendor specific.

ch = s.addCounterInputChannel(deviceID, channelID, measurementType) returns the object ch.

[ch, idx] = s.addCounterInputChannel(deviceID, channelID, measurementType) returns the object ch, representing the channel that was added and the index, idx, which is an index into the array of the session object's Channels property.

Tips

Use daq.createSession to create a session object before you use this method.

Input Arguments

deviceID

Specify the vendor-defined ID of the device. The specified channel is created for this device. Obtain by calling daq.getDevices.

channelID

Specify the ID of the channel added to the device. You can also add a range of channels.

For NI devices, use either a terminal name, like 'ctr2', or a numeric equivalent like 2 for the channel ID.

measurementType

Specify a string that represents a vendor-defined measurement type. Measurement types include:

  • 'EdgeCount'

  • 'PulseWidth'

  • 'Frequency'

  • 'Position'

To see a list of all measurement types supported by a device, type daq.getDevices and then click on the device in the list.

Output Arguments

ch

Object representing the channel you added.

idx

An index into the array of the session object's Channels property.

Properties

Examples

Add a counter input EdgeCount channel:

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

Add a counter input Frequency channel. Specify output arguments to represent the channel object and the index:

s = daq.createSession ('ni')
[ch, idx] = s.addCounterInputChannel('cDAQ1Mod5',1,'Frequency')

Add counter input channels 0, 2, and 4:

s = daq.createSession ('ni')
s.addCounterInputChannel('cDAQ1Mod5',[0 2 4], 'EdgeCount');
 

See Also

daq.Session | daq.Session.inputSingleScan | daq.Session.removeChannel | daq.Session.startBackground | daq.Session.startForeground

How To

  


Recommended Products

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

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