« Close

Datasheets and User Guides

App Notes

Software & Driver

 

LJM_MODBUS_MAP_CONSTANTS_FILE

Summary

LJM_MODBUS_MAP_CONSTANTS_FILE is a string-based readable-writable LJM library configuration which sets the absolute or relative path of an existing file to use as Modbus constants for use with the functions that use the Modbus map constants, such as LJM_NamesToAddresses.

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

Default Value

  • Windows Vista and later: "C:\ProgramData\LabJack\LJM\ljm_constants.json"
  • Windows XP: "C:\Documents and Settings\All Users\Application Data\LabJack\LJM\ljm_constants.json"
  • Mac OS X and Linux: "/usr/local/share/LabJack/LJM/ljm_constants.json"

Relevant Constants

To set LJM_ERROR_CONSTANTS_FILE and LJM_MODBUS_MAP_CONSTANTS_FILE simultaneously, use LJM_CONSTANTS_FILE.

Relevant Functions

To read, use LJM_ReadLibraryConfigStringS.

To write, use LJM_WriteLibraryConfigStringS or LJM_LoadConfigurationFile.

Example

[C/C++] Read LJM_MODBUS_MAP_CONSTANTS_FILE, then set to "alternate_modbus_constants.json"

char ErrorString[LJM_MAX_NAME_SIZE];
char defaultModbusConstantsFile[LJM_MAX_NAME_SIZE];
char * newModbusConstantsFile = "alternate_modbus_constants.json";

int LJMError = LJM_ReadLibraryConfigStringS(LJM_MODBUS_MAP_CONSTANTS_FILE, defaultModbusConstantsFile);
if (LJMError != 0) {
    LJM_ErrorToString(LJMError, ErrorString);
    printf("LJM_ReadLibraryConfigStringS error: %s\n", ErrorString);
}
printf("The default for LJM_MODBUS_MAP_CONSTANTS_FILE is %s\n", defaultModbusConstantsFile);

printf("Setting LJM_MODBUS_MAP_CONSTANTS_FILE to %s\n", newModbusConstantsFile);
LJMError = LJM_WriteLibraryConfigStringS(LJM_MODBUS_MAP_CONSTANTS_FILE, newModbusConstantsFile);
if (LJMError != 0) {
    LJM_ErrorToString(LJMError, ErrorString);
    printf("LJM_WriteLibraryConfigStringS error: %s\n", ErrorString);
}

 

For more LJM configurations, see Library Configuration Functions.