Using the Control API

Installing Driver Dependencies

Follow the instructions for Installing OCT Host to also install the dependencies for the AxsunOCTControl API. OCT Host is a GUI application based on AxsunOCTControl.dll. For USB communication with Axsun devices, the AxsunOCTControl library also depends on LibUsbDotNet.dll and a USB device driver which are also installed with OCT Host.

Integrating Into Your Application

The AxsunOCTControl API can be called into from source code platforms that support .NET library integration. The basic syntax for several common languages is shown below:


Create an instance of an AxsunOCTControl object using its default constructor, then call member functions as desired:

AxsunOCTControl.AxsunOCTControl AOCT;
AOCT = new AxsunOCTControl.AxsunOCTControl();

string ControlVersion = "";
AOCT.GetControlVersion(ref ControlVersion);

More extensive sample code is available in the AxsunOCTControl function reference.


Integrating AxsunOCTControl in a C++ application requires some extra setup involving COM assembly registration. Refer to the Guide on Using AxsunOCTControl.dll in C++ for more details.

To use the AxsunOCTControl in a "plain-old" C application, first perform the steps to integrate AxsunOCTControl with a C++ application and then create an extern "C" {} wrapper library for the AxsunOCTControl.dll methods you wish to call.

NOTE: Consider using the "light-weight" AxsunOCTControl_LW library if your application is based on a C or C++ codebase.


Integrating AxsunOCTControl in a LabVIEW application is straightforward using the functions on the Connectivity -> .NET palette:

  • Place a Constructor Node function on your block diagram.

  • Use the file dialog to navigate to the location of the AxsunOCTControl.dll assembly on your disk, open it, and then select "AxsunOCTControl" in the list of available objects:

  • Place Invoke Node (.NET) functions and wire the reference output from the AxsunOCTControl constructor node to the reference input of the invoke node. Select desired AxsunOCTControl methods to call via each of the invoke nodes, for example GetControlVersion()

  • Add a string indicator and also a Close Reference function to explicitly close the AxsunOCTControl object at the end of your program flow.

  • Run the VI to display the version of the AxsunOCTControl library in the string indicator:

  • The Reg Event Callback function can be used to register a callback VI to execute when the library detects the connection or disconnection of a device.


% (note your library path may be different)
NET.addAssembly('C:\Program Files\Axsun\Axsun OCT Control\AxsunOCTControl.dll');
AOCT = AxsunOCTControl.AxsunOCTControl;
ControlVersionString = char(AOCT.GetControlVersion());

NOTE: A known bug (1759533) in MATLAB version R2018a may generate an "external component" exception. To avoid this, please downgrade to MATLAB 2017 or upgrade to MATLAB R2018b or newer.


Install the pythonnet library from

import clr
import string
import sys

# note your library path may be different
dllFile = r'C:\Program Files (x86)\Axsun\OCT Host\AxsunOCTControl'

from AxsunOCTControl import AxsunOCTControl
AOCT = AxsunOCTControl()                            # call constructor
ControlVersionString = AOCT.GetControlVersion()     # call library functions

Error Handling and Reporting

The tables below list possible error codes which can occur during the use of the AxsunOCTControl library and an Axsun OCT device such as a Laser Engine, Camera Link DAQ Board, or Ethernet/PCIe DAQ Board.

It is rare for errors to result from a device hardware malfunction. Rather, errors that do occur are more likely a result of device-host communication issues or an improper sequence of API calls. If an error or warning occurs that cannot be explained, try the following steps:

  1. Reset the AxsunOCTControl library instance and/or the GUI Tool (e.g. OCT Host, Hardware Control Tool, or your custom application) which is built around the AxsunOCTControl library.

  2. Restart (power-cycle) the device hardware.

  3. Restart the Host PC.

If unexplained errors or warnings continue after following these steps, please contact Axsun Customer Support.

Firmware Error Codes

Firmware errors are generated by the microcontroller on the OCT device (e.g. laser driver board or DAQ board) and reported to the user via the AxsunOCTControl library API or GUI tools based on this API.

Error Code

Description & Notes


No Error















Library Error Codes

Library errors are generated by the AxsunOCTControl library running on the host PC.

Error Code

Description & Notes













Last updated