Labjack U6 100 Gain for Differential Channel


aburke3

Recommended Posts

Hello all,

I'm trying to measure a 0-40mV signal with a differential setting using channels AIN2 and AIN3 in addition to measuring a 0-5V signal on AIN1. I've read tutorials but can't seem to get my 100 gain setting for channels 2 and 3 to work, the output I'm getting doesn't seem to be multiplied by 100. I pulled the following code from a combination of tutorials, could someone troubleshoot this?

From https://labjack.com/support/datasheets/u6/high-level-driver/example-pseudocode/analog-inputs

//Configure all analog inputs for max 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, 12, 0, 0);

//Configure AIN1 for +/- 10 volt range.
AddRequest (lngHandle, LJ_ioPUT_AIN_RANGE, 1, LJ_rgBIP10V, 0, 0);

//Configure AIN2 for +/- 0.1 volt range.  This applies to any
//reading, single-ended or differential, where the positive
//channel is AIN2.
AddRequest (lngHandle, LJ_ioPUT_AIN_RANGE, 2, LJ_rgBIPP1V, 0, 0);

//Request a single-ended read from AIN1.
AddRequest (lngHandle, LJ_ioGET_AIN, 1, 0, 0, 0);

//Request a differential read of AIN2-AIN3.
AddRequest (lngHandle, LJ_ioGET_AIN_DIFF, 2, 0, 3, 0);

//Request a single-ended read of AIN2.  Here we use the DIFF
//IOType, but pass x1=199 which does a single-ended measurement.
AddRequest (lngHandle, LJ_ioGET_AIN_DIFF, 2, 0, 199, 0);

//Execute the requests.
GoOne (lngHandle);

//Since multiple requests were made with the same IOType
//and Channel, and only x1 was different, GetFirst/GetNext
//must be used to retrieve the results.  The simple
//GetResult function does not use the x1 parameter and
//thus there is no way to specify which result is desired.
//Rather than specifying the IOType and Channel of the
//result to be read, the GetFirst/GetNext functions retrieve
//the results in order.  Normally, GetFirst/GetNext are best
//used in a loop, but here they are simply called in succession.

//Retrieve AIN1 voltage.  GetFirstResult returns the IOType,
//Channel, Value, x1, and UserData from the first request.
//In this example we are just retrieving the results in order
//and Value is the only parameter we need.
GetFirstResult (lngHandle, 0, 0, &dblValue, 0, 0);

//Get the AIN2-AIN3 voltage.
GetNextResult (lngHandle, 0, 0, &dblValue, 0, 0);

//Get the AIN2.
GetNextResult (lngHandle, 0, 0, &dblValue, 0, 0);

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.