example, a scan list of {200,224,201,224} would get the LSW of Timer0, the MSW of Timer0, the LSW of Timer1, and the MSW of
Timer1. A scan list of {200,201,224} would get the LSW of Timer0, the LSW of Timer1, and the MSW of Timer1 (MSW of Timer0 is
lost).
Adding these special channels to the stream scan list does not configure those inputs. If any of the FIO or EIO lines have been
configured as outputs, they will need to be reconfigured as inputs to provide proper reads. The timers/counters must be configured
before streaming using normal timer/counter configuration commands.
The timing for these special channels is the same as for normal analog channels. For instance, a stream of the scan list
{0,1,200,224,201,224} counts as 6 channels, and the maximum scan rate is determined by taking the maximum sample rate at the
specified resolution and dividing by 6.
It is not recommended to stream timers configured in mode 2 or 3 (32-bit period measurement). It is possible for the LSW to roll,
but the MSW be captured before it is incremented. That means that only the LSW is reliable, and thus you might as well just use
the 16-bit modes.
Mode 11, the upper 32 bits of the system timer, is not available for stream reads. Note that when streaming with the internal scan
trigger, the timing is known anyway (elapsed time = scan rate * scan number) and it does not make sense to stream the system
timer modes 10 or 11. With external triggering, there might be reasons to stream the available timer mode 10.
4 - LabJackUD High-Level Driver
The low-level UE9 functions are described in Section 5, but most Windows applications will use the LabJackUD driver instead.
The latest version of the driver driver requires a PC running Windows XP or newer. The 3.07 version, supports Windows 98, ME,
2000. It is recommended to install the software before making a USB connection to a LabJack.
The download version of the installer consists of a single executable. This installer places the 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,
c:\Windows\System32\ on Windows 2000/XP, and c:\Windows\SysWOW64\ on newer 64-bit Windows.
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:
Open a LabJack.
Build a list of requests to perform (Add).
Execute the list (Go).
Read the result of each request (Get).
For example, to write an analog output and read an analog input:
//Use one of the following lines to open the first found LabJack UE9
//over USB or Ethernet and get a handle to the device.
//The general form of the open function is:
//OpenLabJack (DeviceType, ConnectionType, Address, FirstFound, *Handle)
//Open the first found LabJack UE9 over USB.
lngErrorcode = OpenLabJack (LJ_dtUE9, LJ_ctUSB, "1", 1, &lngHandle);
// … or open a specified LabJack UE9 over Ethernet.
lngErrorcode = OpenLabJack (LJ_dtUE9, LJ_ctETHERNET, "192.168.1.209", 0, &lngHandle);
//Set DAC1 to 2.5 volts.
//The general form of the AddRequest function is:
//AddRequest (Handle, IOType, Channel, Value, x1, UserData)
lngErrorcode = AddRequest (lngHandle, LJ_ioPUT_DAC, 1, 2.50, 0, 0);
//Request a read from AIN3.
lngErrorcode = AddRequest (lngHandle, LJ_ioGET_AIN, 3, 0, 0, 0);
//Execute the requests.
lngErrorcode = GoOne (lngHandle);
//Get the result of the DAC1 request just to check for an errorcode.
//The general form of the GetResult function is:
//GetResult (Handle, IOType, Channel, *Value)
lngErrorcode = GetResult (lngHandle, LJ_ioPUT_DAC, 1, 0);
//Get the AIN3 voltage.
lngErrorcode = GetResult (lngHandle, LJ_ioGET_AIN, 3, &dblValue);
The AddRequest/Go/GetResult method is often the most efficient. As shown above, multiple requests can be executed with a
single Go() or GoOne() call, and the driver might be able to optimize the requests into fewer low-level calls. The other option is to
use the eGet or ePut functions which combine the AddRequest/Go/GetResult into one call. The above code would then look like
(assuming the UE9 is already open):
//Set DAC1 to 2.5 volts.
//The general form of the ePut function is:
//ePut (Handle, IOType, Channel, Value, x1)
lngErrorcode = ePut (lngHandle, LJ_ioPUT_DAC, 1, 2.50, 0);
//Read AIN3.