« 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.

File Attachment: 

5 comments

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;

{$APPTYPE CONSOLE}

uses
  SysUtils,
  Windows,
  Math,
  LJUDDelphi in '..\..\..\Wrapper\LJUDDelphi.pas';
var
  j: integer;
  ValueAIN: array[0..16] of double;
  ch:char;
begin
  for j := 0 to 10 do
   begin
     Writeln(ValueAIN[j]);
   end;
  ReadLn(ch);
end.

 

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().