« Close

Datasheets and User Guides

App Notes

Software & Driver

 

2.2.5 - eWriteNameString

Writes a string, specified by name.

Syntax

LJM_ERROR_RETURN LJM_eWriteNameString(
                      int Handle, 
                      const char * Name, 
                      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.
Name [in]
The name that specifies the Modbus string-type register to write.  Names 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_eReadNameString. This is a convenience function that uses LJM_eNames. Only for use with Modbus register(s) 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_eWriteNameString(handle, "DEVICE_NAME_DEFAULT", newName);
if (LJMError != LJME_NOERROR) {
    // Deal with error
}