« Close

Datasheets and User Guides

App Notes

Software & Driver


4.3.3 - Analog Inputs

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);


Does the caveat in the third code snippet about UE9-Pro support apply to all resolutions, or just to the maximum value of 18?

Good catch.  If you use the high-speed converter on a UE9-Pro (resolution=0-17), it still supports all the ranges.  Only the high-res converter (resolution=18) is limited to 0-5V or +/-5V.