Skip to main content
Skip table of contents

4.1.3 - Analog Inputs [UE9 Datasheet]

The AIN can be read using AddRequest, Go/GoOne, and GetResult/GetNextResult. eGet or eAddGoGet could also be used.

The IOType to retrieve a command/response analog input reading is:


The following are IOTypes used to configure (or read) the input range of a particular analog input channel:

LJ_ioPUT_AIN_RANGE // Range and Gain are synonymous
LJ_ioGET_AIN_RANGE // Range and Gain are synonymous

In addition to specifying the channel number, the following range constants are passed in the value parameter when doing a request with the AIN range IOType:

LJ_rgUNI5V // 0-5 V, LabJackUD Default
LJ_rgUNI2P5V // 0-2.5 V (not supported with resolution=18)
LJ_rgUNI1P25V // 0-1.25 V (not supported with resolution=18)
LJ_rgUNIP625V // 0-0.625 V (not supported with resolution=18)
LJ_rgBIP5V // +/- 5 V

The following are special channels, used with the get/put config IOTypes, to configure parameters that apply to all analog inputs:


Following is example pseudocode to configure and read two analog inputs:

//Configure all analog inputs for 14-bit resolution. Like most
//settings, this will apply to all further measurements until
//the parameter is changed or the DLL unloaded.
AddRequest (lngHandle, LJ_ioPUT_CONFIG, LJ_chAIN_RESOLUTION, 14, 0, 0);

//Configure AIN2 for +/- 5 volt range.
AddRequest (lngHandle, LJ_ioPUT_AIN_RANGE, 2, LJ_rgBIP5V, 0, 0);

//Configure AIN3 for +/- 5 volt range.
AddRequest (lngHandle, LJ_ioPUT_AIN_RANGE, 3, LJ_rgBIP5V, 0, 0);

//Request a read from AIN2.
AddRequest (lngHandle, LJ_ioGET_AIN, 2, 0, 0, 0);

//Request a read from AIN3.
AddRequest (lngHandle, LJ_ioGET_AIN, 3, 0, 0, 0);

//Execute the requests.
GoOne (lngHandle);

//Get the AIN2 voltage.
GetResult (lngHandle, LJ_ioGET_AIN, 2, &dblValue);

//Get the AIN3 voltage.
GetResult (lngHandle, LJ_ioGET_AIN, 3, &dblValue);

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.