User Manual

4. Programming Reference
The LabJack U12 CD installs high-level drivers (ljackuw.dll), an ActiveX interface to the high-
level drivers (ljackuwx.ocx), and LabVIEW6 VIs which call all the DLL functions. The DLL and
OCX are installed in the Windows System directory. If the installation program can determine
the LabVIEW6 directory, it copies the LabVIEW VIs into that directory (\vi.lib\addons\) so they
show up on the function palette. Otherwise, the LabVIEW drivers are copied into the LabJack
installation directory (c:\Program Files\LabJack)\drivers\labview, and can manually be
transferred to the LabVIEW directory.
There are 27 functions exported by the LabJack DLL., and matching functions in the OCX and
LabVIEW VIs. There are two additional support functions in the OCX, provided due to the
limitations of ActiveX. All functions are command/response except for AIBurst and
AIStreamStart/Read/Clear.
There are 2 parameters that are used by most functions:
errorcode – A LabJack specific numeric error code. 0 means no error and 2 means no
LabJacks were found. Use the function “GetErrorString” to get a description of the error,
or see the list in Section 4.24 of this document.
idnum – Functions with this input take either a local ID, serial number, or -1. A local ID
or serial number will specify a specific LabJack, while –1 means the first found LabJack.
Every LabJack has a local ID and serial number. The local ID is a value between 0 and
255 that can be changed by the user. The serial number is a value between 256 and
2,147,483,647 that is unique among all LabJacks and cannot be changed by the user.
4.1 EAnalogIn
Easy function. This is a simplified version of AISample. Reads the voltage from 1 analog input.
Calling this function turns/leaves the status LED on. Execution time for this function is 20
milliseconds or less.
Declaration:
long EAnalogIn ( long *idnum,
long demo,
long channel,
long gain,
long *overVoltage,
float *voltage )
Parameter Description:
Returns: LabJack errorcodes or 0 for no error.
Inputs:
*idnum – Local ID, serial number, or -1 for first found.
demo – Send 0 for normal operation, >0 for demo mode. Demo mode allows
this function to be called without a LabJack.
channel – Channel command is 0-7 for single-ended, or 8-11 for differential.
gain – Gain command is 0=1, 1=2, …, 7=20. This amplification is only available
for differential channels.
Outputs:
*idnum – Returns the local ID or –1 if no LabJack is found.
*overVoltage – If >0, an overvoltage has been detected on one of the selected
analog inputs.
*voltage – Returns the voltage reading.