4.2.17 - eAIN() [UE9 Datasheet] | LabJack
« Close

Datasheets and User Guides

App Notes

Software & Driver


4.2.17 - eAIN() [UE9 Datasheet]

An easy function that returns a reading from one analog input. This is a simple alternative to the very flexible IOType based method normally used by this driver.

When needed, this function automatically configures the specified channel(s) for analog input.


LJ_ERROR _stdcall eAIN (  LJ_HANDLE Handle,
                          long ChannelP,
                          long ChannelN,
                          double *Voltage,
                          long Range,
                          long Resolution,
                          long Settling,
                          long Binary,
                          long Reserved1,
                          long Reserved2)

Parameter Description:
Returns: LabJack errorcodes or 0 for no error.

  • Handle – Handle returned by OpenLabJack().
  • ChannelP – The positive AIN channel to acquire.
  • ChannelN – The negative AIN channel to acquire. For the UE9, this parameter is ignored. For single-ended channels on the U3, this parameter should be 31 (see Section 2.7.1).
  • Range – Pass a range constant. See Section 4.3.3.
  • Resolution – Pass 12-17 to specify the resolution of the analog input reading, and 18 for a high-res reading from the UE9-Pro. 0-11 corresponds to 12-bit.
  • Settling – Pass 0 for the default settling. This parameter adds extra settling before the ADC conversion of about Settling times 5 microseconds.
  • Binary – If this is nonzero (True), the Voltage parameter will return the raw binary value.
  • Reserved (1&2) – Pass 0.


  • Voltage – Returns the analog input reading, which is generally a voltage.


What version of the LJUDOTNET is this documentation for. The version I am using lists it as "3.24" and it doesn't match this documentation. Do I have an old version?

this is the signature for what I have and for some(yet to be determined) reason will not compile.

public static LJUD.LJUDERROR eAIN(int handle, int channelP, int channelN, ref double voltage, int range, int resolution, int settling, int binary);

The LJUDDotNet version should basically match the documentation found here with a few exceptions, since it is a wrapper to the LabJackUD.dll version of that function (which is defined here).  First, the reserved values at the end of the function weren't being used for anything, so they are not included in the .NET wrapper. 

The .NEW wrapper also uses enumerated types for the constants, so if you are passing something like LJUD.RANGES.BIP1V for the 5th parameter, you need to cast that to an int by adding (int) before it. 

If you are getting a different error when compiling and that cast doesn't fix it, you can send the line of code with the error to [email protected] and we should be able to give you a quick answer.