« Close

Datasheets and User Guides

App Notes

Software & Driver

 

4.3.14 - Miscellaneous

The following are special channels, used with the get/put config IOTypes, to read/write the calibration memory and user memory:

LJ_chCAL_CONSTANTS    // x1 points to an array with 20 doubles.
LJ_chUSER_MEM    // x1 points to an array with 256 bytes.

LJ_chCAL_CONSTANTS makes 5 calls to the low-level ReadCal or EraseCal/WriteCal functions to do a consecutive read or erase/write of 5x 32-byte blocks of calibration memory, or 160 bytes total.  Those bytes represent 20x 64-bit fixed point values in hardware, but are passed to/from the UD as 20 doubles.

LJ_chUSER_MEM makes 8 calls to the low-level ReadMem or EraseMem/WriteMem functions to do a consecutive read or erase/write of 8x 32-byte. This function accesses the first 256 bytes of user-mem. The second 256 bytes can only be accessed using the low-level functions. blocks of user memory.

For more information, see the low-level descriptions in Sections 5.2.6 - 5.2.8, and see the Memory example in the VC6_LJUD archive.

The following wait IOType is used to create a delay between other actions:

LJ_ioPUT_WAIT  // Channel ignored. Value = 0-4194176 microseconds.

Any value (in microseconds) from 0-4194176 can be passed, but the actual resolution is 128 microseconds (U3C = 128 µs, U3B = 64 µs, U3A = 128 µs).

This is typically used to put a small delay between two actions that will execute in the same low-level Feedback command. It is useful when the desired delay is less than what can be accomplished through software.

For example, a 1.024 millisecond pulse can be created by executing a single Add/Go/Get block that sequentially requests to set FIO4 to output-high, wait 1024 microseconds, then set FIO4 to output-low.

6 comments

For many years now I have been disappointed with Microsoft for making it increasingly difficult to make accurate timing measurements and pulse generation. While randomly checking your user guide for some information that I may have missed, I ran into this life saving feature: LJ_ioPUT_WAIT. Unfortunately I could not make it work as it seems it should. Let me try to explain what I found:

Starting with a wait of zero and increasing the wait in 33 millisecond increments I obtain approximately ½ the expected pulse width: 16 for 33, 33 for 66, 50 for 99 etc.

Now, starting from any of these values, any 1 millisecond increment in the wait gives a 1 increment in the pulse duration.

So, for instance:

A wait command of 66 gives a pulse width of 33

A wait command of 66 + 32 (98) gives a width of 65 (33 + 32)

Then a command of 99 gives a width of about 50.

As an example: if you need a pulse width of 50 msec you can obtain it with a command of 99 or a command of 83 (66 + 17).

I sincerely hope you can fix this or tell me what I’m doing wrong. This would be such a great feature and you should take it out of hiding from the miscellaneous category ;)

By the way I am using a U3 LV and have not tried it on any other Labjack.

The problem of being off by /2 could be due to old firmware or driver, and is related to the fact that the clock on the U3 hardware V1.30 & V1.21 is twice as fast as the original V1.20.  Try getting the latest UD driver V3.32 and use LJSelfUpgrade to update to the latest U3 firmware V1.46.

The fact that between 33, 66, and 99, you get the proper change (1ms = 1ms), is strange.  If you still have problems after the updates let us know.

The function works very well on the U6 but both the U3 LV and U3 HV work up to 32 msec. A value of 33000 produces a wait of 16.66 msec. In order to obtain 33 msec the value can be 65 664 (10080Hex) and produces 33.02 msec.  Since my current project will not involve pulses close to 500ms I generated a look up table for values 1 to 500 and put it on the web in case any one would like to use it: http://www.unc.edu/~ogmonbur/lj/lj-docs/lj-info0.html#PrecisionPulse .
 I updated the firmware and UD drivers but they both were up to date.
Thank you for your help,
Ollie

We took a look at the UD library code and think we found a few errors in the way it was being calculated.  We also made sure that the documentation (when it comes to limits & low level function) match how the current firmware is implemented.

I made some fixes to the LabJackUD.dll and uploaded it here.  If you download that zip file and take the LabJackUD.dll from the 32-bit folder and put it into the system32 (on 32-bit windows) or SysWOW64 (on 64-bit windows) then try using the function (passing microseconds) it should work properly.  If you have any other issues or questions please let us know.  Either here or at [email protected]

Works great!  That was a fast response.

Thanks.,

ollie

Pardon me; this article is extremely unclear.  What is an "Add/Go/Get" block?    I'm having a very hard time with the documentation in general because of its informal and relatively non descriptive style.