Skip to main content
Skip table of contents

eWriteNames [LJM User's Guide]

Write multiple device registers in one command, each register specified by name.

Syntax

LJM_ERROR_RETURN LJM_eWriteNames(
int Handle,
int NumFrames,
const char ** aNames,
const 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 [in]

An array of values to send to the device. The array size should be the same as the aNames array. The input data type of each value is a double, and will be converted into the correct data type 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 write a handful of values at once, and is more convenient than LJM_eWriteAddresses because it is not necessary to know the data type. More code examples coming soon.

Example

Change digital I/O 0, 1, and 2 to output high, and digital I/O 6 to output low.

C
int LJMError;
int errorAddress;
const char * aNames[4] = {"FIO0", "FIO1", "FIO2", "FIO6"};
double aValues[4] = {1, 1, 1, 0};

// handle comes from LJM_Open()
LJMError = LJM_eWriteNames(handle, 4, aNames, aValues, &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.