Please enable JavaScript to view this site.

DAQFactory User's Guide

Navigation: 17 Devices > 17.9 LabJack M (T4 / T7 / T8 etc) > 17.9.4 Calling the LabJack M Driver

17.9.4.1 Using() for LabJack

Scroll Prev Top Next More

There is one important command to make communicating with a LabJack T series using script easier.  With this commands, script in DAQFactory for communicating with a LabJack will look almost identical to much of the sample code that is in the LabJack User's Guide.  We recommend putting these two functions at the top of a sequence setup as AutoStart, so that it runs when your document is loaded.  All subsequent samples assume this has been done.  To do this:

1)  Right click on SEQUENCES: in the workspace and select Add Sequence

2)  Type in a name, say StartUp for the new sequence and click OK

3)  The sequence editor will appear.  Click in it and type the following two lines:

 

using("device.labjack.")

4)  Check the box just above the editor that says Auto-Start, then click Apply to save your changes.

5)  If you are going to continue to work on the document without reloading it, you'll need to manually run this sequence, so right click on the sequence name, StartUp, in the Workspace and select Begin Sequence.  The sequence will run instantly, so you won't really be able to tell that it ran.

Next time you load this document, the sequence will run and you are ready to go.

Now an explanation:

using("device.labjack.")

DAQFactory supports a wide variety of devices.  Each device has different functions available to it.  In LabJack's case, some of the functions are LJM_Open, LJM_eReadName, etc.  Because it is possible for two different devices to use the same function names, you normally have to prefix all your LabJack function calls with device.labjackm.  For example:

 

device.labjackm.LJM_eWriteName("192.168.0.10", "AIN0_RANGE", 10)

If you are only using a LabJack, this extra typing can be a pain, and makes code harder to read, so we allow you to specify different objects that don't require the object designation.  Technically speaking this is bringing the function into the global namespace, but you don't have to worry about that.  Just know that once you do the command in a document:

 

using("device.labjack.")

You don't have to put device.labjackM. in front of the LabJack functions.  

This resets when you load a new document, so you'll need to put this function call in an AutoStart sequence for each of your documents.

Note: using("device.labjack") also brings the LabjackUD drivers functions into the global namespace.  These functions don't start with "LJM_" like the LabJack M functions.  If you don't want this, do using("device.labjackM") instead.