« Close

Datasheets and User Guides

App Notes

Software & Driver

 

2.2.7 - eWriteAddressString

Writes a string, specified by address.

Syntax

LJM_ERROR_RETURN LJM_eWriteAddressString(
                      int Handle, 
                      int Address, 
                      const char * String) 

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.
Address [in]
The address that specifies the Modbus string-type register to write.  Addresses can be found throughout the device datasheet or in the Modbus Map.
String [in]
The string to write. Must null-terminate at size LJM_STRING_ALLOCATION_SIZE (50) or less.  

Returns

LJM errorcodes or 0 for no error.

Remarks

See also LJM_eReadAddressString. This is a convenience function that uses LJM_eAddresses. Only for use with Modbus registers listed as type LJM_STRING (98). More code examples coming soon.

Examples

[C/C++] Change the device name.

int LJMError;
// LJM_STRING_ALLOCATION_SIZE is 50
char newName[LJM_STRING_ALLOCATION_SIZE] = "My Favorite DAQ Device";

// handle comes from LJM_Open()
LJMError = LJM_eWriteAddressString(handle, 60500, newName);
if (LJMError != LJME_NOERROR) {
    // Deal with error
}