Class DigitalInput
Represents an operator that reads a sequence of logical values from one or more DAQmx digital input lines.
DigitalInput
configures and starts a data acquisition task for sampling logical values from one or more digital input lines. Logical values will be collected in a sample buffer, where each sample can represent either a single line or a bitmask representing the state of all digital lines in a single port, depending on the configuration of the virtual channel. Each row corresponds to a channel in the acquisition task, and each column to a sample from each of the channels. The order of the channels in the sample buffer follows the order in which you specify the channels in the Channels
property.
Digital lines can be grouped as a port when creating the local virtual channel, either by specifying a range of lines (e.g. Dev1/port0/line0:3
) or by specifying an entire port at once (e.g. Dev1/port0
).
If no input source is specified, samples will be collected asynchronously every time a new buffer is filled.
Alternatively, if an input observable sequence is provided, a new sample buffer will be collected every time a new notification is emitted by the input source.
Inherited Members
Namespace: Bonsai.DAQmx
Assembly: Bonsai.DAQmx.dll
Syntax
public class DigitalInput : Source<Mat>
Properties
| Improve this Doc View SourceActiveEdge
Gets or sets a value specifying on which edge of a clock pulse sampling takes place.
Declaration
public SampleClockActiveEdge ActiveEdge { get; set; }
Property Value
Type | Description |
---|---|
NationalInstruments.DAQmx.SampleClockActiveEdge |
BufferSize
Gets or sets the number of samples to acquire, for finite samples, or the size of the buffer for continuous sampling.
Declaration
public int BufferSize { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
Channels
Gets the collection of virtual input channels from which to read logical values.
Declaration
public Collection<DigitalInputChannelConfiguration> Channels { get; }
Property Value
Type | Description |
---|---|
Collection<DigitalInputChannelConfiguration> |
SampleMode
Gets or sets a value specifying whether the acquisition task will acquire a finite number of samples or if it continuously acquires samples.
Declaration
public SampleQuantityMode SampleMode { get; set; }
Property Value
Type | Description |
---|---|
NationalInstruments.DAQmx.SampleQuantityMode |
SampleRate
Gets or sets the sampling rate for reading logical values, in samples per second.
Declaration
public double SampleRate { get; set; }
Property Value
Type | Description |
---|---|
Double |
SamplesPerChannel
Gets or sets the number of samples per channel in each output buffer. If not specified, the number of samples will be set to the size of the buffer.
Declaration
public int? SamplesPerChannel { get; set; }
Property Value
Type | Description |
---|---|
Nullable<Int32> |
SignalSource
Gets or sets the optional source terminal of the clock. If not specified, the internal clock of the device will be used.
Declaration
public string SignalSource { get; set; }
Property Value
Type | Description |
---|---|
String |
Methods
| Improve this Doc View SourceGenerate()
Reads an observable sequence of logical values from one or more DAQmx digital input lines.
Declaration
public override IObservable<Mat> Generate()
Returns
Type | Description |
---|---|
IObservable<Mat> | A sequence of 2D Mat objects storing the logical values. Each row corresponds to a channel in the acquisition task, and each column to a sample from each of the channels. The order of the channels follows the order in which you specify the channels in the Channels property. Each sample can represent either a single line or a bitmask representing the state of all digital lines in a single port, depending on the configuration of the virtual channel. |
Overrides
Generate<TSource>(IObservable<TSource>)
Reads an observable sequence of logical values from one or more DAQmx digital input lines, where each new buffer is emitted only when an observable sequence emits a notification.
Declaration
public IObservable<Mat> Generate<TSource>(IObservable<TSource> source)
Parameters
Type | Name | Description |
---|---|---|
IObservable<TSource> | source | The sequence containing the notifications used for emitting sample buffers. |
Returns
Type | Description |
---|---|
IObservable<Mat> | A sequence of 2D Mat objects storing the logical values. Each row corresponds to a channel in the acquisition task, and each column to a sample from each of the channels. The order of the channels follows the order in which you specify the channels in the Channels property. Each sample can represent either a single line or a bitmask representing the state of all digital lines in a single port, depending on the configuration of the virtual channel. |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements in the |