Skip to main content
Skip table of contents

4.1.1 - Open [U6 Datasheet]

The initial step is to open the LabJack and get a handle that the driver uses for further interaction. The DeviceType for the U6 is:

LJ_dtU6

There is only one valid ConnectionType for the U6:

LJ_ctUSB

Following is example pseudocode to open a U6 over USB:

//Open the first found LabJack U6 over USB.
OpenLabJack (LJ_dtU6, LJ_ctUSB, "1", TRUE, &lngHandle);

The reason for the quotes around the address (“1”), is because the address parameter is a string in the OpenLabJack function.

The ampersand (&) in front of lngHandle is a C notation that means we are passing the address of that variable, rather than the value of that variable. In the definition of the OpenLabJack function, the handle parameter is defined with an asterisk (*) in front, meaning that the function expects a pointer, i.e. an address.

In general, a function parameter is passed as a pointer (address) rather than a value, when the parameter might need to output something. The parameter value passed to a function in C cannot be modified in the function, but the parameter can be an address that points to a value that can be changed. Pointers are also used when passing arrays, as rather than actually passing the array, an address to the first element in the array is passed.

Talking to multiple devices from a single application is no problem. Make multiple open calls to get a handle to each device and be sure to set FirstFound=FALSE:

//Open U6s with Local ID #2 and #3.
OpenLabJack (LJ_dtU6, LJ_ctUSB, "2", FALSE, &lngHandleA);
OpenLabJack (LJ_dtU6, LJ_ctUSB, "3", FALSE, &lngHandleB);

… then when making further calls use the handle for the desired device.

JavaScript errors detected

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

If this problem persists, please contact our support.