« Close

Datasheets and User Guides

App Notes

Software & Driver

 

2.6.7 - NameToAddress

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.

Examples

[C/C++] 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

2 comments

I guess its a typo in the example. Should be "LJM_NameToAddress" (not the plural version)

 

/Phermi

Yes, that was a typo. It's been fixed now. Thank you for letting us know!