« Close

Datasheets and User Guides

Software & Driver

 

5.11 - Can I write an LJM program without a device present?

Overview

LJM 1.1901 and later

If you need to write an LJM program but don't have a device available, you can use LJM_DEMO_MODE to prevent LJM from trying to open a real device. Demo mode is good for when your device is in shipping or being used for another project.

Demo mode allows you to:

  • Test your software setup to make sure LJM and language wrappers are working.
  • Write and learn the structure of a simple LJM program.

Usage

To use demo mode, pass LJM_DEMO_MODE (or the string "-2") as the Identifier for LJM_Open or LJM_OpenS. That will give you a handle that you can use for command-response communication—however, demo mode does not support stream mode.

Example of demo mode using C (including the ErrorCheck function include in the C/C++ examples):

    err = LJM_Open(LJM_dtANY, LJM_ctANY, LJM_DEMO_MODE, &handle);
    ErrorCheck(err, "LJM_Open");

    err = LJM_eWriteName(handle, "DAC0", 2.5);
    ErrorCheck(err, "LJM_eWriteName");

    double value;
    err = LJM_eReadName(handle, "AIN0", &value);
    ErrorCheck(err, "LJM_eReadName");
    printf("read: %f\n", value);

    err = LJM_Close(handle);
    ErrorCheck(err, "LJM_Close");

This may output something like:

read: 0.000000

With demo mode, functions like LJM_eReadNames return meaningless values. Future versions of LJM might return different values.

Not Supported

Demo mode does not support stream functions.

Demo mode does not support low-level functions.