LJM ByteArray Functions | LabJack

Free Shipping for U.S. Orders $150+   |   5-year Warranty   |   Try Our Devices & Support for 60 Days, Risk Free

LJM ByteArray Functions

If you need to send or receive bytes to or from an LJM-supported device, consider using the LJM ByteArray functions.

These functions automatically split writes or reads into multiple packets, if necessary. Because of this, you can write or read a large number of bytes without worrying about what the maximum packet size of the connection is. This is especially useful for buffer registers. For example:

Name versions:

Address versions:


[C/C++] Use LJM_eWriteNameByteArray to write a Lua script to device

int LJMError;
int ErrorAddress;
const char * luaScript =
    "LJ.IntervalConfig(0, 1000)\n"
    "while true do\n"
    "  if LJ.CheckInterval(0) then\n"
    "    print(LJ.Tick())\n"
    "  end\n"
const unsigned scriptLength = strlen(luaScript) + 1;

// handle comes from LJM_Open()
LJMError = LJM_eWriteAddressByteArray(
if (LJMError != LJME_NOERROR) {
    // Deal with error

See the LJM C/C++ examples download for a full example.