2.3.3 - eWriteAddresses | LabJack
« Close

Datasheets and User Guides

App Notes

Software & Driver


2.3.3 - eWriteAddresses

Write multiple values, specified by address.


                      int Handle, 
                      int NumFrames, 
                      const int * aAddresses,
	              const int * aTypes, 
                      const double * aValues, 
                      int * ErrorAddress)


Handle [in]
A device handle. The handle is a connection ID for an active device. Generate a handle with LJM_Open or LJM_OpenS.
NumFrames [in]
The total number of frames to access. A frame consists of one value, so the number of frames is the size of the aAddresses array. 
aAddresses [in]
An array of addresses that specify the Modbus register(s) to write. Addresses can be found throughout the device datasheet or in the Modbus Map.
aTypes [in]
An array containing the data type of each 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
aValues [in]
An array of values to send to the device. The array size should be the size of the aAddresses array. The input data type of each value is a double, and they will be converted into the data type entered in aTypes.
ErrorAddress [out]
If error, the address responsible for causing an error.


LJM errorcodes or 0 for no error.


This function is used to write a handful of values at once, and is useful in programming languages that are not friendly towards the usage of strings. For programming languages that can use strings easily, see LJM_eWriteNames. More code examples coming soon.


[C/C++] Change digital I/O 0, 1, and 2 to output high, and digital I/O 6 to output low.

int LJMError;
int errorAddress;
int aAddresses[4] = {2000, 2001, 2002, 2006};
int aTypes[4] = {0, 0, 0, 0};
double aValues[4] = {1, 1, 1, 0};

// handle comes from LJM_Open()
LJMError = LJM_eWriteAddresses(handle, 4, aAddresses, aTypes, aValues, &errorAddress);
if (LJMError != LJME_NOERROR) {
    // Deal with error