eReadNames [LJM User's Guide]
Read multiple device registers in one command, each register specified by name.
Syntax
LJM_ERROR_RETURN LJM_eReadNames(
int Handle,
int NumFrames,
const char ** aNames,
double * aValues,
int * ErrorAddress)
Parameters
Handle [in]
A device handle. The handle is a connection ID for an active device. Generate a handle with LJM_Open or LJM_OpenS.
NumFrames [in]
The total number of frames to access. A frame consists of one value, so the number of frames is the size of the aNames
array.
aNames [in]
An array of names that specify the Modbus register(s) to write. Names can be found throughout the device datasheet or in the Modbus Map.
aValues [out]
An array of values received from the device. The array size should be same as the aNames
array. The values will be converted into doubles automatically.
ErrorAddress [out]
If error, the address responsible for causing an error.
Returns
LJM errorcodes or 0
for no error.
Remarks
This function is commonly used to read a handful of values at once, and is more convenient than LJM_eReadAddresses because it is not necessary to know the data type.
Example
Reading analog inputs 5, 6, and 10.
int LJMError;
int errorAddress;
const char * aNames[3] = {"AIN5", "AIN6", "AIN10"};
double ainValues[3];
double ain5;
double ain6;
double ain10;
// handle comes from LJM_Open()
LJMError = LJM_eReadNames(handle, 3, aNames, ainValues, &errorAddress);
if (LJMError != LJME_NOERROR) {
// Deal with error
}
ain5 = ainValues[0];
ain6 = ainValues[1];
ain10 = ainValues[2];