2.2.1 - eWriteName | LabJack
« Close

Datasheets and User Guides

App Notes

Software & Driver


2.2.1 - eWriteName

Write one value, specified by name.


                      int Handle, 
                      const char * Name, 
                      double Value)


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 register(s) to write.  Names can be found throughout the device datasheet or in the Modbus Map.
Value [in]
The value to send to the device.


LJM errorcodes or 0 for no error.


For an alternate function using an address rather than name, see LJM_eWriteAddress. More code examples coming soon.


[C/C++] Write a value of 2.5V to the DAC0 analog output

int LJMError;

// handle comes from LJM_Open()
LJMError = LJM_eWriteName(handle, "DAC0", 2.5);
if (LJMError != LJME_NOERROR) {
    // Deal with error


Is there any appreciable performance difference between calling WriteName and WriteAddress?

The only real difference between LJM_eWriteName and LJM_eWriteAddress is that WriteName does a name lookup to resolve the address and type of the name.

The first time a name needs to be resolved (basically when any Name function such as LJM_eWriteName or LJM_NameToAddress is called), LJM parses the constants file into memory and does the lookup. For each subsequent name that needs to be resolved, LJM has the names in-memory, so it only needs to do the lookup.

On my 2.2 GHz Intel Core 2 Duo with 2 GB of RAM with a rough benchmark testing program, the first name lookup takes approximately 90 milliseconds. Subsequent lookups take approximately 0.8 milliseconds. These times are measured using rough microsecond precision of LJM_NameToAddress calls (which essentially does only the lookup functionality for a given name). There are many caveats to benchmarking, so if performance is an issue, I recommend that you evaluate the timing yourself or just use the Address versions of functions.

The name lookup functionality is not particularly optimized at the time of this writing (LJM 1.0700).

Edit: Added notes to the benchmark paragraph.

Vince1's picture

Hi, in my project i want to get analog output to connect to my physical instrument Dashboard especially using my T7 Lapjack. Right now i get all  my display via labview displays/indicators on my Laptop

labjack support's picture

To update the value of an analog output, you simply need to write to the appropriate register, such as DAC0:


You can do that write with any function that does register writes, including the eWriteName function documented on this page.