- WaitLong: IOType=6 [U3 Datasheet] | LabJack
« Close

Datasheets and User Guides

App Notes

Software & Driver - WaitLong: IOType=6 [U3 Datasheet]


WaitLong, 2 Command Bytes: 
0 IOType = 6
1 Time (*16 ms)
0 Response Bytes: 

This IOType provides a way to add a delay during execution of the Feedback function. The typical use would be putting this IOType in between IOTypes that set a digital output line high and low, thus providing a simple way to create a pulse. Note that this IOType uses the same internal timer as stream mode, so cannot be used while streaming.

  • Time: This value (0-255) is multiplied by 16384 microseconds (U3C = 16384 us, U3B = 16384 us, U3A = 32768 us) to determine the delay.

LabJackPython example session

Automatically extracted from u3.py. Debugging turned on to show the bytes sent and received.


WaitLong Feedback command


    specify the number of 16ms time increments to wait

    >>> import u3
    >>> d = u3.U3()
    >>> d.debug = True
    >>> d.getFeedback(u3.WaitLong(Time = 70))
    Sent: [0×47, 0xf8, 0×2, 0×0, 0×4c, 0×0, 0×0, 0×6, 0×46, 0×0]
    Response: [0xfa, 0xf8, 0×2, 0×0, 0×0, 0×0, 0×0, 0×0, 0×0, 0×0]


Still trying to to learn my new U3.  It appears to me that a long wait cycle is more like 16 ms rather than 32 ms.  The short wait is indeed 128 us.  Might be nice to indicate a wait of 0 increments is 16 us.  Tested using Feedback low-level command to take digital lines up and down using C on mac osx 10.6.8. 

I'm using feedback to send a series of timed digital-out commands on a U3 where the user determines the length of time between commands.  All works well using two long-waits in the feedback command until the sum of the waits exceeds about 1 second, shortly thereafter I receive a message:

libusb error: LIBUSB_ERROR_TIMEOUT  

The documentation suggests that I could go just over 4 seconds (16 ms * 255). I was contemplating adding a sequence of two more "long waits" in order to complete a measuring cycle when the user requires short measuring times but this could involve 1 feedback command taking 10 or more seconds to complete.

BTW, the figure on this page still says 32 ms rather than the 16. (MaOSX 10.6.8, C).

If your Feedback command takes longer than 1 second to timeout, using the Exodriver you have three options:

1.  Insert a delay between your Feedback LJUSB_Write/Read calls.  So if you expect a Feedback response to take 4 seconds add a 3.5 second delay after the write call.

2.  Perform LJUSB_Read calls multiple times.  If you expect a Feedback response in 4 seconds, you can try reading the response 5 times in a loop.

3.  Modify the Exodriver's timeout in the source code.  In the labjackusb.c file, the timeout define LJ_USB_TIMEOUT sets the write/read timeouts in milliseconds.  Change this value to what you want, recompile and reinstall the driver.  The latest Exodriver source code can be found on github here.  labjackusb.c is in the liblabjackusb directory of the download.

I will change the 32 ms to 16 ms in the figure and example.