(Not recommended) Add counter input channel
Add a Counter Input Edgecount Channel
s = daq.createSession('ni') ch = addCounterInputChannel(s,'cDAQ1Mod5','ctr0','EdgeCount'); ch.Terminal % View device signal name for pin mapping.
Add a Counter Input Frequency Channel
Specify output arguments to represent the channel object and the index.
s = daq.createSession('ni') [ch,idx] = addCounterInputChannel(s,'cDAQ1Mod5',1,'Frequency'); ch.Terminal % View device signal name for pin mapping.
Add Multiple Counter Input Channels
s = daq.createSession ('ni') ch = addCounterInputChannel(s,'cDAQ1Mod5',[0 1 2],'EdgeCount');
s — Data acquisition session
Data acquisition session, specified as a session object. Create the
session object using
daq.createSession. Use the data
acquisition session for acquisition and generation operations. Create one
session per vendor and use that vendor session to perform all data
deviceID — Device ID
character vector or string
Device ID as defined by the device vendor, specified as a character vector
or string. Obtain the device ID by calling
daq.getDevices. The channel
specified for this device is created for the session object.
channelID — Channel ID
numeric value, character vector, or string
Channel ID specified as a numeric value, character vector, or string,
corresponding to the specific counter channel on the device added to the
session. Channel ID
0 corresponds to the device counter
'ctr0', Channel ID
'ctr1', and so on. For the related device signal
names and physical pins, see the pinout for your particular device.
You can add a range of channels by specifying the channel ID with a numeric array, or an array of character vectors or strings.
The index for a channel displayed in the session indicates the channel’s
position in the session. The first channel you add in a session has session
1, and so on.
measurementType — Channel measurement type
character vector or string
Channel measurement type, specified as a character vector or string.
measurementType represents a vendor-defined
measurement type, and can include:
ch — Counter input channel object
Counter input channel that you add, returned as an object containing a
n array of vendor specific channel specific
information. Use this channel object to access device and channel
properties. For more information on the properties, see Properties.
idx — Channel index
Channel index returned as a numeric value. Through the index you can
access the array of the session object
The properties of the channel object are:
|ActiveEdge||Rising or falling edges of EdgeCount signals|
|ActivePulse||Active pulse measurement of PulseWidth counter channel|
|CountDirection||Specify direction of counter channel|
|Device||Channel device information|
|EncoderType||Encoding type of counter channel|
|ID||ID of channel in session|
|InitialCount||Specify initial count point|
|MeasurementType||Channel measurement type|
|Name||Specify descriptive name for the channel|
|Terminal||PFI terminal of counter subsystem|
|ZResetCondition||Reset condition for Z-indexing|
|ZResetEnable||Enable reset for Z-indexing|
|ZResetValue||Reset value for Z-indexing|
Version HistoryIntroduced in R2011a
session object interface is not recommended
Use of this function with a
session object is not recommended. To
access a data acquisition device, use a
with its functions and properties instead.
For more information about using the recommended functionality, see Transition Your Code from Session to DataAcquisition Interface.