eWriteAddress
Write one device register value, specified by address.
Syntax
LJM_ERROR_RETURN LJM_eWriteAddress(
int Handle,
int Address,
int Type,
double Value)
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 register(s) to write. Addresses can be found throughout the device datasheet or in the Modbus Map.
Type [in]
The data type of the value:
Type | Integer Value |
---|---|
LJM_UINT16 | 0 |
LJM_UINT32 | 1 |
LJM_INT32 | 2 |
LJM_FLOAT32 | 3 |
Value [in]
The value to send to the device. The input data type is a double, and will be converted according to the Type
input.
Returns
LJM errorcodes or 0
for no error.
Remarks
For an alternate function using a name rather than address, see LJM_eWriteName.
Example
Write a value of 2.5V to the DAC0 analog output.
int LJMError;
// handle comes from LJM_Open()
LJMError = LJM_eWriteAddress(handle, 1000, 3, 2.5);
if (LJMError != LJME_NOERROR) {
// Deal with error
}