# FromEngUnits()

Converts a single precision voltage (or current) value in engineering units to an integer count value. This function is typically used to obtain a data value from a voltage value for output to a D/A with methods such as AOut().

Member of the MccBoard class.

## Function Prototype

VB .NET

Public Function FromEngUnits(ByVal range As MccDaq.Range, ByVal engUnits As Single, ByRef dataVal As Short) As MccDaq.ErrorInfo

Public Function FromEngUnits(ByVal range As MccDaq.Range, ByVal engUnits As Single, ByRef dataVal As System.UInt16) As MccDaq.ErrorInfo

C# .NET

public MccDaq.ErrorInfo FromEngUnits(MccDaq.Range range, float engUnits, out ushort dataVal)

public MccDaq.ErrorInfo FromEngUnits(MccDaq.Range range, float engUnits, out short dataVal)

## Parameters

range

The voltage (or current) range to use for the conversion to counts. When using this method to obtain a value to send to a D/A board, keep in mind that some D/A boards have programmable voltage ranges, and others set the voltage range via switches on the board. In either case, the desired range must be passed to this method. Refer to board-specific information for a list of valid range settings.

engUnits

The single precision voltage (or current) value to use for the conversion to counts. Set the value to be within the range specified by the range parameter.

dataVal

Returns an integer count to this variable that is equivalent to the engUnits parameter using the resolution of the D/A on the board (if any).

## Returns

- An ErrorInfo object that indicates the status of the operation.
- dataVal – the integer count equivalent to engUnits is returned here.

## Notes

- This method is not supported for hardware with resolution greater than 16 bits.
- The default resolution of this method is 12 bits, so if the device has neither analog input nor analog output, the result is a 12 bit conversion.
- If the device has both analog input and analog output, the resolution and transfer function of the D/A converter on the device is used.