LJM Packet Configs
These are configs that affect the packets that LJM sends to LabJack devices, or configs that determine error checking behavior before LJM sends packets to devices.
Relevant Functions
To read the packet configurations, use LJM_ReadLibraryConfigS.
To write the packet configurations, use LJM_WriteLibraryConfigS or LJM_LoadConfigurationFile.
For more LJM configurations, see Library Configuration Functions.
LJM_ALLOWS_AUTO_CONDENSE_ADDRESSES
LJM_ALLOWS_AUTO_CONDENSE_ADDRESSES
is a numerical readable-writable LJM library configuration that determines whether or not LJM will automatically condense congruent address reads/writes into array reads/writes.
For example, if a call to LJM_eNames contains two frames next to each other that write to AIN0
then AIN1
, LJM would automatically condense these frames into one frame that writes to both AIN0
and AIN1
.
The constant LJM_ALLOWS_AUTO_CONDENSE_ADDRESSES
can be used interchangeably with the string "LJM_ALLOWS_AUTO_CONDENSE_ADDRESSES"
.
Details
0
- false/disabled
1
- true/enabled (Default)
Example
Read LJM_ALLOWS_AUTO_CONDENSE_ADDRESSES, set LJM_ALLOWS_AUTO_CONDENSE_ADDRESSES, then read it again
char ErrorString[LJM_MAX_NAME_SIZE];
double Value;
int LJMError = LJM_ReadLibraryConfigS(LJM_ALLOWS_AUTO_CONDENSE_ADDRESSES, &Value);
if (LJMError != 0) {
LJM_ErrorToString(LJMError, ErrorString);
printf("LJM_ReadLibraryConfigS error: %s\n", ErrorString);
}
if (Value == 0) {
printf("LJM_ALLOWS_AUTO_CONDENSE_ADDRESSES is disabled by default.\n");
}
else {
printf("LJM_ALLOWS_AUTO_CONDENSE_ADDRESSES is enabled by default.\n");
}
printf("Disabling LJM_ALLOWS_AUTO_CONDENSE_ADDRESSES\n");
LJMError = LJM_WriteLibraryConfigS(LJM_ALLOWS_AUTO_CONDENSE_ADDRESSES, 0);
if (LJMError != 0) {
LJM_ErrorToString(LJMError, ErrorString);
printf("LJM_WriteLibraryConfigS error: %s\n", ErrorString);
}
LJMError = LJM_ReadLibraryConfigS(LJM_ALLOWS_AUTO_CONDENSE_ADDRESSES, &Value);
if (LJMError != 0) {
LJM_ErrorToString(LJMError, ErrorString);
printf("LJM_ReadLibraryConfigS error: %s\n", ErrorString);
}
if ((int)Value == 0) {
printf("LJM_ALLOWS_AUTO_CONDENSE_ADDRESSES is now disabled.\n");
}
else {
printf("LJM_ALLOWS_AUTO_CONDENSE_ADDRESSES is now enabled.\n");
}
Possible output:
LJM_ALLOWS_AUTO_CONDENSE_ADDRESSES is enabled by default.
Disabling LJM_ALLOWS_AUTO_CONDENSE_ADDRESSES
LJM_ALLOWS_AUTO_CONDENSE_ADDRESSES is now disabled.
LJM_ALLOWS_AUTO_MULTIPLE_FEEDBACKS
LJM_ALLOWS_AUTO_MULTIPLE_FEEDBACKS
is a numerical readable-writable LJM library configuration that determines whether or not LJM will automatically perform multiple Feedback commands when the desired operations would exceed the maximum packet length.
For example, if a call to LJM_eNames would require a 68-byte packet but the connection can only take 64-byte packets, LJM would automatically separate the LJM_eNames
call into 2 operations of less than 64 bytes each.
The constant LJM_ALLOWS_AUTO_MULTIPLE_FEEDBACKS
can be used interchangeably with the string "LJM_ALLOWS_AUTO_MULTIPLE_FEEDBACKS"
.
Details
0
- false/disabled
1
- true/enabled (Default)
Example
Read LJM_ALLOWS_AUTO_MULTIPLE_FEEDBACKS, set LJM_ALLOWS_AUTO_MULTIPLE_FEEDBACKS, then read it again
char ErrorString[LJM_MAX_NAME_SIZE];
double Value;
int LJMError = LJM_ReadLibraryConfigS(LJM_ALLOWS_AUTO_MULTIPLE_FEEDBACKS, &Value);
if (LJMError != 0) {
LJM_ErrorToString(LJMError, ErrorString);
printf("LJM_ReadLibraryConfigS error: %s\n", ErrorString);
}
if ((int)Value == 0) {
printf("LJM_ALLOWS_AUTO_MULTIPLE_FEEDBACKS is disabled by default.\n");
}
else {
printf("LJM_ALLOWS_AUTO_MULTIPLE_FEEDBACKS is enabled by default.\n");
}
printf("Disabling LJM_ALLOWS_AUTO_MULTIPLE_FEEDBACKS\n");
LJMError = LJM_WriteLibraryConfigS(LJM_ALLOWS_AUTO_MULTIPLE_FEEDBACKS, 0);
if (LJMError != 0) {
LJM_ErrorToString(LJMError, ErrorString);
printf("LJM_WriteLibraryConfigS error: %s\n", ErrorString);
}
LJMError = LJM_ReadLibraryConfigS(LJM_ALLOWS_AUTO_MULTIPLE_FEEDBACKS, &Value);
if (LJMError != 0) {
LJM_ErrorToString(LJMError, ErrorString);
printf("LJM_ReadLibraryConfigS error: %s\n", ErrorString);
}
if ((int)Value == 0) {
printf("LJM_ALLOWS_AUTO_MULTIPLE_FEEDBACKS is now disabled.\n");
}
else {
printf("LJM_ALLOWS_AUTO_MULTIPLE_FEEDBACKS is now enabled.\n");
}
Possible output:
LJM_ALLOWS_AUTO_MULTIPLE_FEEDBACKS is enabled by default.
Disabling LJM_ALLOWS_AUTO_MULTIPLE_FEEDBACKS
LJM_ALLOWS_AUTO_MULTIPLE_FEEDBACKS is now disabled.
LJM_OLD_FIRMWARE_CHECK
LJM_OLD_FIRMWARE_CHECK
is a numerical readable-writable LJM library configuration which sets whether or not LJM will check the Modbus constants file to make sure the firmware of the current device is compatible with the Modbus register(s) being read from or written to.
The constant LJM_OLD_FIRMWARE_CHECK
can be used interchangeably with the string "LJM_OLD_FIRMWARE_CHECK"
.
Values
0
- false/disabled
1
- true/enabled (default)
It is recommended to not disable LJM_OLD_FIRMWARE_CHECK
.
Details
For all Easy functions and for LJM_MBFBComm, each address being read from or written to that also exists in the Modbus constants file, LJM will compare the firmware version of the current device against the minimum firmware required for that address. If the device does not have adequate firmware, the function will abort before communicating with the device and return the error LJME_OLD_FIRMWARE
(1307).
Important Note
Affects the error checking of all functions and also LJM_MBFBComm.
Example
Read LJM_OLD_FIRMWARE_CHECK, then disable it.
char ErrorString[LJM_MAX_NAME_SIZE];
double value;
int LJMError = LJM_ReadLibraryConfigS(LJM_OLD_FIRMWARE_CHECK, &value);
if (LJMError != 0) {
LJM_ErrorToString(LJMError, ErrorString);
printf("LJM_ReadLibraryConfigS error: %s\n", ErrorString);
}
printf("The default for LJM_OLD_FIRMWARE_CHECK is %.00f\n", value);
value = 0;
printf("Setting LJM_OLD_FIRMWARE_CHECK to %.00f\n", value);
LJMError = LJM_WriteLibraryConfigS(LJM_OLD_FIRMWARE_CHECK, value);
if (LJMError != 0) {
LJM_ErrorToString(LJMError, ErrorString);
printf("LJM_WriteLibraryConfigS error: %s\n", ErrorString);
}
LJM_USE_TCP_INIT_FOR_T7_WIFI_TCP
LJM_USE_TCP_INIT_FOR_T7_WIFI_TCP
is a numerical readable-writable LJM library configuration that sets whether LJM will use UDP or TCP for T7 WiFi connection initialization when ConnectionType is TCP.
The constant LJM_USE_TCP_INIT_FOR_T7_WIFI_TCP
can be used interchangeably with the string "LJM_USE_TCP_INIT_FOR_T7_WIFI_TCP"
.
LJM_USE_TCP_INIT_FOR_T7_WIFI_TCP
was added in LJM 1.1500.
Details
0
- false/disabled - Use UDP
1
- true/enabled (Default) - Use TCP
LJM_ZERO_LENGTH_ARRAY_MODE
LJM_ZERO_LENGTH_ARRAY_MODE
is a numerical readable-writable LJM library configuration that determines the behavior of array read/write functions when the array size is 0.
Details
1
- Sets LJM to return an error when an array of size 0 is detected.
2
- Sets LJM to ignore the operation when all arrays in the operation are of size 0.
LJM_RETRY_ON_TRANSACTION_ID_MISMATCH
LJM_RETRY_ON_TRANSACTION_ID_MISMATCH
is a numerical readable-writable LJM library configuration that determines whether or not LJM automatically retries an operation if an LJME_TRANSACTION_ID_ERR
occurs.
Details
0
- false/disable
1
- true/enable (Default)