« Close

Datasheets and User Guides

App Notes

Software & Driver

 

2.2.3 - eWriteAddress

Write one 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 LJM Constant Name LJM Constant Value
unsigned 16-bit integer LJM_UINT16 0
unsigned 32-bit integer LJM_UINT32 1
signed 32-bit integer LJM_INT32 2
floating point 32-bit 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.

Examples

[C/C++] 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
}