# EngArrayToWinBuf()

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

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

This method is usually used to obtain values compatible with the AOutScan() method or the DaqOutScan() method from a 2D array of engineering unit values, such as those provided by Measurement Studio signal generation methods. The converted values are transferred to the buffer based on the gain, firstPoint, count, and numChannels parameters.

Member of the MccBoard class.

## Function Prototype

VB .NET

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

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

C# .NET

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

public MccDaq.ErrorInfo EngArrayToWinBuf(MccDaq.Range[] GainArray, int GainCount, double [,] EngUnits, IntPtr MemHandle, 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 EngArrayToWinBuf(ByVal gain As MccDaq.Range, ByVal engUnits As Double(,), ByVal memHandle As Integer, ByVal firstPoint As Integer, ByVal count As Integer, ByVal numChannels As Integer) As MccDaq.ErrorInfo

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

C# .NET

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

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

## Parameters

gain

The range to use for converting the data. This range should be the same as the range specified for AOutScan() or DaqOutScan().

gainArray

The array containing the D/A range values used during the analog output 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 DaqOutScan().

If the corresponding range in the gainArray is set to NotUsed (MccDaq.Range.NotUsed), engineering unit values are returned as integer 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 DaqOutScan().

engUnits

The array of data to convert to binary units and store in the windows memory buffer. With the engUnits array, the channel numbers are stored in the first dimension, and the number of points/channel is stored in the second dimension.

memHandle

The handle to the windows memory buffer that holds the binary data that is output. This value should be large enough to hold (count x numChannels) samples.

firstPoint

The index into the windows memory buffer that will hold the first sample of the converted first channel. The index into the raw memory is (firstPoint x 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 from 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

- An ErrorInfo object that indicates the status of the operation.

## Notes

- This method stores the samples specified by firstPoint in the windows memory buffer. Each sample is converted using the ranges set by gain.
- If the corresponding range in the gainArray is set to NotUsed, engineering unit values are returned as integer values.