NameToAddress [LJM User's Guide]
Takes a Modbus register name as input and produces the corresponding Modbus address and type. These two values can serve as input to functions that have Address
and Type
as input parameters.
Syntax
LJM_ERROR_RETURN LJM_NameToAddress(
const char * Name,
int * Address,
int * Type)
Parameters
Name [in]
A null-terminated c-string register identifier. This register identifiers can be a register name or a register alternate name.
Address [out]
Output parameter containing the address specified by Name
.
Type [out]
Output parameter containing the type specified by Name
.
Returns
LJM errorcodes or 0
for no error.
Remarks
If Name
is not a valid register identifier, Address
will be set to LJM_INVALID_NAME_ADDRESS
.
Example
Get the address and type of "AIN3".
int LJMError;
int Address;
int Type;
LJMError = LJM_NameToAddress("AIN3", &Address, &Type);
printf("%d \n", Address);
// prints 6
printf("%d \n", Type);
// prints 3 for LJM_FLOAT32