« Close

Datasheets and User Guides

Software & Driver

 

LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED

Summary

Requires LJM 1.2000 or later

LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED is a numerical readable and writable LJM library configuration which sets how LJM handles auto-recovery when the first channel is not firmware-protected from returning 0xFFFF as a valid data value. Channels that never return 0xFFFF during stream are the following:

  • Analog inputs (AIN0, AIN1, ...)
  • FIO_STATE
  • EIO_STATE
  • CIO_STATE
  • MIO_STATE
  • EIO_CIO_STATE
  • CIO_MIO_STATE

The constant LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED can be used interchangeably with the string "LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED".

Values

0 (default) - Error detection is enabled:

If auto-recovery happens and the first channel is not one of the above channels, stream will be stopped and LJM_eStreamRead will return the error LJME_DIGITAL_AUTO_RECOVERY_ERROR_DETECTED.

1 - Error detection is disabled:

If auto-recovery happens and the first channel is not firmware-protected from return a read data value of 0xFFFF, LJM will treat the first channel as if it cannot return 0xFFFF and will insert the missing scans as LJM_DUMMY_VALUE values.

Details

If the device stream buffer overflows (so that samples can no longer be taken), the LabJack device will count how many scans were skipped. Once LJM has caught up reading from the device stream buffer, the device will commence collecting scans again. After this, the device will send a packet indicating that auto- recovery is complete. This auto-recovery complete packet contains the count of how many scans were skipped and uses the delimiter value of 0xFFFF within the data stream for the first channel to indicate where in the data stream LJM should insert extra LJM_DUMMY_VALUE values to represent skipped scans. To ensure that 0xFFFF can be used as a delimiter value for the first channel, some channels (such as analog inputs) never return 0xFFFF. However, digital channels not listed above can return 0xFFFF under nominal conditions. These channels by default are not assumed by LJM to be usable for the first channel during auto-recovery because a real data value of 0xFFFF is indistinguishable from a delimiter value of 0xFFFF. To allow LJM to treat your first stream channel as if it will never return a real data value of 0xFFFF, you should:

  1. Make sure that your first channel will never return 0xFFFF. If your first channel is FIO_EIO_STATE, for example, you could wire FIO3 to GND.
  2. Set LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED to 1.

If your first channel cannot be guaranteed to never return 0xFFFF, you can still set LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED to 1, but skipped scans may be inserted by LJM at the wrong place.

Setting a new LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED value will not affect stream sessions that are already in progress.

Relevant Functions

To read LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED, use LJM_ReadLibraryConfigS.

To write LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED, use LJM_WriteLibraryConfigS or LJM_LoadConfigurationFile.

Example

[C/C++] Read LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED then set it to 1.

char ErrorString[LJM_MAX_NAME_SIZE];
double value;

int LJMError = LJM_ReadLibraryConfigS(LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED, &value);
if (LJMError != 0) {
    LJM_ErrorToString(LJMError, ErrorString);
    printf("LJM_ReadLibraryConfigS error: %s\n", ErrorString);
}
printf("The default for LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED is %.00f\n", value);

value = 1;
printf("Setting LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED to %.00f\n", value);
printf("I hope one of the digital inputs is wired to GND!\n");
LJMError = LJM_WriteLibraryConfigS(LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED, value);
if (LJMError != 0) {
    LJM_ErrorToString(LJMError, ErrorString);
    printf("LJM_WriteLibraryConfigS error: %s\n", ErrorString);
}

Output:

The default for LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED is 0
Setting LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED to 1
I hope one of the digital inputs is wired to GND!

 

For more LJM configurations, see Library Configuration Functions.