Skip to main content
Skip table of contents

8.2 - Doing Configuration Steps (Applies to UD-Series)

As we showed in the chapter Basic I/O, there is a lot you can do with DAQFactory and your LabJack without having to do any scripting. More than likely you will move into a little scripting when you want to tweak the configuration of your LabJack. This is often done in a sequence marked Auto-Start so the configuration is done automatically when your DAQFactory document loads. The format of these configuration commands are almost identical to the code shown in the LabJack User's Manual, as long as you use the using() and include() functions we described in the last section. So if we wanted to configure the UE9 analog inputs for 14 bit and channels 2 and 3 to bipolar 5V range:

1) Right click on SEQUENCES: in the Workspace and select Add Sequence. Give it the name StartUp

2) The sequence editor window will appear. Check the AutoStart at the top, and then in the window type in the following script:

include("c:\program files\labjack\drivers\labjackud.h")
AddRequest(0, LJ_ioPIN_CONFIGURATION_RESET, 0, 0, 0)
AddRequest(0, LJ_ioPUT_CONFIG, LJ_chAIN_RESOLUTION, 14, 0, 0)
AddRequest(0, LJ_ioPUT_AIN_RANGE, 2, LJ_rgBIP5V, 0, 0)
AddRequest(0, LJ_ioPUT_AIN_RANGE, 3, LJ_rgBIP5V, 0, 0)

3) Click on Apply and Compile to save your changes.

When you specify AutoStart, the sequence is run when the document is loaded. It is not rerun every time you save changes, so you'll need to run the sequence at this point.

4) Right click on the sequence name StartUp in the workspace and select Begin Sequence. This will run the sequence and configure the LabJack. If you change this sequence, for example, to set the resolution to 16 bit, you will need to rerun the sequence to actually send the commands to the LabJack.

A few comments:

  • This code uses ID 0, which means First Found in DAQFactory. If you have multiple LabJacks, you'll need to replace the 0 in the AddRequest() and GoOne() functions with your ID. Unlike the code in the LabJack User's Manual, you do not need to perform an Open() on the LabJack as DAQFactory will automatically open and find the desired LabJack as long as its connected via USB. If connected over Ethernet, please see the section on Ethernet setup.
  • You may need to change the path in the second line to match the location of your labjackud.h file if you did not install the LabJack drivers in their default location.
  • The LJ_ioPIN_CONFIGURATION_RESET ensures that the LabJack is in its original state before we configure it. This
    is a good precaution and should be included after your include() line even if you aren't going to do any other configuration in your AutoStart sequence. You can use ePut instead in this case since you are only doing one command:


  • You could also use the ePut() function, but its generally better to use AddRequest() and GoOne() when you need to perform more than one command at a time.
  • Please review the LabJack User's Manual and the LabJackUD.h file for information on all the constants and configuration commands possible. There are also examples in the appropriate sections later in this document.
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.