Skip to main content
Skip table of contents

eReadAddressString [LJM User's Guide]

Read a device register that returns a string, specified by address.

Syntax

LJM_ERROR_RETURN LJM_eReadAddressString(

int Handle,

int Address,

char * String)

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 address that specifies the Modbus string-type register to read.  Addresses can be found throughout the device datasheet or in the Modbus Map.

String [out]

A string that is updated to contain the result of the read. Must be allocated to size LJM_STRING_ALLOCATION_SIZE (50) or greater prior to calling this function.

Returns

LJM errorcodes or 0 for no error.

Remarks

See also LJM_eWriteAddressString. This is a convenience function that uses LJM_eAddresses. Only for use with Modbus registers listed as type LJM_STRING (98).

Example

Read the device name.

C
int LJMError;
// LJM_STRING_ALLOCATION_SIZE is 50
char devName[LJM_STRING_ALLOCATION_SIZE];
// handle comes from LJM_Open()
LJMError = LJM_eReadAddressString(handle, 60500, devName);
if (LJMError != LJME_NOERROR) {
    // Deal with error
}
printf ("%s \n", devName);
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.