4. LabJackUD High-Level Driver
The low-level U3 functions are described in Section 5, but most Windows applications will use
the LabJackUD driver instead.
The driver requires a PC running Windows 98, ME, 2000, or XP. It is recommende
e software before making a USB connection to a LabJack.
d to install
. This installer places the
2000/XP.
Other files, including the header and Visual C library file, are installed to the LabJack drivers
directory which defaults to c:\Program Files\LabJack\drivers\.
4.1 Overview
The general operation of the LabJackUD functions is as follows:
• Build a list of requests to perform (Add).
f each request (Get).
to the device.
pen function is:
function is:
/AddRequest (Handle, IOType, Channel, Value, x1, UserData)
orcode = AddRequest (lngHandle, LJ_ioGET_AIN, 3, 0, 0, 0);
form of the GetResult function is:
/GetResult (Handle, IOType, Channel, *Value)
ngErrorcode = GetResult (lngHandle, LJ_ioPUT_DAC, 0, 0);
/Get the AIN3 voltage. We pass the address to dblValue and the
//voltage will be returned in that variable.
lngErrorcode = GetResult (lngHandle, LJ_ioGET_AIN, 3, &dblValue);
th
The download version of the installer consists of a single executable
driver (LabJackUD.dll) in the Windows System directory, along with
a support DLL
(LabJackUSB.dll). Generally this is c:\Windows\System\ on Windows 98/ME, and
c:\Windows\System32\ on Windows
• Open a LabJack.
• Execute the list (Go).
• Read the result o
For example, to write an analog output and read an analog input:
//Use the following line to open the first found LabJack U3
//over USB and get a handle
/The general form of the o
/
//OpenLabJack (DeviceType, ConnectionType, Address, FirstFound, *Handle)
//Open the first found LabJack U3 over USB.
lngErrorcode = OpenLabJack (LJ_dtU3, LJ_ctUSB, "1", TRUE, &lngHandle);
//Request that DAC0 be set to 2.5 volts.
//The general form of the AddRequest
/
lngErrorcode = AddRequest (lngHandle, LJ_ioPUT_DAC, 0, 2.50, 0, 0);
//Request a read from AIN3 (FIO3), assuming it has been enabled as
//an analog line.
lngErr
//Execute the requests.
lngErrorcode = GoOne (lngHandle);
//Get the result of the DAC0 request just to check for an errorcode.
//The general
/
l
/
44