Labjack U6 100 Gain for Differential Channel


aburke3
 Share

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share