« Close

Datasheets and User Guides

App Notes

Software & Driver


2.9 - Library Configuration Functions

Library Configuration Functions Overview

This section describes how to configure the LJM library's behavior and interpretation constants. Whenever LJM is started up, it is loaded with default values, so any desired configurations must be applied each time LJM is started.

Behavioral Parameters

The functions LJM_WriteLibraryConfigS and LJM_WriteLibraryConfigStringS are good for setting a few configurations, while LJM_LoadConfigurationFile is more convenient for setting many configurations or for sharing a configuration between programs.

Interpretation Constants

LJM also provides interpretation of Modbus map constants and error constants.

The Modbus map constants affect Name functions that use Name interpretation, such as LJM_eReadName. These Name functions have "Name" in their name and have a "const char * Name" parameter or "const char ** aNames" parameter. For each name passed to one of these functions, it is interpreted according to the loaded constants. The Modbus map constants affect the behavior of other functions as well, such as when LJM_OLD_FIRMWARE_CHECK is enabled.

The Error constants affects the LJM_ErrorToString function. The loaded Error constants will be interpreted from an integer error code to a error string. Custom application error codes can be loaded in the 3900-3999 range.

Configuration Parameters

The following parameters are constants defined in the header file LabJackM.h. Each parameter's name is the same as it's value; e.g. LJM_LIBRARY_VERSION is a constant of the string "LJM_LIBRARY_VERSION".

Informational parameters:

Timeout parameters:

Device operation parameters:

  • LJM_ALLOWS_AUTO_MULTIPLE_FEEDBACKS - Whether or not LJM will automatically perform multiple Feedback commands when the desired operations would exceed the maximum packet length.
  • LJM_ALLOWS_AUTO_CONDENSE_ADDRESSES - Whether or not LJM will automatically condense congruent address reads/writes into array reads/writes.
  • LJM_RETRY_ON_TRANSACTION_ID_MISMATCH - Whether or not LJM automatically retries an operation if an LJME_TRANSACTION_ID_ERR occurs.
  • LJM_OLD_FIRMWARE_CHECK - Whether or not LJM will check the Modbus constants file (see LJM_MODBUS_MAP_CONSTANTS_FILE) to make sure the firmware of the current device is compatible with the Modbus register(s) being read from or written to.

Constants file parameters:

Debug logger parameters:

  • LJM_DEBUG_LOG_FILE - The absolute or relative path of the file to output log messages to.
  • LJM_DEBUG_LOG_MODE - What conditions will cause LJM to output log messages.
  • LJM_DEBUG_LOG_LEVEL - What priority of log messages are output.
  • LJM_DEBUG_LOG_BUFFER_MAX_SIZE - How many messages the log buffer can hold.
  • LJM_DEBUG_LOG_SLEEP_TIME_MS - How often the logger thread will run.
  • LJM_DEBUG_LOG_FILE_MAX_SIZE - The maximum size of the log file in number of characters.

Stream parameters:

Altering Configurations

Functions for setting the behavioral configurations of LJM:

Altering Modbus Map Constants or Error Constants

Functions for setting the Modbus and/or Error interpretation maps:

Reading Configurations

Functions for getting the behavioral configurations of LJM: