« Close

Datasheets and User Guides

App Notes

Software & Driver

 

2.2.2 - eReadName

Read one value, specified by name.

Syntax

LJM_ERROR_RETURN LJM_eReadName(
                      int Handle,
                      const char * Name,
                      double * Value)

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.
Name [in]
The name that specifies the Modbus register(s) to read.  Names can be found throughout the device datasheet or in the Modbus Map.
Value [out]
The value returned from the device.

Returns

LJM errorcodes or 0 for no error.

Remarks

For an alternate function using an address rather than name, see LJM_eReadAddress. More code examples coming soon.

Example

[C/C++] Read the serial number of the device.

int LJMError;
double newValue;

// handle comes from LJM_Open()
LJMError = LJM_eReadName(handle, "SERIAL_NUMBER", &newValue);
if (LJMError != LJME_NOERROR) {
    // Deal with error
}
printf("SERIAL_NUMBER: %f\n", newValue);