Please enable JavaScript to view this site.

DAQFactory User's Guide

Navigation: 17 Devices

17.7 LabJack UE9 / U6 / U3 (UD devices)

Scroll Prev Top Next More

This device driver communicates with the LabJack UE9 over either USB or Ethernet and the LabJack U3 and U6 over USB.  This driver supports all modes of operation.  This driver appears as LabJackUD within DAQFactory.  The LabJack U12 driver appears as LabJack_U12, while the LabJack T series device driver shows up as LabJackM.  These are the names LabJack gave their driver libraries.

To learn how to use DAQFactory with the UE9, U6, or U3, please refer to the Using DAQFactory with the LabJack guide included in the DAQFactory installation.  Go to Start - Programs - DAQFactory - Using DAQFactory with the LabJack.  Included here is a function summary:

Initial function calls to setup driver:

include("c:\program files\labjack\drivers\labjackud.h")

or in 64 bit Windows:

include("c:\program files (x86)\labjack\drivers\labjackud.h")

This should go in a sequence, and probably one with AutoStart checked.  You should change the directory specified if you installed the LabJack CD to a different directory.  Once this function runs, all the constants in the .h file will appear as defined constants inside of DAQFactory and can be referenced directly by name, just like a variable, but read only.

using("device.labjack")

This function will move all the DAQFactory LabJack functions described below, as well as the ones for the LJM, into the global name space so you don't have to put device.labjackUD. or device.labjackM in front.  Without this, all the functions listed below must have device.labjackUD. infront (i.e. device.LabjackUD.AddRequest(...))  Again, this should go in a sequence, probably right after the include() function.

Once these functions are called, DAQFactory script for communicating with the LabJack will be almost identical to C and psuedocode examples provided by LabJack.  The exception is that DAQFactory uses the @ sign to specify a variable by reference.  Also, DAQFactory doesn't support callback functions, so it handles streaming data internally as described below.

Here are the functions.  Almost all return an error code:

AddRequest(D#, IOType, Channel, Value, x1, UserData): This function works very much like the AddRequest() function in the UE9 programming library.  The D# is the device number you assigned in the configurator or was returned by OpenLabJack(). IOType and Channel can be the constants for a particular task.  Since DAQFactory does not support indirect pointers, the Value, and x1 parameters only hold values used for setting outputs or parameters.  Results are returned by GetResult().  Only the first three parameters are required.

DoubleToStringAddress(Number, @String, HexDot): This function is identical to the UD equivilent.

eAIN(D#, ChannelP, ChannelN, @Value, Range, Resolution, Settling, Binary, R1, R2): This function is identical to the UD equivilent.

eDAC(D#, Channel, Voltage, Binary, R1, R2): This function is identical to the UD equivilent.

eDI(D#, Channel, @State): This function is identical to the UD equivilent.

eDO(D#, Channel, State): This function is identical to the UD equivilent.

eGet(D#, IOType, Channel, @Value, x1): This function combines AddRequest(), GoOne(), and GetResult() into one call.  It obviously can only perform one task at a time, but for simple tasks can be easier to deal with.  Like AddRequest(), only the first three parameters are required.  So you could do this to read an analog value:

 

private result
eGet(1,LJ_ioANALOG_INPUT, 1, @result)

ePut(D#, IOType, Channel, Value, x1): This function combines AddRequest(), GoOne(), and GetResult() into one call, but designed for setting a parameter.  It obviously can only perform one task at a time, but for simple tasks can be easier to deal with.  

ErrorToString(ErrorCode, @String): This function is identical to the UD equivilent.

eTCConfig(D#, EnableTimers, EnableCounters, TCPinOffset, TimerClockBaseIndex, TimerClockDivisor, TimerModes, TimerValues, R1, R2): This function is identical to the UD equivilent.

eTCValues(D#, ReadTimers, UpdateResetTimers, ReadCounters, ResetCounters, @TimerValues, @CounterValues, R1, R2): This function is identical to the UD equivilent.

GetDriverVersion(): This is the simplest function and simply returns the version number of the driver (i.e. 2.04)

GetFirstResult(D#, @IOType, @Channel, @Value, @x1, @UserData): This function is identical to the UD equivilent.

GetLastError(D#): returns the error code of the last error on the given device.  The error codes are described in the labjackud.h file of the UE9 programming library.

GetLastStreamError(D#): returns the error code of the last error generated by the stream retrieval routine.  Since stream data retrieval is done internally, this is the only way to see any errors occurring in stream.  The error codes are described in the labjackud.h file of the UE9 programming library.

GetNextError(D#, @IOType, @Channel, [@Error]): Gets the next error from the list of errors from the previous GoOne() on the given D#.  Repetitive calls will cycle through the list.  Repeat until LJE_NOERROR is returned.  This function returns the error, or LJE_NOERROR, but also allows you to optionally provide a reference to a variable to also receive the error.  This allows you to put this function inside the while() expression and assign the error to a variable for further processing at the same time.

GetNextResult(D#, @IOType, @Channel, @Value, @x1, @UserData): This function is identical to the UD equivilent.

GetResult(D#, IOType, Channel, @Value): Gets the result for the given operation.  Like AddRequest(), IOType and Channel can be constants or numbers.  

GoOne(D#): Performs all the AddRequest()s that have queued up on the given device since the last call to GoOne().  

OpenLabJack(Device Type, ConnectionType, Address, FirstFound, @D#): this function opens the specified LabJack if not already open and returns a device number in @D# that is used by all other functions and channels.  This is not quite the same as the handle returned by the regular C function, but should essentially be treated the same.  Use this function if you need to dynamically open LabJack's at runtime without using the device configurator. Device Type and Connection Type take constants such as LJ_dtUE9 and LJ_ctUSB. Address is a string. FirstFound is either 0 or 1, where 1 means find first found and ignore the specified Address.

ResetLabJack(D#): This function is identical to the UD equivilent.

StringToConstant(String): This function is identical to the UD equivilent.

StringToDoubleAddress(String, @Number, HexDot): This function is identical to the UD equivilent.