WinBufToEngArray()

Transfers integer values from a Windows buffer to a 2D array as engineering unit values.

The conversion from integer values to engineering unit values uses the A/D resolution of the board associated with the MccBoard object.

This method is usually used to obtain values compatible with those required by Measurement Studio waveform display controls from a Windows buffer containing data from a method such as AInScan() or DaqInScan(). The converted values are transferred to the 2D array based on the gain, firstPoint, count, and numChannels parameters.

Member of the MccBoard class.

Function Prototype

VB .NET

Public Function WinBufToEngArray(ByVal gain As MccDaq.Range, ByVal memHandle As IntPtr, ByVal engUnits As Double(,), ByVal firstPoint As Integer, ByVal count As Integer, ByVal numChannels As Integer) As MccDaq.ErrorInfo



Public Function WinBufToEngArray(ByVal gainArray As MccDaq.Range(), ByVal gainCount As Integer, ByVal memHandle As IntPtr, ByVal engUnits As Double(,), ByVal firstPoint As Integer, ByVal count As Integer, ByVal numChannels As Integer) As MccDaq.ErrorInfo




C# .NET

public MccDaq.ErrorInfo WinBufToEngArray(ccDaq.Range Gain, IntPtr MemHandle, double[,] EngUnits, int FirstPoint, int Count, int NumChannels)



public MccDaq.ErrorInfo WinBufToEngArray(MccDaq.Range[] GainArray, int GainCount, IntPtr MemHandle, double[,] EngUnits, int FirstPoint, int Count, int NumChannels)



Deprecated methods

The following methods are deprecated, and should only be used for legacy applications. The methods above are preferred, and must be used for 64-bit application development.

VB .NET

Public Function WinBufToEngArray(ByVal gain As MccDaq.Range, ByVal memHandle As Integer, ByVal engUnits As Double(,), ByVal firstPoint As Integer, ByVal count As Integer, ByVal numChannels As Integer) As MccDaq.ErrorInfo



Public Function WinBufToEngArray(ByVal gainArray As MccDaq.Range(), ByVal gainCount As Integer, ByVal memHandle As Integer, ByVal engUnits As Double(,), ByVal firstPoint As Integer, ByVal count As Integer, ByVal numChannels As Integer) As MccDaq.ErrorInfo




C# .NET

public MccDaq.ErrorInfo WinBufToEngArray(MccDaq.Range gain, int memHandle, double[,] engUnits, int firstPoint, int count, int numChannels)



public MccDaq.ErrorInfo WinBufToEngArray(MccDaq.Range gainArray, int gainCount, int memHandle, double[,] engUnits, int firstPoint, int count, int numChannels)

Parameters

gain

The range to use for converting scan data. This value should be the same as the range specified for AInScan() or DaqInScan().

gainArray

The array containing the A/D range values used during the analog input scan.

If a gain queue was not used for the scan, this array should only contain 1 element whose value matches the gain used during the scan. If a gain queue was used during the scan, this array should match the gainArray value used in ALoadQueue() or DaqInScan().

If the corresponding range in the gainArray is set to NotUsed (MccDaq.Range.NotUsed), raw data is returned in engineering unit values.

gainCount

The number of array elements in gainArray. Set gainCount to 1 when no gain queue was used for the scan. If a gain queue was used for the scan, this number should match the number of gain queue pairs defined in ALoadQueue() or DaqInScan().

memHandle

The handle to the memory buffer holding the raw data to be converted to engineering units. This value should be large enough to hold (count x numChannels) samples.

engUnits

The array to hold the converted data. This array must be allocated by the user, and must be large enough to hold count samples. The first dimension should be the number of channels. The second dimension should equal the number of points/channel.

firstPoint

The index into the raw data memory buffer that holds the first sample of the first channel to be converted. The index into the raw memory is (firstPoint × numChannels) so that converted data always starts with the first channel specified in the scan. For example, if firstPoint is 14 and the number of channels is 8, the index of the first converted sample is 112.

count

The number of samples per channel to convert to engineering units. count should not exceed Windows buffer size / (numChannels – firstPoint).

numChannels

The number of channels of data stored in the existing array to be transferred.

Returns

Notes