4.1 - Overview [UE9 Datasheet] | LabJack
 
« Close

Datasheets and User Guides

App Notes

Software & Driver

 
Saturday/Sunday, March 28th&29th, 2020
Support: LabJack engineers available through email and chat.
Shipping: We are processing and shipping all orders.
Stock: 55/56 products in stock.
Supply Chain: Some disruptions.

4.1 - Overview [UE9 Datasheet]

Quick Overview

The UD driver has just a handful of functions, and those functions all have the same 4-6 parameters.

Functions

The main functions are used to build a list of requests (Add), execute the list (Go), and read the result of each request (Get).  Some functions (e.g. eGet) combine Add-Go-Get into a single function call.

Parameters

The parameters are described at the bottom of the Overview page.  Usually the meaning of each parameter should be apparent (e.g. Channel is the channel number you are operating on), but when it is not the applicable pseudocode section (4.3) should have any extra information that is needed.

  • Handle:  Always the handle.
  • IOType:  Always the IOType.
  • Channel:  If something besides a channel number the pseudocode section will tell you.
  • Value:  Always the value.
  • X1:  Usually not used, but if used the pseudocode section will tell you.
  • UserData:  Usually not used, but if used the pseudocode section will tell you.

Extended Overview

The LabJackUD driver is the Windows driver/library for the UE9, and also the U3 and U6. LabJackUD is also referred to as UD and LJUD.

For other LabJack devices, go to the Software page.

To download, see: UD Installer.

The general operation of the LabJackUD functions is as follows:

  • Open a LabJack UE9, U3 or U6.
  • Build a list of requests to perform (Add).
  • Execute the list (Go).
  • Read the result of each request (Get).

For example, to write an analog output and read an analog input:

//Use one of the following lines to open the first found LabJack UE9
//over USB or Ethernet and get a handle to the device.
//The general form of the open function is:
//OpenLabJack (DeviceType, ConnectionType, Address, FirstFound, *Handle)

//Open the first found LabJack UE9 over USB.
lngErrorcode = OpenLabJack (LJ_dtUE9, LJ_ctUSB, "1", 1, &lngHandle);
// … or open a specified LabJack UE9 over Ethernet.
lngErrorcode = OpenLabJack (LJ_dtUE9, LJ_ctETHERNET, "192.168.1.209", 0, &lngHandle);

//Set DAC1 to 2.5 volts.
//The general form of the AddRequest function is:
//AddRequest (Handle, IOType, Channel, Value, x1, UserData)
lngErrorcode = AddRequest (lngHandle, LJ_ioPUT_DAC, 1, 2.50, 0, 0);

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

//Execute the requests.
lngErrorcode = GoOne (lngHandle);

//Get the result of the DAC1 request just to check for an errorcode.
//The general form of the GetResult function is:
//GetResult (Handle, IOType, Channel, *Value)
lngErrorcode = GetResult (lngHandle, LJ_ioPUT_DAC, 1, 0);

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

The AddRequest/Go/GetResult method is often the most efficient. As shown above, multiple requests can be executed with a single Go() or GoOne() call, and the driver might be able to optimize the requests into fewer low-level calls. The other option is to use the eGet or ePut functions which combine the AddRequest/Go/GetResult into one call. The above code would then look like (assuming the UE9 is already open):

//Set DAC1 to 2.5 volts.
//The general form of the ePut function is:
//ePut (Handle, IOType, Channel, Value, x1)
lngErrorcode = ePut (lngHandle, LJ_ioPUT_DAC, 1, 2.50, 0);

//Read AIN3.
//The general form of the eGet function is:
//eGet (Handle, IOType, Channel, *Value, x1)
lngErrorcode = eGet (lngHandle, LJ_ioGET_AIN, 3, &dblValue, 0);

In the case of the UE9, the first example using add/go/get handles both the DAC command and AIN read in a single low-level call, while in the second example using ePut/eGet two low-level commands are used. Examples in the following documentation will use both the add/go/get method and the ePut/eGet method, and they are generally interchangeable. See Section 4.3 for more pseudocode examples.

All the request and result functions always have 4 common parameters, and some of the functions have 2 extra parameters:

  • Handle – This is an input to all request/result functions that tells the function what LabJack it is talking to. The handle is obtained from the OpenLabJack function.
  • IOType – This is an input to all request/result functions that specifies what type of action is being done.
  • Channel – This is an input to all request/result functions that generally specifies which channel of I/O is being written/read, although with the config IOTypes special constants are passed for channel to specify what is being configured.
  • Value – This is an input or output to all request/result functions that is used to write or read the value for the item being operated on.
  • x1 – This parameter is only used in some of the request/result functions, and is used when extra information is needed for certain IOTypes. If this parameter has meaning for an IOType that will be pointed out in the pseudocode sections of this datasheet.
  • UserData – This parameter is only used in some of the request/result functions, and is data that is simply passed along with the request, and returned unmodified by the result. Can be used to store any sort of information with the request, to allow a generic parser to determine what should be done when the results are received. If this parameter has meaning for an IOType that will be pointed out in the pseudocode sections of this datasheet.