« Close

Datasheets and User Guides

App Notes

Software & Driver

 

2.6.10 - AddressesToTypes

Retrieves multiple data types for given Modbus register addresses.

Syntax

LJM_ERROR_RETURN LJM_AddressesToTypes(
                      int NumAddresses, 
                      int * aAddresses,
                      int * aTypes)

Parameters

NumAddresses [in]
The number of addresses to process.
aAddresses [in]
The array of address numbers to process. Set to size NumAddresses.
aTypes [out]
An output array containing the data types of each address specified in aAddresses. Set to size NumAddresses.

Returns

LJM errorcodes or 0 for no error.

Remarks

Convenience function to programmatically discover the types of many Modbus addresses. Most people can simply look in the Modbus Map. For each aAddresses[i] that is not found, the corresponding entry aTypes[i] will be set to LJM_INVALID_NAME_ADDRESS and this function will return LJME_INVALID_ADDRESS.

Examples

[C/C++] Get the type of Modbus address 6, which is AIN3, and Modbus address 2002, which is FIO2.

int LJMError;
int aAddresses[2] = {6, 2002};
int aTypes[2];
int TypeAIN3;
int TypeFIO2;
LJMError = LJM_AddressesToTypes(2, aAddresses, aTypes);
TypeAIN3 = aTypes[0];    //LJM_FLOAT32
TypeFIO2 = aTypes[1];    //LJM_UINT16