Skip to main content
Skip table of contents

eReadAddressArray [LJM User's Guide]

Read consecutive device registers, with the starting register specified by an address and type.

Syntax

LJM_ERROR_RETURN LJM_eReadAddressArray(
int Handle,
int Address,
int Type,
int NumValues,
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.

Address [in]

The address that specifies the Modbus register(s) to read. Addresses can be found throughout the device datasheet or in the Modbus Map.

Type [in]

The data type of the value(s):

NumValues [in]

The number of consecutive values to read.

aValues [out]

An array of values to be transferred from the device. The array size should be equal to NumValues. Each value will be converted according to Type.

ErrorAddress [out]

If error, the address responsible for causing an error.

Returns

LJM errorcodes or 0 for no error.

Remarks

The Name version of this function is LJM_eReadNameArray.

If NumValues is large enough, these functions will automatically split reads into multiple packets based on the current device's effective data packet size. Using both non-buffer and buffer registers in one function call is not supported.

Example

Read analog inputs 0 through 7

C
int LJMError;
int errorAddress;
double newValues[8];

// handle comes from LJM_Open()
LJMError = LJM_eReadAddressArray(handle, 0, LJM_FLOAT32, 8, newValues, &errorAddress);
if (LJMError != LJME_NOERROR) {
    // Deal with error
}
JavaScript errors detected

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

If this problem persists, please contact our support.