# Hardware Control Tool

## Introduction

The **Hardware Control Tool** (*AxsunHardwareControlTool.exe*) is a Windows OS software interface for users of Axsun SS-OCT Laser Engine and DAQ products.  It provides a tab- and button-based GUI to easily interact with a variety of features provided by Axsun Laser Engine and DAQ devices.

The Hardware Control Tool ("HWCT") connects to the device using the [AxsunOCTControl API](https://docs.axsun.com/axsun-knowledge-base/api-references/axsunoctcontrol.dll) or [AxsunOCTControl\_LW API](https://docs.axsun.com/axsun-knowledge-base/api-references/axsunoctcontrol-lightweight) and supports communication over USB, RS-232, and Ethernet (depending on the device configuration). &#x20;

The Hardware Control Tool is recommended for users of the Axsun Integrated Engine with Ethernet / PCIe DAQ.  Its primary functions include:&#x20;

* configuring high-level Ethernet/PCIe DAQ features such as:
  * apodization window function and spectral shaping
  * dispersion compensation
  * pre-FFT and post-FFT background subtraction
  * processing pipeline bypass modes for raw data access
* starting and stopping OCT swept laser emission
* configuring K-clock delay and other power-on default settings
* operating an optional motorized Variable Delay Line (VDL)
* operating an optional visible aiming laser

### Compatibility Requirements

**Host PC:**  The Hardware Control Tool is compatible with Windows OS versions 10 an 11.  There are no special hardware requirements other than an available USB port (or RS-232 serial port) for each Axsun device, or a 1Gbps Ethernet port for connecting to the Ethernet DAQ via network interface.

**FPGA bitstream:**  The Hardware Control Tool supports the full functionality in legacy versions of the FPGA bitstream, but some functionality provided in the HWCT is specific only to newer FPGA bitstream versions.  [Keep your FPGA version current](https://docs.axsun.com/axsun-knowledge-base/how-tos/upgrading-fpga-bitstreams) to take advantage of new functionality.

**Laser and DAQ Hardware:**  Some HWCT functions support optional features which must be installed or enabled on the system at time of manufacture.  Your hardware may not support these functions.

### Relationship to OCT Host

Both [OCT Host](https://docs.axsun.com/axsun-knowledge-base/software-tools/oct-host) and the Hardware Control Tool provide a command & messaging interface to Axsun hardware devices.  Although they have some overlapping functionality, OCT Host is laser-centric and is intended to support debugging, field-service, and maintenance tasks, whereas the Hardware Control Tool is designed for users of the Axsun Ethernet/PCIe DAQ board and enables high-level interaction with advanced DAQ board features.

{% hint style="warning" %}
**WARNING:**  Do not open **OCT Host** and the **Hardware Control Tool** concurrently.  Ethernet DAQ hardware will accept only one network connection from a library instance at a time.
{% endhint %}

## Installation

{% hint style="success" %}
**HINT:**  Install the most recent version of the Hardware Control Tool in the most straightforward and automated fashion by [following the complete software installation instructions](https://docs.axsun.com/axsun-knowledge-base/guides/integrated-engine/installing-software) for the Axsun Integrated Engine.

The component-level installation instructions in this section are required ONLY if a custom installation is required to target a specific version of the HWCT or its dependencies.
{% endhint %}

* [Download the Axsun Hardware Control Tool](https://docs.axsun.com/axsun-knowledge-base/other/downloads#hardware-control-tool-.exe) and extract the .zip archive contents to your preferred location (there is no installer but you must keep the files in the extracted folder together). &#x20;
* If you plan to connect to Axsun devices via USB using the [AxsunOCTControl\_LW ](https://docs.axsun.com/axsun-knowledge-base/api-references/axsunoctcontrol-lightweight)library, you must [install the libusb library](https://docs.axsun.com/axsun-knowledge-base/api-references/axsunoctcontrol-lightweight/using-the-control_lw-api#libusb).&#x20;
* If you plan to connect to the Axsun DAQ via Ethernet, you must [configure the network adapter's IP address](https://docs.axsun.com/axsun-knowledge-base/guides/integrated-engine/installing-software#ethernet-network-adapter-configuration).
* The Microsoft Visual C++ Run-Time Library (2015-2022, 64-bit) must be installed in either your `C:\Windows\System32\` directory or in the same directory as the application which is calling *AxsunOCTControl\_LW\.dll*.  This is a common run-time library which likely already exists on your system from installation of an unrelated program or from your original Windows OS installation (depending on the OS version).  If it is not already present on your system, you can download it directly from Microsoft at:  <https://aka.ms/vs/17/release/vc_redist.x64.exe>
* The Hardware Control Tool requires installation of the LabVIEW Run-Time Engine which is available for download from National Instruments: &#x20;

  <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><p><strong>NOTE:</strong>  Download and install the particular LabVIEW Run-Time Engine which is compatible with the Hardware Control Tool version you are using:</p><p>Hardware Control Tool v1.0.0.236 or newer:  <a href="https://www.ni.com/en-us/support/downloads/software-products/download.labview.html#443841">LabVIEW Run-Time 2021, 64-bit</a></p><p>Hardware Control Tool v1.0.0.220 or older:  <a href="https://www.ni.com/en-us/support/downloads/software-products/download.labview.html#309628">LabVIEW Run-Time 2018, 64-bit</a></p></div>
* Launch the Hardware Control Tool GUI application (*AxsunHardwareControlTool.exe*).  If all dependencies were installed correctly the main window will launch without any pop-up warnings to indicate missing dependencies.  If missing dependencies are reported, review and repeat the installation instructions above or refer to the [Troubleshooting](https://docs.axsun.com/axsun-knowledge-base/ref-manual/gigabit-ethernet-daq-board/edaq-troubleshooting) page in the DAQ Reference Manual.

## Using the Hardware Control Tool

{% hint style="info" %}
**NOTE:**  Your screen may not match exactly with the screen representations shown in this guide, depending on your system configuration and installed firmware/software versions. &#x20;
{% endhint %}

[Physically connect and power-up the Axsun devices](https://docs.axsun.com/axsun-knowledge-base/guides/integrated-engine/making-connections).  Launch *AxsunHardwareControlTool.exe* and wait for the main window to open:

![Axsun Hardware Control Tool main window](https://3144558317-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LP1icDU_wgMhPOYQY7u%2F-MZUpzXHAzFdwuc-E7ds%2F-MZYQDurOUA49U1x4bWr%2Fimage.png?alt=media\&token=d06ba827-096b-4b42-b960-24bcb2c100f9)

Along with application & library version information, some introductory information about the intended behavior of the Hardware Control Tool is presented on the **About** tab:

* **Tip strips:**  Hovering the mouse cursor over buttons or indicators reveals additional information about their functionality or their associated [AxsunOCTControl\_LW.dll API](https://docs.axsun.com/axsun-knowledge-base/api-references/axsunoctcontrol-lightweight) method.  Use Tip Strip information as hints to help you integrate the device functionality into your custom client application based on the AxsunOCTControl\_LW library calls.
* **Indicator validity:**  Indicators in the Hardware Control Tool provide current status information about the device state only:&#x20;
  * when the associated board is connected and listed successfully in the DEVICES list, and
  * after an indicator is refreshed using an associated READ button (i.e. changes are not necessarily event-driven or automatically polled; you must poll manually when an indicator refresh is desired).
* **Board reconfiguration:**  The Hardware Control Tool generally does not automatically confirm success or failure of requested configuration changes. It is good practice to inspect for the desired change in the transmitted image or in the associated indicator following a manual refresh. With few exceptions, device configuration changes will NOT persist after the board is reset via cycling power.  Use the [Power-On Defaults](#power-on-defaults) tab to configure a device's default behavior.

### Connected Devices

Axsun devices (laser engines and DAQ boards) which are successfully connected to the Hardware Control Tool will always be listed along with their firmware (FW) version, FPGA version (DAQ board only), and interface type (Ethernet network, USB, or RS-232) in the upper left corner of the main Hardware Control Tool window:

![Laser Engine and Ethernet DAQ devices connected to the Hardware Control Tool](https://3144558317-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LP1icDU_wgMhPOYQY7u%2F-MZUpzXHAzFdwuc-E7ds%2F-MZYQa-skmEKgdrpJdmQ%2Fimage.png?alt=media\&token=c9f32059-e606-4526-be1d-4be2832916db)

If a physically connected and powered device is not listed, first try restarting the hardware by cycling its power.  If connection difficulties persist, see [USB Connection Problems ](https://docs.axsun.com/axsun-knowledge-base/ref-manual/gigabit-ethernet-daq-board/edaq-troubleshooting#usb-connection-problems)or [Ethernet DAQ Connection Problems](https://docs.axsun.com/axsun-knowledge-base/ref-manual/gigabit-ethernet-daq-board/edaq-troubleshooting#ethernet-daq-connection-problems) on the [Troubleshooting ](https://docs.axsun.com/axsun-knowledge-base/ref-manual/gigabit-ethernet-daq-board/edaq-troubleshooting)page to insure correct software configuration and installation.

{% hint style="info" %}
**NOTE:**  A DAQ connected via its PCIe interface can also be connected to the Hardware Control Tool via its USB or Ethernet interface.  However, the PCIe connection is established via the [Image Capture Tool](https://docs.axsun.com/axsun-knowledge-base/software-tools/image-capture-tool) GUI and the [AxsunOCTCapture ](https://docs.axsun.com/axsun-knowledge-base/api-references/axsunoctcapture.dll)library.  See the DAQ [Architecture & Interface Background ](https://docs.axsun.com/axsun-knowledge-base/ref-manual/gigabit-ethernet-daq-board/architecture-and-interfaces)page for more information.
{% endhint %}

### Laser Emission Controls & Indicator, Ethernet DAQ Imaging Mode Controls

**LASER: ON** and **LASER: OFF** buttons control the emission state of the laser. &#x20;

**EDAQ: LIVE**, **EDAQ: OFF**, and **EDAQ: RECORD** buttons control the imaging modes of an Ethernet-connected DAQ (for DAQs using the PCIe interface, use the corresponding buttons in the [Image Capture Tool](https://docs.axsun.com/axsun-knowledge-base/software-tools/image-capture-tool)).  Refer to [Controlling Operational Modes](https://docs.axsun.com/axsun-knowledge-base/ref-manual/gigabit-ethernet-daq-board/basic-operation#controlling-the-operational-mode) for more details on the DAQ behavior controlled by these buttons.

Laser emission status is shown by the green indicator next to the laser emission control buttons.

![Laser emission is ON as shown by the bright green indicator color.](https://3144558317-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LP1icDU_wgMhPOYQY7u%2F-LaqI53Rk-DNwNtPOXSP%2F-LaqIcsXHIt008z-lAy2%2Fimage.png?alt=media\&token=35b297ac-3a96-4ad9-936d-3c83bec739bb)

## Feature Group Tabs

Additional Hardware Control Tool features are grouped onto tabs which are arranged horizontally under the Connected Devices indicator.  The following sections highlight the relevant controls and indicators available on each tab.  Descriptions of functionality are often written near the relevant control directly on the tab.  Additional information can be found in the documentation for the underlying API functions in the [AxsunOCTControl](https://docs.axsun.com/axsun-knowledge-base/api-references/axsunoctcontrol.dll) or [AxsunOCTControl\_LW](https://docs.axsun.com/axsun-knowledge-base/api-references/axsunoctcontrol-lightweight) libraries. &#x20;

* Click on a tab's title to activate it in the foreground:

![Titles of the Feature Group Tabs in the Hardware Control Tool](https://3144558317-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LP1icDU_wgMhPOYQY7u%2F-MZUpzXHAzFdwuc-E7ds%2F-MZYRgrNUIf5WJkamTpl%2Fimage.png?alt=media\&token=a1d04959-f67c-4f9a-b0e7-fc9f29c6ed1b)

### Miscellaneous

| Control or Indicator Name               | AxsunOCTControl\_LW Functions | AxsunOCTControl Functions                                                                                                                                             |
| --------------------------------------- | ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **GO HOME**                             | `axHomeVDL()`                 | `HomeVDL()`                                                                                                                                                           |
| **VDL Position (mm)**                   | `axMoveAbsVDL()`              | `MoveAbsVDL()`                                                                                                                                                        |
| **K-Clock Delay (ns)**                  | `axSetClockDelay()`           | `SetClockDelay()`                                                                                                                                                     |
| **DAQ Timing Settings** (Clock)         | `axSetSampleClockSource()`    | `WriteDAQRegisterBit()` as described in [Advanced DAQ Features](https://docs.axsun.com/axsun-knowledge-base/ref-manual/gigabit-ethernet-daq-board/advanced-operation) |
| **DAQ Timing Settings** (Sweep Trigger) | `axSetSweepTriggerSource()`   | `WriteDAQRegisterBit()` as described in [Advanced DAQ Features](https://docs.axsun.com/axsun-knowledge-base/ref-manual/gigabit-ethernet-daq-board/advanced-operation) |
| **DAQ Timing Settings** (Image\_sync)   | `axSetImageSyncSource()`      | `WriteDAQRegisterBit()` as described in [Advanced DAQ Features](https://docs.axsun.com/axsun-knowledge-base/ref-manual/gigabit-ethernet-daq-board/advanced-operation) |
| **Listen for Network Devices**          | `axNetworkInterfaceOpen()`    | `StartNetworkControlInterface()` and `StopNetworkControlInterface()`                                                                                                  |
| **Visible Aiming Laser ON/OFF**         | `axSetPointerEmission()`      |                                                                                                                                                                       |
| **FPGA Resampling Phase Multiplier**    |                               |                                                                                                                                                                       |
| **FPGA Resampling Clock Delay**         |                               |                                                                                                                                                                       |

* The **Listen for Network Devices** toggle switch selects whether or not the Hardware Control Tool application will listen for (and establish & maintain a control connection with) an Ethernet DAQ present on the host computer's network interface.  If this switch is OFF, control connections require the USB interface.  Disabling the network-based control interface is for installations wherein an Ethernet DAQ is connected via Ethernet for high-bandwidth data capture only (using [AxsunOCTCapture](https://docs.axsun.com/axsun-knowledge-base/api-references/axsunoctcapture.dll)) but USB is the desired *control* interface for low-bandwidth command and status messaging.
* Controls related to a **Variable Delay Line (VDL), Visible Aiming Laser** emissio&#x6E;**,** and **FPGA Resampling** are only functional for systems which have these optional features installed or enabled.  [Contact Axsun](https://docs.axsun.com/axsun-knowledge-base/other/getting-help) for more details.
* The **Use&#x20;*****AxsunOCTControl\_LW*****&#x20;(requires restart)** toggle switch selects whether the Hardware Control Tool application will load the [AxsunOCTControl\_LW](https://docs.axsun.com/axsun-knowledge-base/api-references/axsunoctcontrol-lightweight) library (switch = ON) or the [AxsunOCTControl](https://docs.axsun.com/axsun-knowledge-base/api-references/axsunoctcontrol.dll) library (switch = OFF) the next time it is launched.  (The currently-loaded library and version is shown in the **Control Library & Version:** indicator at the bottom of the **About** tab.)&#x20;

![The Miscellaneous tab](https://3144558317-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LP1icDU_wgMhPOYQY7u%2F-MZUpzXHAzFdwuc-E7ds%2F-MZYSmCxe6zldrmIUKr3%2Fimage.png?alt=media\&token=82a431a1-59e6-4f0d-b7a8-12b83ced0812)

### Pipeline Modes & Subsampling

The **Pipeline Modes & Subsampling** tab selects the location from which captured data is transmitted to the host interface from within the DAQ's FPGA-based SS-OCT image processing pipeline.  Data is available in raw format directly from the ADC (or "Test Vectors"), in fully-processed intensity SS-OCT image format, or at intermediate steps within the processing pipeline. &#x20;

{% hint style="info" %}
**NOTE:**  Depending on the connected data capture interface (i.e. Ethernet or PCIe), **A-line Subsampling** may be required to prevent saturating the interface's data bandwidth. See [Advanced DAQ Features](https://docs.axsun.com/axsun-knowledge-base/ref-manual/gigabit-ethernet-daq-board/advanced-operation#raw-data-bypass-modes-and-a-line-subsampling) for more information.&#x20;
{% endhint %}

![The Pipeline Modes & Subsampling tab](https://3144558317-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LP1icDU_wgMhPOYQY7u%2F-MZUpzXHAzFdwuc-E7ds%2F-MZYTzU2cV2kxNl28GrS%2Fimage.png?alt=media\&token=5aceebd3-58e0-494a-854f-9dd1e3c7dc6b)

| Control or Indicator Name                                                                               | AxsunOCTControl\_LW Functions                                                                                                                                                | AxsunOCTControl Functions                                                                                                                                                                                              |
| ------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Subsampling Factor (1 of N)**                                                                         | `axSetSubsamplingFactor()`                                                                                                                                                   | `SetFPGARegister()`as described in [Advanced DAQ Features](https://docs.axsun.com/axsun-knowledge-base/ref-manual/gigabit-ethernet-daq-board/advanced-operation#raw-data-bypass-modes-and-a-line-subsampling)          |
| **Offset**                                                                                              | `axSetEightBitOffset()`                                                                                                                                                      | `SetFPGARegister()`as described in [Advanced DAQ Features](https://docs.axsun.com/axsun-knowledge-base/ref-manual/gigabit-ethernet-daq-board/advanced-operation#setting-gain-and-offset-for-dynamic-range-compression) |
| **Gain**                                                                                                | `axSetEightBitGain()`                                                                                                                                                        | `SetFPGARegister()`as described in [Advanced DAQ Features](https://docs.axsun.com/axsun-knowledge-base/ref-manual/gigabit-ethernet-daq-board/advanced-operation#setting-gain-and-offset-for-dynamic-range-compression) |
| <p><strong>Raw Data Source</strong> </p><p><strong>(ADCs</strong> or <strong>Test Vectors)</strong></p> | `axSetFPGARegisterSingleBit()` as described in [Advanced DAQ Features](https://docs.axsun.com/axsun-knowledge-base/ref-manual/gigabit-ethernet-daq-board/advanced-operation) | `WriteDAQRegisterBit()` as described in [Advanced DAQ Features](https://docs.axsun.com/axsun-knowledge-base/ref-manual/gigabit-ethernet-daq-board/advanced-operation)                                                  |
| Colored **Pipeline Mode** diagram buttons                                                               | `axSetPipelineMode()`                                                                                                                                                        | `SetFPGARegister()`as described in [Advanced DAQ Features](https://docs.axsun.com/axsun-knowledge-base/ref-manual/gigabit-ethernet-daq-board/advanced-operation#raw-data-bypass-modes-and-a-line-subsampling)          |

* **Colored buttons** to select a [DAQ Pipeline Bypass Mode](https://docs.axsun.com/axsun-knowledge-base/ref-manual/gigabit-ethernet-daq-board/advanced-operation#raw-data-bypass-modes-and-a-line-subsampling) are oriented horizontally in a left-to-right fashion representing the data flow direction through the SS-OCT data processing pipeline implemented in the FPGA.  These buttons configure the DAQ to transmit captured data to the host interface directly from the output of the selected processing block with all upstream blocks to the left enabled, and all downstream blocks to the right *'bypassed'*. &#x20;
  * **BLUE** buttons select Channel 1 (H) only,&#x20;
  * **RED** buttons select Channel 2 (V) only,&#x20;
  * **PURPLE** buttons select the vector sum of Channels 1 and 2 (i.e. polarization diverse mode), and
  * **PINK** buttons select both Channels 1 and 2 concurrently.

{% hint style="info" %}
**NOTE:**  The right-most **JPEG** block is non-functional when using the DAQ's PCIe interface.  JPEG image compression is available only for Ethernet-connected DAQs where data bandwidth reduction is desirable. &#x20;

**NOTE:**  It is not possible to access both Channels 1 and 2 concurrently when using JPEG compression on an Ethernet DAQ.
{% endhint %}

* **Choose A-line Subsampling approach** is a menu which configures the Hardware Control Tool to automatically program a A-Line Subsampling behavior specific to each subsequently selected Pipeline Bypass Mode:
  * **Set Manually** does not change subsampling. Use the **Subsampling Factor (1 of N)** control.
  * **No Subsampling** turns subsampling off resulting in maximum bandwidth (which may saturate the data interface in some situations).
  * **Automatic (Aggressive)** keeps bandwidth considerably under the maximum limit for all interfaces.
  * **Automatic (Max GigE BW)** sets subsampling appropriate for the maximum bandwidth supported by the Gigabit Ethernet interface for a 100 kHz laser.
  * **Automatic (100kHz PCIe)** sets subsampling appropriate for the maximum bandwidth supported by the PCIe interface for a 100 kHz laser.
  * **Automatic (200kHz PCIe)** sets subsampling appropriate for the maximum bandwidth supported by the PCIe interface for a 200 kHz laser.

![A-line Subsampling approach selection](https://3144558317-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LP1icDU_wgMhPOYQY7u%2F-MZUpzXHAzFdwuc-E7ds%2F-MZYWAdjL5NN6NrAb9UK%2Fimage.png?alt=media\&token=c777be91-e10a-4ec9-b612-4b22219dd466)

* **Configure Background** and **Configure Window** and **Configure Test Vectors** buttons are links to the [Background Subtraction](#background-subtraction) and [Windowing & Dispersion Compensation](#windowing-and-dispersion-compensation) and [Test Vectors](#test-vectors) tabs, respectively.  Use the additional controls on these separate tabs to configure the FPGA's associated OCT image processing features.

### Windowing & Dispersion Compensation

The **Windowing & Dispersion Compensation** tab provides the ability to upload a complex-valued [apodization window function](https://docs.axsun.com/axsun-knowledge-base/ref-manual/gigabit-ethernet-daq-board/advanced-operation#setting-the-apodization-window-function) "lookup-table" (LUT) which the DAQ's FPGA multiplies by every subsequently acquired A-scan.  Plots show the real and imaginary components of the loaded window functions in each of the two ADC channels.&#x20;

* Any selections or updates made in the **Ch 1 Windowing LUT Setup** control will be immediately uploaded to the DAQ and applied to the Channel 1/H data stream.
* If the **Ch 2 Window \_\_\_ from Ch 1** control is set to **Copy**, the Ch 1 window function will also be uploaded to the DAQ and applied to the Channel 2/V data stream.
* &#x20;If the **Ch 2 Window \_\_\_ from Ch 1** control is set to **Independent**, any selections or updates made in the **Ch 2 Windowing LUT Setup** control will be immediately uploaded to the DAQ and applied to the Channel 2/V data stream.

![The Windowing & Dispersion Compensation tab](https://3144558317-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LP1icDU_wgMhPOYQY7u%2F-MZnbYycfmMgj0DxfykA%2F-MZnwHuqT-kpuwxU2kSM%2Fimage.png?alt=media\&token=8e4335a1-9eda-46be-83f9-637239122005)

* The **Type** menu provides several commonly used [window function](https://en.wikipedia.org/wiki/Window_function) types which allow the user to trade off between side lobe suppression and PSF width by affecting the *magnitude* of the complex-valued window function.
* **Width (samples)** should be set depending on the laser and K-clock parameters as provided on [individual laser test reports](https://docs.axsun.com/axsun-knowledge-base/ref-manual/ss-oct-laser-engine/getting-started).  Acquired data points *after* the value selected in **Width (samples)** are zero-padded out to 2048 samples.  The value depends on the tuning bandwidth and the scan depth configured for a specific laser.
* **Coefficients a1, a2, and a3** are the linear, quadratic, and cubic coefficients in a [Taylor series](https://en.wikipedia.org/wiki/Taylor_series) polynomial expansion of the *phase* of the complex-valued window function and can be used to digitally compensate for dispersion in the OCT interferometer.
* If you wish to apply no window function at all, select "Ones" from the **Type** menu (i.e. constant unity magnitude) and set all "Coefficient a\_" values to 0.0 (i.e. zero phase adjustment).

{% hint style="info" %}
**HINT:**  Observe the effects of updating the windowing LUT in real-time by watching for changes in the live image display using the [Image Capture Tool](https://docs.axsun.com/axsun-knowledge-base/software-tools/image-capture-tool).
{% endhint %}

### Background Subtraction

The **Background Subtraction** tab provides controls for both Pre-FFT background subtraction and Post-FFT background subtraction in the image processing pipeline.  Background subtraction works via uploading a "lookup-table" (LUT) of the same length as the A-scan data which the FPGA then subtracts from every subsequently acquired A-scan on a sample-by-sample basis.

* **DISABLE** turns background subtraction off (sets all LUT values to zero).
* **LOAD FROM FILE...** displays a file dialog which can be used to load a background subtraction LUT from disk and upload it to the FPGA.

![The Background Subtraction tab](https://3144558317-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LP1icDU_wgMhPOYQY7u%2F-MZnbYycfmMgj0DxfykA%2F-MZnvZWGaNAyLPy_m2bL%2Fimage.png?alt=media\&token=5da37288-ae93-44ee-b1d7-11aaaa0dc927)

#### Pre-FFT DC Offsets

In addition to the LUT-based background subtraction, the FPGA can also subtract a constant offset from all samples in the A-scan, in order to compensate for small DC offsets inherent in each of the ADC channels.  This subtraction is performed before all other image processing steps.

* Adjust the **Pre-FFT DC Offsets** independently for **Ch 1** and **Ch 2** until the DC frequency content in post-FFT transmitted data is minimized.&#x20;

| Control or Indicator Name                                | AxsunOCTControl\_LW Functions                                                 | AxsunOCTControl Functions                     |
| -------------------------------------------------------- | ----------------------------------------------------------------------------- | --------------------------------------------- |
| <p></p><p><strong>Pre-FFT DC Offsets (Ch 1)</strong></p> | `axSetFPGARegisterSingleByte()` to set high (most significant) byte of Reg 39 | `SetFPGARegister()`to set high byte of Reg 39 |
| **Pre-FFT DC Offsets (Ch 2)**                            | `axSetFPGARegisterSingleByte()` to set low (least significant) byte of Reg 39 | `SetFPGARegister()`to set low byte of Reg 39  |

### FPGA Registers

The **FPGA Registers** tab is for low-level access (reading & writing) to the [primary control interface](https://docs.axsun.com/axsun-knowledge-base/ref-manual/gigabit-ethernet-daq-board/basic-operation#controlling-the-daq-fpga-via-reading-and-writing-registers) for the Axsun Ethernet/PCIe DAQ FGPA:  its control and status registers.

{% hint style="info" %}
**NOTE:**  Most DAQ FPGA functionality is exposed in the Hardware Control Tool GUI with high level feature-specific buttons and indicators (and in the [AxsunOCTControl\_LW ](https://docs.axsun.com/axsun-knowledge-base/api-references/axsunoctcontrol-lightweight)or [AxsunOCTCapture ](https://docs.axsun.com/axsun-knowledge-base/api-references/axsunoctcapture.dll)libraries with higher level feature-specific API calls), so user interaction with the low-level controls on this tab should be rare except in cases of advanced configuration.
{% endhint %}

![The FPGA Registers tab](https://3144558317-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LP1icDU_wgMhPOYQY7u%2F-MZYWZoa00o9FIn6v20o%2F-MZYYSpROGaIiloXZGhx%2Fimage.png?alt=media\&token=de4d1f9d-e756-41d7-969f-51f8b0ded904)

* The **READ ALL REGISTERS** button can be used to query all FPGA registers (numbered 0 to 95) and refresh the table of current values (provided in both hexadecimal and decimal notation).  Values which have changed since the last refresh will be highlighted in red.
* Depending on a given register's interpretation, updating an FPGA register value can be more convenient in either hexadecimal or decimal notation.  Select a register number in the **Reg#** field, enter a value in the **Hex Value** or **Dec Value** field, and then press the corresponding **WRITE** button to update the register.  Multiple fields are provided for convenience while re-entering the same register number/value combinations repeatedly.
* For those control registers interpreted as a [bitfield](https://en.wikipedia.org/wiki/Bit_field), it is convenient to set or clear a single control bit directly, without having to "read-modify-write" the entire 16-bit register value.  Use the **Write (single bit)** control to select a register number, a bit number (from 0 to 15), and then press the corresponding **SET** or **CLR** (clear) button to change the bit state as desired:

![Set or clear a single bit in a bitfield register.](https://3144558317-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LP1icDU_wgMhPOYQY7u%2F-MZxn8JBKQWmmSURIN4w%2F-MZxo4SCRuXKyndz5qIT%2Fimage.png?alt=media\&token=933c687c-6529-4202-b73e-aa7afe24b398)

* For those control registers interpreted as an array or [lookup-table](https://en.wikipedia.org/wiki/Lookup_table) (LUT), the desired sequence of array values can be entered into the **Write (array)** control by copying to the clipboard in a spreadsheet application and then pasting from the clipboard by pressing **From Clipboard,** or by loading directly from disk by pressing the **From CSV File...** button.  Once pasted or loaded, either one or both columns of values will be displayed for visual verification or manual modification if necessary.  Enter the target register number(s) in the **Reg#** fields (the two fields correspond to the two columns of array values) and then press the associated **WRITE** button to upload the array(s):

![Write an array of values to a target FPGA register](https://3144558317-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LP1icDU_wgMhPOYQY7u%2F-MZxn8JBKQWmmSURIN4w%2F-MZxp3ZEYj5IwEsYlof1%2Fimage.png?alt=media\&token=68f463ba-9228-4d8c-877e-14fea1bac5b1)

{% hint style="success" %}
**HINT:**  Right-click the mouse cursor on the array indicator border or on individual elements for additional interactivity with the values in the array, such as inserting or deleting rows or columns:
{% endhint %}

The following table shows correspondence between buttons on the HWCT user interface and associated API methods to perform FPGA register reads and writes.  Note that the [Image Capture Tool](https://docs.axsun.com/axsun-knowledge-base/software-tools/image-capture-tool) and [AxsunOCTCapture API](https://docs.axsun.com/axsun-knowledge-base/api-references/axsunoctcapture.dll) can also read and write registers if connected via the PCIe interface.

| Control or Indicator Name | <p>AxsunOCTControl\_LW </p><p>Functions</p>                       | AxsunOCTControl Functions                              |
| ------------------------- | ----------------------------------------------------------------- | ------------------------------------------------------ |
| **READ ALL REGISTERS**    | Loop using `axGetFPGARegister()` or use`axGetFPGARegisterRange()` | Loop using `GetFPGARegister()`                         |
| **WRITE** (full register) | `axSetFPGARegister()`                                             | `SetFPGARegister()`                                    |
| **Write (single bit)**    | `axSetFPGARegisterSingleBit()`                                    | `WriteDAQRegisterBit()`                                |
| **Write (array)**         | Loop using `axSetFPGARegister()` or use`axSetFPGADataArray()`     | Loop using `SetFPGARegister()` or use `SendFPGAData()` |
| n/a \*                    | `axSetFPGARegisterSingleByte()`                                   |                                                        |
| n/a \*                    | `axSetFPGARegisterSingleNibble()`                                 |                                                        |
| n/a \*                    | `axSetFPGARegisterMasked()`                                       |                                                        |

&#x20;      \* the HWCT user interface does not expose buttons for these special [AxsunOCTControl\_LW ](https://docs.axsun.com/axsun-knowledge-base/api-references/axsunoctcontrol-lightweight)methods but they are available for convenience when integrating this API.

### Power-On Defaults

Controls on the **Power-On Defaults** tab interact with the laser's or DAQ board's non-volatile memory which stores the default behavior to be applied when the device powers-on.  Selected settings will persist until explicitly changed again.&#x20;

![The Power-On Defaults tab](https://3144558317-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LP1icDU_wgMhPOYQY7u%2F-MZYWZoa00o9FIn6v20o%2F-MZYYvpa8U5P_HPsLsXO%2Fimage.png?alt=media\&token=27418701-3801-4462-b6b4-ebd4afca63e7)

#### LASER

* The **OCT Swept Laser Emission** menu has three possible behaviors.  Select a behavior from this menu to update the connected laser engine's non-volatile memory:

  * **OFF at power-up**:  swept laser emission will never be turned on at power-up
  * **Use Digital Input**:  the state of Pin 1 on the engine's [Aux & Interlock connector](https://docs.axsun.com/axsun-knowledge-base/ref-manual/electrical-interfaces-and-connectors) will control swept laser emission
  * **ON at power-up**:  swept laser emission will always be automatically turned on at power-up

* The **Aiming Laser Emission** menu has three possible behaviors.  If your engine has an optional aiming laser installed, select a behavior from this menu to update the connected laser engine's non-volatile memory:
  * **OFF at power-up**:  aiming laser emission will never be turned on at power-up
  * **Link to swept laser**:  aiming laser emission state will mirror that of the swept laser emission
  * **ON at power-up**:  aiming laser emission will always be automatically turned on at power-up

#### DAQ FPGA REGISTER CONFIG SCRIPT

[All DAQ functionality is controlled by a bank of FPGA registers](https://docs.axsun.com/axsun-knowledge-base/ref-manual/gigabit-ethernet-daq-board/basic-operation#controlling-the-daq-fpga-via-reading-and-writing-registers) which accept 16-bit values or bitfields.  Power-on default behavior of the DAQ is determined using the "[FPGA Configuration Script](https://docs.axsun.com/axsun-knowledge-base/ref-manual/gigabit-ethernet-daq-board/advanced-operation#saving-fpga-register-power-on-defaults)":  a list of register-number/register-value pairs stored in non-volatile memory and written automatically in a consecutive fashion to the FPGA registers during board initialization.

The **Power-On Defaults** tab displays the currently loaded FPGA Config Script in a read-only indicator labeled **DAQ's Configuration**, and a similar indicator labeled **Local Workspace** is provided for interactive editing.  The **elements** indicators display how many register-number/register-value pairs are currently in each indicator.&#x20;

* **<-- COPY from DAQ** copies the DAQ's current Config Script in non-volatile memory to the local workspace for editing.
* **WRITE to DAQ -->** overwrites the DAQ's Config Script in non-volatile memory with the contents of the local workspace.  Pressing this button is required to upload an edited Config Script.  A board restart is required to execute the newly loaded script (i.e. during the next board initialization).
* **<-- LOAD from FILE...** presents a file dialog to load an FPGA Config Script from disk into the Local Workspace.
* **--> SAVE to FILE...** presents a file dialog to save an FPGA Config Script from the Local Workspace to disk (for creating a back-up copy or for editing in a spreadsheet application)
* **COPY to Local Workspace -->** automatically creates register number/value entries in the Local Workspace based on the [DAQ's current register state](#fpga-registers) and the Windowing LUT(s) currently shown on the [Windowing & Dispersion Compensation](#windowing-and-dispersion-compensation) tab.  This provides an easy way to generate a new Config Script in the Local Workspace based on the current DAQ behavior and loaded window function.  (Pressing the **WRITE to DAQ-->** button is still required to the upload the new Config Script from the Local Workspace to the board.)

{% hint style="success" %}
**HINT:**  Use the **--> SAVE to FILE...** functionality to save a back-up copy of the original FPGA Config Script before uploading a new or modified Config Script.  This will enable you to revert back to the original script if necessary, by using the **<-- LOAD from FILE...** functionality to open your back-up copy.
{% endhint %}

### Test Vectors

The Axsun Ethernet/PCIe DAQ board can operate in an emulation mode wherein an arbitrary waveform can be loaded and then repeatedly substituted for sampled ADC data at the input to the imaging pipeline.  The downstream FPGA processing and transmission of data to a host PC behaves equivalently to the standard (non-emulated) mode of operation.

This feature is convenient if optically-generated OCT signals or k-clocks are unavailable to the DAQ (e.g. no laser or interferometer connected).  Data bandwidth, buffering mechanics, control interfaces, and API accesses are unchanged in emulation mode, and thus wholly relevant for purposes of software development & API integration, although the generated image is relatively static and uninteresting.

Waveforms for each channel are loaded as a "test vector" of length 2048 samples with 12-bits of dynamic range, just like real data generated by the analog-to-digital converters during normal operation.  The Hardware Control Tool's **Test Vectors** tab provides an interface for selecting among several typical waveform types (sine, square, triangle, sawtooth) and parameters (amplitude, frequency, phase, DC offset) for each channel independently.

![The Test Vectors tab](https://3144558317-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LP1icDU_wgMhPOYQY7u%2F-MZYWZoa00o9FIn6v20o%2F-MZYZH5sYzkZlAa8_YjE%2Fimage.png?alt=media\&token=bad148be-caab-4557-b9d3-4f4d6aca38b7)

Waveforms are displayed in the corresponding plot and uploaded to the DAQ automatically when one of the **Test Vector Setup** values is changed.

Pseudo-gaussian noise of varying amplitude can also be added using the **Test Vector Noise** control.  This simulated noise is introduced by the FPGA into an uploaded test vector and changes dynamically for each A-scan.  As such, this noise is not displayed in the corresponding plot in the Hardware Control Tool even though it will be apparent in the subsequently transmitted image from the DAQ.

Without a laser engine connected to provide sample clocks and sweep triggers, the DAQ will also need to be configured to sample and trigger off of internal clock sources (e.g. 500 or 900 MS/s sample clock, 100 kHz sweep trigger).  Configure these settings in the **DAQ Timing Settings** section of the [Miscellaneous](#miscellaneous) tab:

![DAQ Timing Settings on the Miscellaneous tab](https://3144558317-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LP1icDU_wgMhPOYQY7u%2F-MZYWZoa00o9FIn6v20o%2F-MZYbF_pcl2AxDrKD1J3%2Fimage.png?alt=media\&token=dfdc491a-dc25-40d6-a83d-651564455f08)

Once a Test Vector is downloaded, DAQ Timing Settings are configured as desired, and Test Vectors are selected as the raw data source (see [Pipeline Modes & Subsampling](#pipeline-modes-and-subsampling) tab), then use the usual GUI or API controls for [changing operational modes](#laser-emission-controls-and-indicator-ethernet-daq-imaging-mode-controls) and [pipeline modes](#pipeline-modes-and-subsampling) of the DAQ, just as if the ADCs were selected as the raw data source like during normal operation.

## Quitting the Hardware Control Tool

To exit the Hardware Control Tool and drop existing connections to Axsun devices, simply close the main window by clicking the "x" icon in the upper right corner:

![](https://3144558317-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LP1icDU_wgMhPOYQY7u%2F-MZYWZoa00o9FIn6v20o%2F-MZYZWBWX75HGXLZzXZa%2Fimage.png?alt=media\&token=04dbf366-4bc4-4428-88a2-8798ac278d23)
