Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

addCounterInputChannel

Add counter input channel

Syntax

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

Description

example

addCounterInputChannel(s,deviceID,channelID) 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.

example

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

example

[ch,idx] = addCounterInputChannel(s,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.

Examples

collapse all

s = daq.createSession('ni')
ch = addCounterInputChannel(s,'cDAQ1Mod5','ctr0','EdgeCount');
ch.Terminal  % View device signal name for pin mapping.

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.
s = daq.createSession ('ni')
ch = addCounterInputChannel(s,'cDAQ1Mod5',[0 1 2],'EdgeCount');

Input Arguments

collapse all

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 acquisition operations.

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.

Data Types: char | 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 1 to '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 index 1, and so on.

Data Types: char | string | cell

Channel measurement type, specified as a character vector or string. measurementType represents a vendor-defined measurement type, and can include:

  • 'EdgeCount'

  • 'PulseWidth'

  • 'Frequency'

  • 'Position'

Data Types: char | string

Output Arguments

collapse all

Counter input channel that you add, returned as an object containing a 1-by-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.

Channel index returned as a numeric value. Through the index you can access the array of the session object Channels property.

Tips

The properties of the channel object are:

ActiveEdgeRising or falling edges of EdgeCount signals
ActivePulseActive pulse measurement of PulseWidth counter channel
CountDirectionSpecify direction of counter channel
DeviceChannel device information
EncoderTypeEncoding type of counter channel
IDID of channel in session
InitialCountSpecify initial count point
MeasurementTypeChannel measurement type
NameSpecify descriptive name for the channel
TerminalPFI terminal of counter subsystem
ZResetConditionReset condition for Z-indexing
ZResetEnableEnable reset for Z-indexing
ZResetValueReset value for Z-indexing

Introduced in R2011a

Was this topic helpful?