Delphi for UD - Windows | LabJack
« Close

Datasheets and User Guides

App Notes

Software & Driver


Delphi for UD - Windows

Delphi wrapper and examples for the Windows UD library. The Windows UD library is the high-level Windows library/driver for the LabJack U3, U6 and UE9. For other LabJack devices, go to the Software page.

Refer to the text file in the download for more information.

Warning: If you intend to create a 64-bit application please ensure you use AddRequestPtr rather than AddRequest anywhere you write or read an array of data. See our AddRequest documentation for more information.


UD Examples Overview (Referencable)

UD Library Overview

First read the general overview of the UD library:

The UD driver has a handful of functions, many with the same 4 to 6 parameters.


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 a single add/go/get into one function call.


The parameters are described at the bottom of the Overview page.  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 pseudocode section of the device's datasheet has the extra information 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.


Device specific pseudocode can be found in datasheet section 4.3:


File Attachment: 


In order to get this to work with newer versions of Delphi (Delphi 2009 and up), change all PChar parameters to PAnsiChar (simply search and replace "PChar" by PAnsiChar"). In old versions of Delphi, PChar was an alias for PAnsiChar, with newer versions, it is an alias for PWideChar, which will not work with the labjack DLL. Note that the updated unit is still compatible with old versions of Delphi.

Thank you for commenting on this issue and reminding us about it. I am currently updating the examples and they will use PAnsiChar instead. I will post again when they are updated.

The examples have been updated and use PAnsiChar/AnsiChar now.

Bram's picture

I want the simplest code for Analog In (U3). This code only produces 00000 .... what is wrong

//  Read 16 port AIN

program TestAnaIn01;


  LJUDDelphi in '..\..\..\Wrapper\LJUDDelphi.pas';
  j: integer;
  ValueAIN: array[0..16] of double;
  for j := 0 to 10 do


Thanks Bram

labjack support's picture

We have a programmer that is familiar with Delphi who will be available later.  I'm not a Delphi expert, but I don't see any UD calls in your code.  Is "ReadLn" a function you wrote or something we provide?  Do you have error checking and handling as I don't see any in your code?

Perhaps try our Delphi_LJUD example U3eFunctions.  Run it as is first, but then once you confirm that works you can remove the calls to eDAC(), eDI() and eDO(), along with the timer/counter stuff, to leave you with just 3 calls:  OpenLabJack(), ePut() and eAIN().  This example also demonstrates error catching and handling, and that routine uses a 4th call which is ErrorToString().