Skip to main content
Skip table of contents

NamesToAddresses [LJM User's Guide]

Takes a list of Modbus register names as input and produces two lists as output - the corresponding Modbus addresses and types. These two lists can serve as input to functions that have Address/aAddresses and Type/aTypes as input parameters.

Syntax

LJM_ERROR_RETURN LJM_NamesToAddresses(
int NumFrames,
const char ** aNames,
int * aAddresses,
int * aTypes)

Parameters

NumFrames [in]

The number of names in aNames and the allocated size of aAddresses and aTypes.

aNames [in]

An array of null-terminated c-string register identifiers. These register identifiers can be register names or register alternate names.

aAddresses [out]

An output array containing the addresses specified by aNames in the same order, must be allocated to the size NumFrames before calling LJM_NamesToAddresses.

aTypes [out]

An output array containing the types specified by aNames in the same order, must be allocated to the size NumFrames before calling LJM_NamesToAddresses.

Returns

LJM errorcodes or 0 for no error.

Remarks

For each register identifier in aNames that is invalid, the corresponding aAddresses value will be set to LJM_INVALID_NAME_ADDRESS.

Example

Get the addresses and types of "AIN3" and "DAC0".

C
int LJMError;
const char * aNames[2] = {"AIN3", "DAC0"};
int aAddresses[2];
int aTypes[2];
int AIN3Address;
int AIN3Type;
int DAC0Address;
int DAC0Type;
 
LJMError = LJM_NamesToAddresses(2, aNames, aAddresses, aTypes);
AIN3Address = aAddresses[0];
AIN3Type = aTypes[0];
DAC0Address = aAddresses[1];
DAC0Type = aTypes[1];
JavaScript errors detected

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

If this problem persists, please contact our support.