eWriteNameString [LJM User's Guide]
Write to a device register that expects a string value, 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
).
Example
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
}