MC DAQ Read.vi
- Updated2023-02-21
- 13 minute(s) read
MC DAQ Read.vi
Purpose
Reads samples from a Measurement task.
Format
Input
![]() |
DAQ ref in is the task reference from the previous Measurement task VI. The task reference is originally returned from MC DAQ Initialize.vi, and then wired through subsequent Measurement task VIs. | ||||||
![]() |
Number of samples specifies the number of samples to read for the Measurement task. For single-sample Poly VI types, MC DAQ Read.vi always returns one sample, so this input is ignored. | ||||||
![]() |
Error in is a cluster which describes error conditions occurring before the VI executes. If an error has already occurred, the VI returns the value of the error in cluster to error out.
|
Output
![]() |
Raw value is a poly output that returns the raw samples (no scaling) read from the received CAN messages of the DAQ list. This output only provides data for channels that were defined as raw measurements during the initialization of the DAQ list. The type of the poly output is determined by the poly VI selection. For information on the different poly VI types provided by MC DAQ Read.vi, refer to the Poly VI Types in the Description section.
To select the data type, right-click the VI, go to Select Type, and select the type by name. |
||||||
![]() |
DAQ ref out is the same as DAQ ref in. Wire the task reference to subsequent VIs for this task. | ||||||
![]() |
Number of samples returned indicates the number of samples returned in the value output. | ||||||
![]() |
Value is a poly output that returns the scaled samples read from the received CAN messages of the DAQ list. This output only provides data for channels that were defined as (scaled) measurements during the initialization of the DAQ list. The type of the poly output is determined by the poly VI selection. For information on the different poly VI types provided by MC DAQ Read.vi, refer to Poly VI Types in the Description section.
To select the data type, right-click the VI, go to Select Type, and select the type by name. |
||||||
![]() |
Error out describes error conditions. If the Error in cluster indicated an error, the Error out cluster contains the same information. Otherwise, Error out describes the error status of this VI.
|
Description
Poly VI Types
The name of each Poly VI type uses the following conventions:
- The first term is either 1Chan or NChan. This indicates whether the type returns data for a single scaled and raw channel or multiple channels. NChan types return an array of analogous 1Chan types, one entry for each channel initialized in channel list of MC DAQ Initialize.vi. 1Chan types are convenient because no array indexing is required, but you are limited to reading only one scaled and one raw channel. If no scaled or no raw channel was defined, then you only read one channel.
- The second term is either 1Samp or NSamp. This indicates whether the type returns a single sample, or an array of multiple samples. 1Samp types are often used for single point control applications, such as within LabVIEW RT.
- The third term indicates the data type used for each sample. The type Double indicates double-precision (64-bit) floating point for the value output and the raw value output is always of type unsigned 64-bit integer. The type Waveform indicates the waveform data type for the value output and has no raw value output. The types 1D and 2D indicate one and two-dimensional arrays, respectively.
1Chan 1Samp Double
Returns a single sample for the first (scaled and raw) channels initialized in channel lists. If the initialized sample rate is greater than zero, this poly VI type waits for the next sample time, and then returns a single sample. This enables you to execute a control loop at a specific rate. If the initialized sample rate is zero, this poly VI immediately returns a single sample. The value output returns a single sample from the most recent message received. If no message has been received since you started the task, the value of 0 is returned in value. You can use error out to determine whether a new message has been received since the previous call to MC DAQ Read.vi (or MC DAQ Start Stop.vi). If no message has been received, the warning code 3FF60009 hex is returned in error out. If a new message has been received, the success code 0 is returned in error out. Unless an error occurs, number of samples returned is one.
NChan 1Samp 1D Double
Returns an array, one entry for each channel initialized in the channel lists. Each entry consists of a single sample. The order of channel entries in value/raw value is the same as the order in the original channel lists. If the initialized sample rate is greater than zero, this poly VI type waits for the next sample time, then returns a single sample for each channel. This enables you to execute a control loop at a specific rate. If the initialized sample rate is zero, this poly VI immediately returns a single sample for each channel. The value output returns a single sample for each channel from the most recent message received. If no message has been received for a channel since you started the task a 0 is returned in value. You can specify channels in channel lists that span multiple messages. A sample from the most recent message is returned for all channels. You can use error out to determine whether a new message has been received since the previous call to MC DAQ Read.vi (or MC DAQ Start Stop.vi). If no message has been received for one or more channels, the warning code 3FF60009 hex is returned in error out. If a new message has been received for all channels, the success code 0 is returned in error out. Unless an error occurs, number of samples returned is one. The value array is indexed by channel, and the entry for each channel contains a single sample. If you need to determine the number of channels in the task after initialization, get the Number of Channels and Number of Raw Channels properties for the task reference.
1Chan NSamp 1D Double
Returns an array of samples for the first (scaled and raw) channels initialized in channel lists. The initialized sample rate must be greater than zero for this poly VI, because each sample in the array indicates the value of the CAN channel at a specific point in time. In other words, the sample rate specifies a virtual clock that copies the most recent value from CAN messages for each sample time. The changes in sample values from message to message enable you to view the CAN channel over time, such as for comparison with other CAN or DAQ input channels. This VI waits until all samples arrive in time before returning.
If the initialized sample rate is zero, this poly VI returns an error. If the intent is simply to read the most recent sample for a task, use the 1Chan 1Samp Double type. If no message has been received since you started the task a 0 is returned in all entries of the value array. You can use error out to determine whether a new message has been received since the previous call to MC DAQ Read.vi (or MC DAQ Start Stop.vi). If no message has been received, the warning code 3FF60009 hex is returned in error out. If a new message has been received, the success code 0 is returned in error out. Unless an error occurs, the number of samples returned is equal to number of samples to read.
NChan NSamp 2D Double
Returns an array, one entry for each channel initialized in channel lists. Each entry consists of an array of values. The order of channel entries in value/raw value is the same as the order in the original channel lists. The initialized sample rate must be greater than zero for this poly VI, because each sample in the array indicates the value of each CAN channel at a specific point in time. In other words, the sample rate specifies a virtual clock that copies the most recent value from CAN messages for each sample time. The changes in sample values from message to message enable you to view the CAN channels over time, such as for comparison with other CAN or DAQ input channels. This VI waits until all samples arrive in time before returning.
If the initialized sample rate is zero, this poly VI returns an error. If the intent is simply to read the most recent samples for a task, use the NChan 1Samp 1D Double type. If no message has been received for a channel since you started the task, the Default Value of the channel is returned in value/raw value. You can specify channels in channel lists that span multiple messages. At each point in time, a sample from the most recent message is returned for all channels. You can use error out to determine whether a new message has been received since the previous call to MC DAQ Read.vi (or MC DAQ Start Stop.vi). If no message has been received for one or more channels, the warning code 3FF60009 hex is returned in error out. If a new message has been received for all channels, the success code 0 is returned in error out. Unless an error occurs, the number of samples returned is equal to number of samples to read. If you need to determine the number of channels in the task after initialization, get the Number of Channels and Number of Raw Channels properties for the task reference.
1Chan NSamp Waveform
Returns a single waveform for the first scaled channel initialized in scaled channel list. Raw channels are not supported for this type. The initialized sample rate must be greater than zero for this poly VI, because each sample in the array indicates the value of the CAN channel at a specific point in time. In other words, the sample rate specifies a virtual clock that copies the most recent value from CAN messages for each sample time. The changes in sample values from message to message enable you to view the CAN channel over time, such as for comparison with other CAN or DAQ input channels. This VI waits until all samples arrive in time before returning. The start time of a waveform indicates the time of the first CAN sample in the array. The delta time of a waveform indicates the time between each sample in the array, as determined by the original sample rate.
If the initialized sample rate is zero, this poly VI returns an error. If the intent is to simply read the most recent sample for a task, use the 1Chan 1Samp Double type. If no message has been received since you started the task a 0 is returned in all entries of the value/raw value waveform. You can use error out to determine whether a new message has been received since the previous call to MC DAQ Read.vi (or MC DAQ Start Stop.vi). If no message has been received, the warning code 3FF60009 hex is returned in error out. If a new message has been received, the success code 0 is returned in error out. Unless an error occurs, the number of samples returned is equal to number of samples to read.
NChan NSamp 1D Waveform
Returns an array, one entry for each channel initialized in scaled channel list. Raw channels are not supported for this type. Each entry consists of a single waveform. The order of channel entries in value is the same as the order in the original channel list. The initialized sample rate must be greater than zero for this poly VI, because each sample in the array of a waveform indicates the value of the CAN channel at a specific point in time. In other words, the sample rate specifies a virtual clock that copies the most recent value from CAN messages for each sample time. The changes in sample values from message to message enable you to view the M&C DAQ channel over time, such as for comparison with other CAN or DAQ input channels. This VI waits until all samples arrive in time before returning. The start time for each waveform indicates the time of the first CAN sample in the array. The delta time of a waveform indicates the time between each sample in the array, as determined by the original sample rate.
If the initialized sample rate is zero, this poly VI returns an error. If the intent is simply to read the most recent samples for a task, use the NChan 1Samp 1D Double type. If no message has been received for a channel since you started the task a 0 is returned in value/raw value. You can specify channels in channel lists that span multiple messages. At each point in time, a sample from the most recent message is returned for all channels. You can use error out to determine whether a new message has been received since the previous call to MC DAQ Read.vi (or MC DAQ Start Stop.vi). If no message has been received for one or more channels, the warning code 3FF60009 hex is returned in error out. If a new message has been received for all channels, the success code 0 is returned in error out. Unless an error occurs, the number of samples returned is equal to number of samples to read. If you need to determine the number of channels in the task after initialization, get the Number of Channels property for the task reference.
NChan NSamp 2D Double time stamped
Returns an array with one entry for each channel initialized in the channel lists. Each entry consists of an array of clusters. Each cluster corresponds to a received signal for the channels initialized in the channel lists. Each cluster contains the sample value and a timestamp that indicates when the measurement channel was received. The order of channel entries in samples is the same as the order in the original channel lists. To use this type, you must set the initialized mode to time stamped read. The VI does not wait for messages, but instead returns samples from the messages received since the previous call to MC DAQ Read.vi. The number of samples returned is indicated in the number of samples returned output, up to a maximum of number of samples to read messages. If no new message has been received, the number of samples returned is 0, and error out indicates success.
Because the timing of values in samples is determined by when the message is received, the sample rate input is not used with this poly VI type. To determine the number of channels in the task after initialization, get the Number of Channels and Number of Raw Channels properties for the task reference.
NChan NSamp Time-Value XY Array
Returns an array of clusters with one entry for each channel initialized in the channel lists. Each entry consists of a cluster of a timestamp array and a value (double/unsigned 64-bit integer) array. The timestamp and value arrays have N data points each, one for each sample returned. The timestamp sample indicates when the respective measurement sample was received. The order of channel entries in samples is the same as the order in the original channel lists. You can wire the output of this type directly to a LabVIEW XY graph display. To use this type, you must set the initialized mode to timestamped read. The VI waits for Number of samples messages. The number of samples returned is indicated in the number of samples returned output, up to a maximum of number of samples to read messages. If no new message has been received, the number of samples returned is 0, and error out indicates success. To avoid blocking, use mcPropDAQ_SamplesPending to check the number of available data points.
Because the timing of values in samples is determined by when the message is received, the sample rate input is not used with this poly VI type. To determine the number of channels in the task after initialization, get the Number of Channels and Number of Raw Channels properties for the task reference.