Integrator Resources

The official home for NAI Support

Not sure where to start? Try Quick Start Guide or ask a question below!

Toggle Components with Visual Button
JavaScript Form Processing

LVDT BasicOpsMenu

LVDT BasicOps Sample Application (SSK 1.x)

Overview

The LVDT BasicOps sample application demonstrates how to configure and read LVDT (Linear Variable Differential Transformer) measurement channels using the NAI Software Support Kit (SSK 1.x). LVDT modules are the input (measurement) counterpart to DL modules, which generate LVDT excitation signals. While a DL module drives an LVDT sensor with a reference voltage and produces a simulated position output, an LVDT module receives the sensor’s response signals and converts them to digital position data. For signal generation, see the DL BasicOps Sample Application.

An LVDT sensor works by coupling an AC excitation (reference) signal through a movable magnetic core to one or more secondary windings. As the core moves, the voltage ratio between the secondary windings (Va and Vb) changes proportionally to position. The module computes position from this ratio — in 4-wire mode using the formula (Va - Vb) / (Va + Vb), and in 2-wire mode using a simplified two-terminal measurement. The module also derives velocity, signal frequency, and individual winding voltages from the raw sensor signals.

This sample is the most comprehensive BasicOps example in the SSK. It covers position reading, wire mode selection, bandwidth and scale configuration, signal inversion, transformation ratio, track-and-hold latch, delta position monitoring, threshold configuration for six fault types, built-in test (BIT) operations, FIFO-based continuous data capture, interrupt configuration, and floating-point scaling. The sample supports LVDT module types LD1 through LD5 and LR2. It serves as a practical API reference — each menu command maps directly to one or more naibrd_LVDT_*() API calls that you can lift into your own code.

Prerequisites

Before running this sample, make sure you have:

  • An NAI board with an LVDT module installed (LD1-LD5 or LR2).

  • An LVDT or RVDT sensor connected to the module, or a DL module providing simulated excitation signals for loopback testing.

  • SSK 1.x installed on your development host.

  • The sample applications built. Refer to the SSK 1.x build instructions for your platform if you have not already compiled them.

How to Run

Launch the LVDT_BasicOpsMenu executable from your build output directory. On startup the application looks for a configuration file (default_LVDT_BasicOps.txt). On the first run, this file will not exist — the application will present an interactive board menu where you configure a board connection, card index, and module slot. You can save this configuration so that subsequent runs skip the menu and connect automatically. Once connected, a main command menu lets you exercise each LVDT operation, with dedicated submenus for thresholds, test/BIT, interrupts, FIFO, and floating-point scaling.

Board Connection and Module Selection

Note
This startup sequence is common to all NAI sample applications. The board connection and module selection code shown here is not specific to LVDT. For details on board connection configuration, see the First Time Setup Guide.

The main() function follows a standard SSK 1.x startup flow:

  1. Call naiapp_RunBoardMenu() to load a saved configuration file (if one exists) or present the interactive board menu. The configuration file (default_LVDT_BasicOps.txt) is not included with the SSK — it is created when the user saves their connection settings from the board menu. On the first run, the menu will always appear.

  2. Query the user for a card index with naiapp_query_CardIndex().

  3. Query for a module slot with naiapp_query_ModuleNumber().

  4. Retrieve the module ID with naibrd_GetModuleID() so downstream code can adapt to the specific LVDT variant installed.

#if defined (__VXWORKS__)
int32_t LVDT_BasicOpsMenu(void)
#else
int32_t main(void)
#endif
{
   bool_t stop = FALSE;
   int32_t cardIndex;
   int32_t moduleCnt;
   int32_t module;
   uint32_t moduleID = 0;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

   if (naiapp_RunBoardMenu(CONFIG_FILE) == TRUE)
   {
      while (stop != TRUE)
      {
         stop = naiapp_query_CardIndex(naiapp_GetBoardCnt(), 0, &cardIndex);
         if (stop != TRUE)
         {
            check_status(naibrd_GetModuleCount(cardIndex, &moduleCnt));
            stop = naiapp_query_ModuleNumber(moduleCnt, 1, &module);
            if (stop != TRUE)
            {
               moduleID = naibrd_GetModuleID(cardIndex, module);
               if ((moduleID != 0))
               {
                  LVDTBasicMenu_Run(cardIndex, module, moduleID);
               }
            }
         }

         printf("\nType Q to quit or Enter key to restart application:\n");
         stop = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
      }
   }

   printf("\nType the Enter key to exit the program: ");
   naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   naiapp_access_CloseAllOpenCards();

   return 0;
}
Important

Common connection errors you may encounter at this stage:

  • No board found — verify that the board is powered on and physically connected. Check that the configuration file lists the correct interface and address.

  • Connection timeout — confirm network settings (for Ethernet connections) or bus configuration (for PCI/PCIe). Firewalls and IP mismatches are frequent causes.

  • Invalid card or module index — indices are zero-based for cards and one-based for modules. Ensure the values you pass match your hardware setup.

  • Module not present at selected slot — the slot you selected does not contain an LVDT module. Use the board menu to verify which slots are populated.

Program Structure

Application Parameters

The sample stores the active card index, module number, module ID, and selected channel in a shared naiapp_AppParameters_t structure. Every command handler receives this structure so it can call the appropriate naibrd_LVDT_*() function with the correct hardware coordinates. In your own application, you will track these same values — typically as application globals or within your device context structure.

Command Tables and Menu Hierarchy

This sample uses five command tables organized in a hierarchy. The main menu (LVDT_BasicOpMenuCmds) provides 19 commands covering core LVDT operations plus entries that open the four submenus:

  • Main menu — wire mode, channel status enable, clear status, delta position, bandwidth, bandwidth select, LVDT scale, track-and-hold latch, transformation ratio, signal inversion, display mode toggle, plus submenu entries for thresholds, floating-point, test, interrupts, FIFO, and advanced options.

  • Threshold submenu — signal low, reference low, signal high, reference high, open, and short thresholds.

  • Test submenu — clear BIT status, set BIT error limit, set test position, enable/disable D0 (UBIT) and D3 (IBIT) tests, check power-on BIT.

  • Interrupt submenu — enable/disable interrupts, set edge/level trigger, set interrupt vector, set interrupt steering — each configurable per status type (BIT, signal low/high, reference low/high, open, short, delta position, summary).

  • FIFO submenu — threshold levels, size, data type, sample rate, delay, trigger control, software trigger, clear FIFO, clear FIFO status, plus a nested FIFO interrupt submenu.

The menu system is a sample convenience — in your own code, call these API functions directly.

Generation 5 vs. Legacy Module Detection

The LVDTBasicMenu_Run() function calls naibrd_LVDT_GetChannelCount() to determine the number of channels, and the display function uses a switch on the module ID to detect Generation 5 modules (LD1-LD5, LR2). Generation 5 modules expose additional readings (two-wire position B, Va, Vb, Va+Vb, delta position, velocity) and additional status types (signal high, reference high, open, short, summary, delta position) that are not available on legacy LVDT modules. The sample adapts its display and available commands accordingly.

int32_t MAX_CHANNELS = naibrd_LVDT_GetChannelCount(modid);

naiapp_AppParameters_t  LVDT_basicops_params;
p_naiapp_AppParameters_t LVDT_basicOps_params = &LVDT_basicops_params;
LVDT_basicOps_params->cardIndex = cardIndex;
LVDT_basicOps_params->module = module;
LVDT_basicOps_params->modId = modid;

Position Reading and Signal Configuration

This section covers the core LVDT measurement operations: reading position data, selecting wire mode, configuring bandwidth and scale, setting the transformation ratio, controlling signal inversion, and managing the track-and-hold latch.

Reading Position and Sensor Data

Each time the main menu displays, the sample reads all channel measurements by calling a series of naibrd_LVDT_Get*() functions. To read position data in your own application, call naibrd_LVDT_GetPosition() for the primary position value. On Generation 5 modules, you can also read two-wire position B, individual winding voltages (Va, Vb), the combined Va+Vb signal, signal and reference voltages, frequency, delta position, and velocity.

check_status(naibrd_LVDT_GetPosition(cardIndex, module, channel, &position));
check_status(naibrd_LVDT_GetFrequency(cardIndex, module, channel, &frequency));
check_status(naibrd_LVDT_GetSignalVoltage(cardIndex, module, channel, &sigvolt));
check_status(naibrd_LVDT_GetRefVoltage(cardIndex, module, channel, &refvolt));

/* Generation 5 modules provide additional readings */
check_status(naibrd_LVDT_GetTwoWirePosition(cardIndex, module, channel, NAIBRD_LVDT_TWO_WIRE_B, &positionB));
check_status(naibrd_LVDT_GetVaSignal(cardIndex, module, channel, NAI_LVDT_SIGNAL, &va));
check_status(naibrd_LVDT_GetVbSignal(cardIndex, module, channel, NAI_LVDT_SIGNAL, &vb));
check_status(naibrd_LVDT_GetVaVbSignal(cardIndex, module, channel, &vaVb));
check_status(naibrd_LVDT_GetDeltaPosition(cardIndex, module, channel, &deltaPos));
check_status(naibrd_LVDT_GetVelocity(cardIndex, module, channel, &velocity));
check_status(naibrd_LVDT_GetTwoWireVelocity(cardIndex, module, channel, NAIBRD_LVDT_TWO_WIRE_B, &velocityB));

The sample also supports raw hex display mode. To read raw register values instead of engineering units, call naibrd_LVDT_GetChannelRaw() with the appropriate NAI_LVDT_CHAN_RAW_* type constant (for example, NAI_LVDT_CHAN_RAW_POSITION, NAI_LVDT_CHAN_RAW_FREQUENCY).

Set Wire Mode (2-Wire / 4-Wire)

LVDT sensors come in two common wiring configurations. A 4-wire LVDT has separate connections for the two secondary windings (Va and Vb) plus the reference excitation, providing the highest accuracy. A 2-wire LVDT uses a simplified connection with fewer wires, which is common in space-constrained installations. To select the wire mode for a channel, call naibrd_LVDT_SetChanMode().

if (inputBuffer[0] == '2')
   mode = NAI_LVDT_2WIRE;
else
   mode = NAI_LVDT_4WIRE;
check_status(naibrd_LVDT_SetChanMode(cardIndex, module, channel, mode));
  • NAI_LVDT_2WIRE — two-wire mode.

  • NAI_LVDT_4WIRE — four-wire mode (default).

The wire mode must match the physical sensor wiring. Setting the wrong mode will produce incorrect position readings.

Set Bandwidth

Bandwidth controls the measurement filter cutoff frequency, which determines how quickly the position output responds to physical movement. A lower bandwidth reduces noise but increases response time; a higher bandwidth captures rapid motion but passes more noise. To set the bandwidth value for a channel, call naibrd_LVDT_SetBandwidth().

check_status(naibrd_LVDT_SetBandwidth(cardIndex, module, channel, bandwidth));

Consult your module’s manual for supported bandwidth values and their effect on measurement settling time.

Set Bandwidth Select Mode

The bandwidth select mode determines whether the module uses a manually configured bandwidth value or automatically selects the optimal bandwidth based on the excitation frequency. To configure this, call naibrd_LVDT_SetBandwidthSelect().

check_status(naibrd_LVDT_SetBandwidthSelect(cardIndex, module, channel, NAI_LVDT_BW_MANUAL));
/* or */
check_status(naibrd_LVDT_SetBandwidthSelect(cardIndex, module, channel, NAI_LVDT_BW_AUTOMATIC));
  • NAI_LVDT_BW_MANUAL — use the bandwidth value you configured with naibrd_LVDT_SetBandwidth().

  • NAI_LVDT_BW_AUTOMATIC — the module automatically selects bandwidth based on the detected excitation frequency.

Automatic mode is convenient when you do not know the exact excitation frequency ahead of time, or when the frequency may change during operation.

Set LVDT/RVDT Scale

The scale factor maps the raw sensor ratio to engineering units. For an LVDT, this typically represents the full-scale displacement in your chosen unit system. For an RVDT (Rotary Variable Differential Transformer), the scale represents the angular range. To set the scale, call naibrd_LVDT_SetLVDTScale().

check_status(naibrd_LVDT_SetLVDTScale(cardIndex, module, channel, lvdtScale));

Consult your module’s manual and your sensor’s data sheet to determine the correct scale value.

Set Transformation Ratio (TR) Value

The transformation ratio (TR) compensates for the actual voltage ratio of your specific LVDT sensor at full-scale displacement. Real sensors have manufacturing variations that cause the Va/Vb ratio to differ from the ideal. Setting the correct TR value ensures that the module’s computed position accurately reflects the physical displacement. Each channel has two TR values — A-side and B-side — corresponding to the two secondary windings (or to the two-wire A and two-wire B configurations).

check_status(naibrd_LVDT_SetTRValue(cardIndex, module, channel, NAIBRD_LVDT_TWO_WIRE_A, trValue));
/* or */
check_status(naibrd_LVDT_SetTRValue(cardIndex, module, channel, NAIBRD_LVDT_TWO_WIRE_B, trValue));

The TR value is typically provided in the LVDT sensor’s calibration data sheet. If you do not have calibration data, leave the TR at its default value and calibrate in software.

Set Signal Inversion Control

Signal inversion control lets you correct for reversed sensor wiring or change the sign convention of the position output without physically rewiring the sensor. You can invert the Va signal, the Vb signal, the reference signal, or the differential computation. When the Va-Vb differential is set to non-inverted, the position algorithm is (Va - Vb) / (Va + Vb). When inverted, it becomes (Vb - Va) / (Va + Vb).

/* Invert the Va signal */
check_status(naibrd_LVDT_SetSignalInversion(cardIndex, module, channel,
   NAIBRD_LVDT_SIGNAL_INV_VA, NAIBRD_LVDT_RESP_INVERTED_VA));

/* Set differential to inverted: (Vb - Va) / (Va + Vb) */
check_status(naibrd_LVDT_SetSignalInversion(cardIndex, module, channel,
   NAIBRD_LVDT_SIGNAL_INV_DIFF, NAIBRD_LVDT_RESP_DIFF_VB_VA));

Signal types: NAIBRD_LVDT_SIGNAL_INV_VA, NAIBRD_LVDT_SIGNAL_INV_VB, NAIBRD_LVDT_SIGNAL_INV_REF, NAIBRD_LVDT_SIGNAL_INV_DIFF.

Set Track and Hold Latch

The track-and-hold latch freezes the position value at the moment you enable it, allowing you to capture a snapshot of the position without it changing between reads. This is useful when you need to read position at a precise instant — for example, synchronized with an external event. After you read the position once, the latch automatically resets.

/* Enable the latch -- position is frozen until the next read */
check_status(naibrd_LVDT_SetLatch(cardIndex, module, channel, 0x1u));

/* After reading the position, the latch auto-resets to 0 */

Set Delta Position and Initialize Delta Position

Delta position monitoring lets you detect when a channel’s position changes by more than a specified amount. You set a delta threshold value, then enable delta position status reporting. When the position changes by more than the threshold, the delta position status flag is set.

To set the delta position threshold value, call naibrd_LVDT_SetDeltaPosition().

check_status(naibrd_LVDT_SetDeltaPosition(cardIndex, module, channel, deltaPos));

To enable or disable delta position status reporting for a channel, call naibrd_LVDT_SetInitDeltaPosition(). Enabling this also establishes the current position as the baseline from which delta changes are measured.

/* Enable delta position status reporting */
check_status(naibrd_LVDT_SetInitDeltaPosition(cardIndex, module, channel, (bool_t)0x1u));

/* Disable delta position status reporting */
check_status(naibrd_LVDT_SetInitDeltaPosition(cardIndex, module, channel, (bool_t)0x0u));

Enable/Disable Channel Status Reporting

Channel status enable controls whether the module actively monitors and reports fault conditions for a given channel. When disabled, the module does not update status flags for that channel, which can be useful for channels that are intentionally disconnected or unused.

/* Enable status reporting for the channel */
check_status(naibrd_LVDT_SetChanStatusEnable(cardIndex, module, channel, 1u));

/* Disable status reporting */
check_status(naibrd_LVDT_SetChanStatusEnable(cardIndex, module, channel, 0u));
Important

Common Errors

  • NAI_ERROR_NOT_SUPPORTED — the selected feature (such as two-wire position B, velocity, or signal inversion) is not available on your module type. Generation 5 modules (LD1-LD5, LR2) support the full feature set; legacy modules have a reduced set.

  • Position reads as zero or noise — verify that the sensor is connected and that the wire mode matches the physical wiring. Check that excitation voltage is present by reading naibrd_LVDT_GetRefVoltage().

  • Position reads full-scale incorrectly — verify the LVDT scale and transformation ratio values match your sensor’s specifications.

Threshold Configuration

LVDT modules provide six configurable thresholds for fault detection. When a measured value crosses a threshold, the corresponding status flag is set. This section covers all six threshold types available in the threshold submenu.

Signal Loss (Low) Threshold

The signal loss threshold defines the minimum acceptable signal voltage. When the signal voltage drops below this level, the Signal Low status flag is set, indicating a potential sensor disconnection or wiring fault. To configure this threshold, call naibrd_LVDT_SetSigLossThreshold().

check_status(naibrd_LVDT_SetSigLossThreshold(cardIndex, module, channel, threshold));

Reference Loss (Low) Threshold

The reference loss threshold defines the minimum acceptable reference (excitation) voltage. If the reference voltage drops below this level, it typically indicates a problem with the excitation source or the reference wiring. To configure this threshold, call naibrd_LVDT_SetRefLossThreshold().

check_status(naibrd_LVDT_SetRefLossThreshold(cardIndex, module, channel, threshold));

Signal Fault High Threshold

The signal fault high threshold defines the maximum acceptable signal voltage. A signal above this level may indicate an overvoltage condition or sensor wiring shorted to an excitation source. To configure this threshold, call naibrd_LVDT_SetThreshold() with the NAIBRD_LVDT_SIG_FAULT_HI_THRESHOLD type.

check_status(naibrd_LVDT_SetThreshold(cardIndex, module, channel,
   NAIBRD_LVDT_SIG_FAULT_HI_THRESHOLD, threshold));

Reference Fault High Threshold

The reference fault high threshold defines the maximum acceptable reference voltage. To configure this threshold, call naibrd_LVDT_SetThreshold() with the NAIBRD_LVDT_REF_FAULT_HI_THRESHOLD type.

check_status(naibrd_LVDT_SetThreshold(cardIndex, module, channel,
   NAIBRD_LVDT_REF_FAULT_HI_THRESHOLD, threshold));

Open Threshold

The open threshold detects an open-circuit condition on the sensor wiring. When the measured impedance or signal characteristics indicate an open connection, the Open status flag is set. To configure this threshold, call naibrd_LVDT_SetOpenThreshold().

check_status(naibrd_LVDT_SetOpenThreshold(cardIndex, module, channel, threshold));

Short Threshold

The short threshold detects a short-circuit condition on the sensor wiring. To configure this threshold, call naibrd_LVDT_SetShortThreshold().

check_status(naibrd_LVDT_SetShortThreshold(cardIndex, module, channel, threshold));

Reading Current Thresholds

The threshold submenu displays all six threshold values for all channels before prompting you to change one. To read thresholds in your own code:

check_status(naibrd_LVDT_GetSigLossThreshold(cardIndex, module, channel, &sigThreshold));
check_status(naibrd_LVDT_GetRefLossThreshold(cardIndex, module, channel, &refThreshold));
check_status(naibrd_LVDT_GetThreshold(cardIndex, module, channel, NAIBRD_LVDT_SIG_FAULT_HI_THRESHOLD, &sigHiThres));
check_status(naibrd_LVDT_GetThreshold(cardIndex, module, channel, NAIBRD_LVDT_REF_FAULT_HI_THRESHOLD, &refHiThres));
check_status(naibrd_LVDT_GetOpenThreshold(cardIndex, module, channel, &openThreshold));
check_status(naibrd_LVDT_GetShortThreshold(cardIndex, module, channel, &shortThreshold));
Important

Common Errors

  • NAI_ERROR_NOT_SUPPORTED — open and short thresholds are only available on Generation 5 modules. Legacy modules support only signal loss and reference loss thresholds.

  • Threshold has no effect — ensure channel status reporting is enabled via naibrd_LVDT_SetChanStatusEnable(). If status reporting is disabled for a channel, threshold crossings are not flagged.

  • Threshold value out of range — consult your module’s manual for valid threshold ranges. Setting a threshold to zero effectively disables that fault check.

Test and Calibration

The test submenu provides built-in test (BIT) operations for verifying module health and calibrating the measurement path. BIT injects a known test signal through the measurement circuitry and compares the result against expected values.

Set Test Position

The test position defines the expected position value that the module should measure when BIT is enabled. During a D0 (user-initiated BIT) test, the module injects a simulated sensor signal corresponding to this position and verifies that the measurement path produces a result within the BIT error limit. Test position is a module-level setting that applies to all channels.

check_status(naibrd_LVDT_SetTestPosition(cardIndex, module, testPosition));

Set BIT Error Limit

The BIT error limit defines the maximum acceptable difference between the test position and the measured position during a BIT test. If the measured position deviates from the test position by more than this limit, the BIT status flag is set for the corresponding channel.

check_status(naibrd_LVDT_SetBITErrorLimit(cardIndex, module, channel, bitErrorLimit));

Enable/Disable D0 Test (UBIT)

D0 test, also called User BIT (UBIT), is a user-initiated test that you trigger on demand. When enabled, the module substitutes the test position signal for the actual sensor input and checks the measurement result. To enable or disable D0 test, call naibrd_LVDT_SetModuleBITEnable() with NAI_LVDT_TEST_ENABLE_D0.

/* Enable D0 (UBIT) test */
check_status(naibrd_LVDT_SetModuleBITEnable(cardIndex, module, NAI_LVDT_TEST_ENABLE_D0, (bool_t)TRUE));

/* Disable D0 (UBIT) test */
check_status(naibrd_LVDT_SetModuleBITEnable(cardIndex, module, NAI_LVDT_TEST_ENABLE_D0, (bool_t)FALSE));

While D0 test is enabled, the channels report the test position rather than the actual sensor position. Remember to disable the test when you are done to resume normal measurement.

Enable/Disable D3 Test (IBIT)

D3 test, also called Initiated BIT (IBIT), is a more comprehensive self-test that exercises additional internal circuitry. To enable or disable D3 test, call naibrd_LVDT_SetModuleBITEnable() with NAI_LVDT_TEST_ENABLE_D3.

check_status(naibrd_LVDT_SetModuleBITEnable(cardIndex, module, NAI_LVDT_TEST_ENABLE_D3, (bool_t)TRUE));

Check Power-On BIT

Power-on BIT (PBIT) runs automatically when the module powers up. To check whether PBIT has completed and view its results, call naibrd_LVDT_CheckPowerOnBITComplete() and then read the BIT status for each channel.

check_status(naibrd_LVDT_CheckPowerOnBITComplete(cardIndex, module, &pBitComplete));
if (pBitComplete)
{
   for (channel = 1; channel <= channelCount; channel++)
   {
      check_status(naibrd_LVDT_GetStatus(cardIndex, module, channel, NAI_LVDT_STATUS_BIT_LATCHED, &bitStatus));
      /* bitStatus == 0: passed, bitStatus == 1: FAILED */
   }
}

Clear BIT Latched Status

To clear a channel’s latched BIT status flag after investigating a failure, call naibrd_LVDT_ClearStatus().

check_status(naibrd_LVDT_ClearStatus(cardIndex, module, channel, NAI_LVDT_STATUS_BIT_LATCHED));
Important

Common Errors

  • BIT fails on all channels — if the BIT error limit is set too low, normal measurement noise may exceed it. Increase the error limit and re-run the test.

  • Position reads test value during normal operation — D0 or D3 test is still enabled. Disable the test to resume normal sensor measurements.

  • PBIT not completed — the module may still be initializing. Wait a few seconds after power-on before checking PBIT status.

FIFO Operations

The FIFO subsystem captures position data continuously at a configurable sample rate, enabling data logging and post-processing workflows. Each channel has its own FIFO buffer. The FIFO submenu lets you configure the buffer, control triggering, and monitor fill status.

Set FIFO Size

The FIFO size determines how many samples the buffer can hold before it wraps or stops (depending on trigger mode). To set the FIFO size, call naibrd_LVDT_SetFIFOSize().

check_status(naibrd_LVDT_SetFIFOSize(cardIndex, module, channel, fifoSize));

Set FIFO Sample Rate

The sample rate controls how frequently the module captures a position sample into the FIFO. To set the sample rate, call naibrd_LVDT_SetFIFOSampleRateValue() for an engineering-unit value (in Hz), or naibrd_LVDT_SetFIFOSampleRate() for a raw register value.

/* Engineering units (Hz) */
check_status(naibrd_LVDT_SetFIFOSampleRateValue(cardIndex, module, channel, sampleRate));

/* Raw register value */
check_status(naibrd_LVDT_SetFIFOSampleRate(cardIndex, module, channel, sampleRateRaw));

Consult your module’s manual for the supported sample rate range.

Set FIFO Data Type

The FIFO data type selects which measurement value is captured into the FIFO. Different data type codes correspond to different output registers (position, velocity, Va, Vb, etc.). To set the data type, call naibrd_LVDT_SetFIFODataType().

check_status(naibrd_LVDT_SetFIFODataType(cardIndex, module, channel, fifoDataType));

Consult your module’s manual for the mapping between data type codes and measurement types.

Set FIFO Delay

The FIFO delay adds a configurable number of sample periods between the trigger event and the start of data capture. This is useful for pre-trigger buffering or for synchronizing capture with external events.

check_status(naibrd_LVDT_SetFIFODelay(cardIndex, module, channel, delay));

Set FIFO Threshold Levels

The FIFO has four watermark thresholds that generate status flags as the buffer fills: almost empty, low watermark, high watermark, and almost full. These thresholds let you implement flow control in your data collection loop — for example, reading data when the buffer crosses the high watermark to prevent overflow.

check_status(naibrd_LVDT_SetFIFOAlmostEmptyThreshold(cardIndex, module, channel, threshold));
check_status(naibrd_LVDT_SetFIFOLoThreshold(cardIndex, module, channel, threshold));
check_status(naibrd_LVDT_SetFIFOHiThreshold(cardIndex, module, channel, threshold));
check_status(naibrd_LVDT_SetFIFOAlmostFullThreshold(cardIndex, module, channel, threshold));

Set FIFO Trigger Control

The trigger mode determines when the FIFO starts and stops capturing data. To set the trigger mode, call naibrd_LVDT_SetFIFOTrigMode().

check_status(naibrd_LVDT_SetFIFOTrigMode(cardIndex, module, channel, fifoTrigMode));

Consult your module’s manual for available trigger modes and their behavior.

Software Trigger

To manually start a FIFO capture, issue a software trigger. This is a module-level command that triggers all channels simultaneously.

check_status(naibrd_LVDT_SoftwareTrigger(cardIndex, module));

Clear FIFO

To discard all data in a channel’s FIFO buffer and reset the count to zero, call naibrd_LVDT_ClearFIFO().

check_status(naibrd_LVDT_ClearFIFO(cardIndex, module, channel));

Reading FIFO Data and Status

To read the current FIFO count and the next data value, call naibrd_LVDT_GetFIFOCount() and naibrd_LVDT_GetFIFOValue(). The FIFO status word contains seven flags (empty, almost empty, low, high, almost full, full, sample done) packed into a bitmask.

check_status(naibrd_LVDT_GetFIFOCount(cardIndex, module, channel, &fifoCount));
check_status(naibrd_LVDT_GetFIFOValue(cardIndex, module, channel, &fifoDataRaw));

/* Read realtime and latched FIFO status */
check_status(naibrd_LVDT_GetFIFORealtimeStatus(cardIndex, module, channel, &fifoStatusRealtime));
check_status(naibrd_LVDT_GetFIFOLatchedStatus(cardIndex, module, channel, &fifoStatusLatched));

/* Decode individual status bits */
emptyRealtime = fifoStatusRealtime & 0x1u;           /* Bit 0 */
almostEmptyRealtime = (fifoStatusRealtime >> 1) & 0x1u; /* Bit 1 */
lowRealtime = (fifoStatusRealtime >> 2) & 0x1u;      /* Bit 2 */
highRealtime = (fifoStatusRealtime >> 3) & 0x1u;     /* Bit 3 */
almostFullRealtime = (fifoStatusRealtime >> 4) & 0x1u;  /* Bit 4 */
fullRealtime = (fifoStatusRealtime >> 5) & 0x1u;     /* Bit 5 */
doneRealtime = (fifoStatusRealtime >> 6) & 0x1u;     /* Bit 6 */

Clear FIFO Status

To clear a latched FIFO status flag, call naibrd_LVDT_ClearEventMappedStatus() with the appropriate status type constant.

/* Clear the FIFO Full latched status */
check_status(naibrd_LVDT_ClearEventMappedStatus(cardIndex, module, channel,
   NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_FULL_LATCH));

Available FIFO status types: NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_EMPTY_LATCH, NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_ALMOST_EMPTY_LATCH, NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_LOW_THRESHOLD_LATCH, NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_HIGH_THRESHOLD_LATCH, NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_ALMOST_FULL_LATCH, NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_FULL_LATCH, NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_DONE_LATCH.

FIFO Interrupt Submenu

The FIFO has its own interrupt configuration, separate from the main channel interrupts. You can enable interrupts on any of the FIFO status flags and configure edge/level trigger, vector, and steering independently. The API calls mirror the main interrupt functions but apply to FIFO events. For details on interrupt concepts, see the Interrupt Configuration section below.

Important

Common Errors

  • FIFO count stays at zero — verify that the trigger mode is set correctly and that a trigger has been issued (either software trigger or the configured hardware trigger condition).

  • FIFO overflows (full status set) — your read loop is not draining the FIFO fast enough. Increase the high watermark threshold and read data when the high watermark flag is set, or reduce the sample rate.

  • NAI_ERROR_NOT_SUPPORTED — FIFO operations are only available on Generation 5 LVDT modules.

Interrupt Configuration

The interrupt submenu configures hardware interrupts for LVDT status events. LVDT modules support interrupts on nine status types: BIT, signal fault low, signal fault high, reference fault low, reference fault high, open, short, delta position, and summary. Each status type has independent interrupt enable, edge/level trigger, vector, and steering settings.

Enable/Disable Interrupts

To enable or disable interrupts for a specific status type on a specific channel, call naibrd_LVDT_SetInterruptEnable().

/* Enable BIT interrupts for a channel */
check_status(naibrd_LVDT_SetInterruptEnable(cardIndex, module, channel,
   NAI_LVDT_STATUS_BIT_LATCHED, NAI_LVDT_STATE_ENABLED));

/* Disable signal low interrupts */
check_status(naibrd_LVDT_SetInterruptEnable(cardIndex, module, channel,
   NAI_LVDT_STATUS_SIGNAL_LOW_LATCHED, NAI_LVDT_STATE_DISABLED));

Set Edge/Level Interrupt Trigger

Edge-triggered interrupts fire once when the status transitions from inactive to active. Level-triggered interrupts fire continuously as long as the status remains active. To set the trigger type, call naibrd_LVDT_SetEdgeLevelInterrupt().

check_status(naibrd_LVDT_SetEdgeLevelInterrupt(cardIndex, module, channel,
   NAI_LVDT_STATUS_BIT_LATCHED, NAI_LVDT_EDGE_INTERRUPT));
/* or */
check_status(naibrd_LVDT_SetEdgeLevelInterrupt(cardIndex, module, channel,
   NAI_LVDT_STATUS_BIT_LATCHED, NAI_LVDT_LEVEL_INTERRUPT));

Set Interrupt Vector

The interrupt vector is a user-defined identifier that the interrupt handler receives when the interrupt fires. This lets your handler distinguish between different interrupt sources. Each status type has its own vector, configured at the module level (not per-channel).

check_status(naibrd_LVDT_SetInterruptVector(cardIndex, module,
   NAI_LVDT_STATUS_BIT_LATCHED, vector));

Set Interrupt Steering

Interrupt steering directs where the interrupt is delivered. Options include the VME bus, PCIe bus, CPCI bus, or one of three on-board processors. To set the steering for a status type, call naibrd_LVDT_SetInterruptSteering().

check_status(naibrd_LVDT_SetInterruptSteering(cardIndex, module,
   NAI_LVDT_STATUS_BIT_LATCHED, (naibrd_int_steering_t)NAIBRD_INT_STEERING_VME));

Available steering destinations: NAIBRD_INT_STEERING_VME, NAIBRD_INT_STEERING_ON_BOARD_0 (custom ARM application), NAIBRD_INT_STEERING_ON_BOARD_1 (NAI Ethernet Listener), NAIBRD_INT_STEERING_ON_BOARD_2, NAIBRD_INT_STEERING_PCIE_APP, NAIBRD_INT_STEERING_CPCI_APP.

For a detailed guide to interrupt handling patterns, see the Interrupts API Guide.

Important

Common Errors

  • Interrupts not firing — verify that the interrupt is enabled for the correct status type and channel, that the steering destination matches your bus type, and that your interrupt handler is registered at the system level.

  • Interrupt storm (continuous interrupts) — if using level-triggered interrupts, the interrupt fires continuously until the status condition is cleared. Either clear the status in your handler or switch to edge-triggered mode.

  • Wrong vector received — each status type has its own vector. Make sure you set the vector for the specific status type you are monitoring, not a different one.

Status and Diagnostics

Reading Status

The main menu display reads both realtime and latched status for every channel. Generation 5 modules expose nine status types: BIT, signal loss (low), reference loss (low), signal fault high, reference fault high, open, short, summary, and delta position. Legacy modules expose three: BIT, signal loss, and reference loss.

Each status type has a realtime variant (current state) and a latched variant (set on first occurrence, stays set until cleared). To read a status flag, call naibrd_LVDT_GetStatus().

check_status(naibrd_LVDT_GetStatus(cardIndex, module, channel, NAI_LVDT_STATUS_BIT_REALTIME, &BitStatusRealtime));
check_status(naibrd_LVDT_GetStatus(cardIndex, module, channel, NAI_LVDT_STATUS_BIT_LATCHED, &BitStatusLatched));
check_status(naibrd_LVDT_GetStatus(cardIndex, module, channel, NAI_LVDT_STATUS_SIGNAL_REALTIME, &SigLossRealtime));
check_status(naibrd_LVDT_GetStatus(cardIndex, module, channel, NAI_LVDT_STATUS_SIGNAL_LATCHED, &SigLossLatched));
check_status(naibrd_LVDT_GetStatus(cardIndex, module, channel, NAI_LVDT_STATUS_REF_REALTIME, &RefLossRealtime));
check_status(naibrd_LVDT_GetStatus(cardIndex, module, channel, NAI_LVDT_STATUS_REF_LATCHED, &RefLossLatched));

/* Generation 5 additional status types */
check_status(naibrd_LVDT_GetStatus(cardIndex, module, channel, NAI_LVDT_STATUS_SIGNAL_HIGH_REALTIME, &SigFaultHiRealtime));
check_status(naibrd_LVDT_GetStatus(cardIndex, module, channel, NAI_LVDT_STATUS_OPEN_REALTIME, &OpenRealtime));
check_status(naibrd_LVDT_GetStatus(cardIndex, module, channel, NAI_LVDT_STATUS_SHORT_REALTIME, &ShortRealtime));
check_status(naibrd_LVDT_GetStatus(cardIndex, module, channel, NAI_LVDT_STATUS_SUMMARY_REALTIME, &SummaryRealtime));
check_status(naibrd_LVDT_GetStatus(cardIndex, module, channel, NAI_LVDT_STATUS_DELTA_POS_REALTIME, &DeltaPosRealtime));

Clearing Latched Status

Latched status flags remain set until explicitly cleared. The sample prompts for the status type to clear and the channel, then calls naibrd_LVDT_ClearStatus(). Nine latched status types are available on Generation 5 modules.

/* Clear the latched signal fault low status */
check_status(naibrd_LVDT_ClearStatus(cardIndex, module, channel, NAI_LVDT_STATUS_SIGNAL_LOW_LATCHED));

/* Clear the latched open status */
check_status(naibrd_LVDT_ClearStatus(cardIndex, module, channel, NAI_LVDT_STATUS_OPEN_LATCHED));

Clearable latched status types: NAI_LVDT_STATUS_BIT_LATCHED, NAI_LVDT_STATUS_SIGNAL_LOW_LATCHED, NAI_LVDT_STATUS_REF_LOW_LATCHED, NAI_LVDT_STATUS_SIGNAL_HIGH_LATCHED, NAI_LVDT_STATUS_REF_HIGH_LATCHED, NAI_LVDT_STATUS_OPEN_LATCHED, NAI_LVDT_STATUS_SHORT_LATCHED, NAI_LVDT_STATUS_SUMMARY_LATCHED, NAI_LVDT_STATUS_DELTA_POS_LATCHED.

Floating-Point Mode

The floating-point submenu lets you enable floating-point data mode for the module and configure per-channel scale and offset values for position and velocity on both wire A and wire B. When floating-point mode is enabled, the module applies the formula: output = (raw_value * scale) + offset before returning data through the API.

To enable or disable floating-point mode at the module level:

check_status(naibrd_SetFloatingPointModeEnable(cardIndex, module, TRUE));  /* Enable */
check_status(naibrd_SetFloatingPointModeEnable(cardIndex, module, FALSE)); /* Disable */

To configure the eight floating-point attributes per channel (position A/B scale and offset, velocity A/B scale and offset):

check_status(naibrd_LVDT_SetFloatingPointPositionScale(cardIndex, module, channel, NAIBRD_LVDT_TWO_WIRE_A, scaleValue));
check_status(naibrd_LVDT_SetFloatingPointPositionOffset(cardIndex, module, channel, NAIBRD_LVDT_TWO_WIRE_A, offsetValue));
check_status(naibrd_LVDT_SetFloatingPointVelocityScale(cardIndex, module, channel, NAIBRD_LVDT_TWO_WIRE_A, scaleValue));
check_status(naibrd_LVDT_SetFloatingPointVelocityOffset(cardIndex, module, channel, NAIBRD_LVDT_TWO_WIRE_A, offsetValue));
/* Repeat with NAIBRD_LVDT_TWO_WIRE_B for the B-side values */

Advanced Options (Va/Vb Detect)

The advanced options submenu displays the Va Detect and Vb Detect values for each channel. These represent the raw detected signal levels on the Va and Vb windings before ratio computation, which can be useful for diagnosing sensor wiring issues.

naibrd_LVDT_GetVaSignal(cardIndex, module, channel, NAI_LVDT_SIGNAL_DETECT, &detectVa);
naibrd_LVDT_GetVbSignal(cardIndex, module, channel, NAI_LVDT_SIGNAL_DETECT, &detectVb);

Display Mode Toggle

The main menu and all submenus include commands to toggle between converted (engineering unit) display and raw hexadecimal display. In converted mode, position values appear as floating-point numbers; in hex mode, the raw 32-bit register values are shown. This does not change any hardware state — it only affects which API variant the sample calls (naibrd_LVDT_Get*() vs. naibrd_LVDT_GetChannelRaw()).

Important

Common Errors

  • All status flags show zero — channel status reporting may be disabled. Call naibrd_LVDT_SetChanStatusEnable() to enable it.

  • Latched status does not clear — verify that you are passing the correct latched status type constant (not the realtime variant) to naibrd_LVDT_ClearStatus().

  • Floating-point output unchanged — make sure floating-point mode is enabled at the module level with naibrd_SetFloatingPointModeEnable() before reading scaled values.

Troubleshooting Reference

Note
This section summarizes errors covered in the preceding sections and adds additional diagnostic guidance. Consult your module’s manual for hardware-specific diagnostics and specifications.
Error / Symptom Possible Causes Suggested Resolution

No board found

Board not powered, incorrect interface or address in configuration file.

Verify power and physical connection. Delete the configuration file and re-run the board menu.

Connection timeout

Network misconfiguration, firewall blocking traffic, incorrect bus settings.

Confirm IP address and subnet for Ethernet; verify PCI/PCIe enumeration for bus connections.

Module not present at slot

Selected slot is empty or contains a different module type.

Use the board menu to list populated slots. Verify the physical module installation.

Position reads zero with sensor connected

Wire mode mismatch, sensor not excited, incorrect channel selected.

Verify wire mode matches physical wiring. Check reference voltage with naibrd_LVDT_GetRefVoltage(). Verify excitation source (external or DL module) is active.

Position reads full-scale incorrectly

LVDT scale or transformation ratio (TR) not calibrated for the sensor.

Set the correct scale with naibrd_LVDT_SetLVDTScale() and TR with naibrd_LVDT_SetTRValue() per the sensor data sheet.

Signal or reference loss status set

Sensor disconnected, wiring fault, excitation source off, threshold set too high.

Check physical connections. Verify threshold values are appropriate for your signal levels.

BIT fails on all channels

BIT error limit set too tight, test position not configured, D0/D3 test not enabled.

Increase the BIT error limit. Verify the test position is set to a valid value. Enable D0 test before checking results.

Position shows test value during normal operation

D0 or D3 test is still enabled.

Disable D0/D3 test with naibrd_LVDT_SetModuleBITEnable() to resume normal measurements.

FIFO count stays at zero

Trigger not issued, trigger mode misconfigured, sample rate set to zero.

Issue a software trigger or verify the trigger mode. Set a valid sample rate.

FIFO overflows

Read loop not keeping up with sample rate.

Reduce sample rate, increase FIFO size, or read data more frequently using watermark thresholds.

Interrupts not firing

Interrupt not enabled for the correct status type, steering mismatch, handler not registered.

Verify enable, steering, and vector settings. Confirm your ISR is registered at the system level.

NAI_ERROR_NOT_SUPPORTED

Feature not available on this module type or generation.

Check which features your module supports. Generation 5 modules (LD1-LD5, LR2) support the full feature set.

Full Source

Full Source — LVDT_BasicOpsMenu.c (SSK 1.x)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <ctype.h>

/* Common Sample Program include files */
#include "include/naiapp_boardaccess_menu.h"
#include "include/naiapp_boardaccess_query.h"
#include "include/naiapp_boardaccess_access.h"
#include "include/naiapp_boardaccess_display.h"
#include "include/naiapp_boardaccess_utils.h"

/* naibrd include files */
#include "nai.h"
#include "naibrd.h"
#include "functions/naibrd_lvdt.h"
#include "advanced/nai_ether_adv.h"

static const int8_t *CONFIG_FILE = (const int8_t *)"default_LVDT_BasicOps.txt";

/* Function prototypes */
static bool_t LVDTBasicMenu_Run(int32_t cardIndex, int32_t module, uint32_t modid);
static void LVDTBasicMenu_displayMeasurements(int32_t cardIndex, int32_t module, uint32_t modid);
static void LVDTBasicMenu_displayMode(nai_lvdt_format_t mode);
/*Future use*/
/*static void LVDTBasicMenu_displayStatus(nai_status_bit_t BitStatus,  nai_status_bit_t SigLoss, nai_status_bit_t RefLoss);*/

/* LVDT Basic Ops Command Functions */
static nai_status_t LVDTBasicMenu_SetMode(int32_t paramCount, int32_t* p_params);
static nai_status_t LVDTBasicMenu_SetChanStatusEnable(int32_t paramCount, int32_t* p_params);
static nai_status_t LVDTBasicMenu_ClearStatus(int32_t paramCount, int32_t* p_params);
static nai_status_t LVDTBasicMenu_SetDeltaPosition(int32_t paramCount, int32_t* p_params);
static nai_status_t LVDTBasicMenu_InitDeltaPosition(int32_t paramCount, int32_t* p_params);
static nai_status_t LVDTBasicMenu_SetBandwidth(int32_t paramCount, int32_t* p_params);
static nai_status_t LVDTBasicMenu_SetBandwidthSelect(int32_t paramCount, int32_t* p_params);
static nai_status_t LVDTBasicMenu_SetLVDTScale(int32_t paramCount, int32_t* p_params);
static nai_status_t LVDTBasicMenu_SetLatch(int32_t paramCount, int32_t* p_params);
static nai_status_t LVDTBasicMenu_SetTRValue(int32_t paramCount, int32_t* p_params);
static nai_status_t LVDTBasicMenu_SetSignalInversion(int32_t paramCount, int32_t* p_params);
static nai_status_t LVDTBasicMenu_ThresholdMenu(int32_t paramCount, int32_t* p_params);
static nai_status_t LVDTBasicMenu_FloatingPointMenu(int32_t paramCount, int32_t* p_params);
static nai_status_t LVDTBasicMenu_TestMenu(int32_t paramCount, int32_t* p_params);
static nai_status_t LVDTBasicMenu_InterruptMenu(int32_t paramCount, int32_t* p_params);
static void LVDTBasicMenu_DisplayInterruptData(int32_t cardIndex, int32_t module, uint32_t modid);
static nai_status_t LVDTBasicMenu_FIFOMenu(int32_t paramCount, int32_t* p_params);
static void LVDTBasicMenu_DisplayFIFOData(int32_t cardIndex, int32_t module, uint32_t modid);
static nai_status_t LVDTBasicMenu_AdvancedOptionsMenu(int32_t paramCount, int32_t* p_params);
//static bool_t LVDTBasicMenu_SetSigLossThreshold(int32_t cardIndex, int32_t module, int32_t channel);
//static bool_t LVDTBasicMenu_SetRefLossThreshold(int32_t cardIndex, int32_t module, int32_t channel);

static nai_status_t LVDTTestMenu_ClearBITStatus(int32_t paramCount, int32_t* p_params);
static nai_status_t LVDTTestMenu_SetBITErrorLimit(int32_t paramCount, int32_t* p_params);
static nai_status_t LVDTTestMenu_SetTestPosition(int32_t paramCount, int32_t* p_params);
static nai_status_t LVDTTestMenu_SetD0TestEnable(int32_t paramCount, int32_t* p_params);
static nai_status_t LVDTTestMenu_SetD3TestEnable(int32_t paramCount, int32_t* p_params);
static nai_status_t LVDTTestMenu_CheckPowerOnBIT(int32_t paramCount, int32_t* p_params);

static nai_status_t LVDTInterruptMenu_SetInterruptEnable(int32_t paramCount, int32_t* p_params);
static nai_status_t LVDTInterruptMenu_SetEdgeLevelInterrupt(int32_t paramCount, int32_t* p_params);
static nai_status_t LVDTInterruptMenu_SetInterruptVector(int32_t paramCount, int32_t* p_params);
static nai_status_t LVDTInterruptMenu_SetInterruptSteering(int32_t paramCount, int32_t* p_params);

static nai_status_t LVDTFIFOMenu_SetFIFOThreshold(int32_t paramCount, int32_t* p_params);
static nai_status_t LVDTFIFOMenu_SetFIFOSize(int32_t paramCount, int32_t* p_params);
static nai_status_t LVDTFIFOMenu_SetFIFODataType(int32_t paramCount, int32_t* p_params);
static nai_status_t LVDTFIFOMenu_SetFIFOSampleRate(int32_t paramCount, int32_t* p_params);
static nai_status_t LVDTFIFOMenu_SetFIFODelay(int32_t paramCount, int32_t* p_params);
static nai_status_t LVDTFIFOMenu_ClearFIFO(int32_t paramCount, int32_t* p_params);
static nai_status_t LVDTFIFOMenu_SetFIFOTrigCtrl(int32_t paramCount, int32_t* p_params);
static nai_status_t LVDTFIFOMenu_SoftwareTrigger(int32_t paramCount, int32_t* p_params);
static nai_status_t LVDTFIFOMenu_ClearFIFOStatus(int32_t paramCount, int32_t* p_params);
static nai_status_t LVDTFIFOMenu_FIFOInterruptMenu(int32_t paramCount, int32_t* p_params);
static void LVDTFIFOMenu_DisplayFIFOInterruptData(int32_t cardIndex, int32_t module, uint32_t modid);

static nai_status_t LVDTFIFOIntMenu_SetFIFOIntEnable(int32_t paramCount, int32_t* p_params);
static nai_status_t LVDTFIFOIntMenu_SetFIFOEdgeLevelInt(int32_t paramCount, int32_t* p_params);
static nai_status_t LVDTFIFOIntMenu_SetFIFOIntVector(int32_t paramCount, int32_t* p_params);
static nai_status_t LVDTFIFOIntMenu_SetFIFOIntSteering(int32_t paramCount, int32_t* p_params);

static bool_t DisplayAsHex = FALSE;

/****** Command Table *******/
enum lvdt_basicOpsMenu_commands
{
   LVDT_BASICMENU_CMD_SET_MODE,
   LVDT_BASICMENU_CMD_SET_CHAN_STATUS_ENABLE,
   LVDT_BASICMENU_CMD_CLEAR_STATUS,
   LVDT_BASICMENU_CMD_SET_DELTA_POSITION,
   LVDT_BASICMENU_CMD_INIT_DELTA_POSITION,
   LVDT_BASICMENU_CMD_BANDWIDTH,
   LVDT_BASICMENU_CMD_BANDWIDTH_SELECT,
   LVDT_BASICMENU_CMD_SET_LVDT_SCALE,
   LVDT_BASICMENU_CMD_SET_LATCH,
   LVDT_BASICMENU_CMD_SET_TR_VALUE,
   LVDT_BASICMENU_CMD_SET_SIGNAL_INVERSION,
   LVDT_BASICMENU_CMD_THRESHOLD,
   LVDT_BASICMENU_CMD_FLOATING_POINT,
   LVDT_BASICMENU_CMD_TEST,
   LVDT_BASICMENU_CMD_INTERRUPT,
   LVDT_BASICMENU_CMD_FIFO,
   LVDT_BASICMENU_CMD_DISPLAY_CONVERTED,
   LVDT_BASICMENU_CMD_DISPLAY_HEX,
   LVDT_BASICMENU_CMD_ADVANCED_OPTIONS,
   LVDT_BASICMENU_CMD_COUNT
};

enum lvdt_basicOpsMenu_test_commands
{
   LVDT_TESTMENU_CMD_CLEAR_BIT_STATUS,
   LVDT_TESTMENU_CMD_SET_BIT_ERROR_LIMIT,
   LVDT_TESTMENU_CMD_SET_TEST_POSITION,
   LVDT_TESTMENU_CMD_ENABLE_D0_TEST,
   LVDT_TESTMENU_CMD_ENABLE_D3_TEST,
   LVDT_TESTMENU_CMD_CHECK_PBIT,
   LVDT_TESTMENU_CMD_DISPLAY_CONVERTED,
   LVDT_TESTMENU_CMD_DISPLAY_HEX,
   LVDT_TESTMENU_CMD_COUNT
};

enum lvdt_basicOpsMenu_interrupt_commands
{
   LVDT_INTERRUPTMENU_CMD_SET_INTERRUPT_ENABLE,
   LVDT_INTERRUPTMENU_CMD_SET_EDGE_LEVEL_INTERRUPT,
   LVDT_INTERRUPTMENU_CMD_SET_INTERRUPT_VECTOR,
   LVDT_INTERRUPTMENU_CMD_SET_INTERRUPT_STEERING,
   LVDT_INTERRUPTMENU_CMD_COUNT
};

enum lvdt_basicOpsMenu_fifo_commands
{
   LVDT_FIFOMENU_CMD_SET_THRESHOLD,
   LVDT_FIFOMENU_CMD_SET_SIZE,
   LVDT_FIFOMENU_CMD_SET_DATA_TYPE,
   LVDT_FIFOMENU_CMD_SET_SAMPLE_RATE,
   LVDT_FIFOMENU_CMD_SET_DELAY,
   LVDT_FIFOMENU_CMD_CLEAR_FIFO,
   LVDT_FIFOMENU_CMD_SET_TRIGGER_CTRL,
   LVDT_FIFOMENU_CMD_SOFTWARE_TRIGGER,
   LVDT_FIFOMENU_CMD_CLEAR_FIFO_STATUS,
   LVDT_FIFOMENU_CMD_FIFO_INTERRUPT_MENU,
   LVDT_FIFOMENU_CMD_DISPLAY_CONVERTED,
   LVDT_FIFOMENU_CMD_DISPLAY_HEX,
   LVDT_FIFOMENU_CMD_COUNT
};

enum lvdt_basicOpsMenu_fifo_interrupt_commands
{
   LVDT_FIFOINTMENU_CMD_SET_INT_ENABLE,
   LVDT_FIFOINTMENU_CMD_SET_EDGE_LEVEL_INT,
   LVDT_FIFOINTMENU_CMD_SET_INT_VECTOR,
   LVDT_FIFOINTMENU_CMD_SET_INT_STEERING,
   LVDT_FIFOINTMENU_CMD_COUNT
};

naiapp_cmdtbl_params_t LVDT_BasicOpMenuCmds[] = {
   {"0",       "Set LVDT Mode",                              LVDT_BASICMENU_CMD_SET_MODE,               LVDTBasicMenu_SetMode            },
   {"1",       "Enable/Disable Channel Status Reporting",    LVDT_BASICMENU_CMD_SET_CHAN_STATUS_ENABLE, LVDTBasicMenu_SetChanStatusEnable},
   {"2",       "Clear Latched Status",                       LVDT_BASICMENU_CMD_CLEAR_STATUS,           LVDTBasicMenu_ClearStatus        },
   {"3",       "Set LVDT Delta Position Value",              LVDT_BASICMENU_CMD_SET_DELTA_POSITION,     LVDTBasicMenu_SetDeltaPosition   },
   {"4",       "Initialize Delta Position Status Reporting", LVDT_BASICMENU_CMD_INIT_DELTA_POSITION,    LVDTBasicMenu_InitDeltaPosition  },
   {"5",       "Set LVDT Bandwidth",                         LVDT_BASICMENU_CMD_BANDWIDTH,              LVDTBasicMenu_SetBandwidth       },
   {"6",       "Set LVDT Bandwidth Select Mode",             LVDT_BASICMENU_CMD_BANDWIDTH_SELECT,       LVDTBasicMenu_SetBandwidthSelect },
   {"7",       "Set LVDT/RVDT Scale",                        LVDT_BASICMENU_CMD_SET_LVDT_SCALE,         LVDTBasicMenu_SetLVDTScale       },
   {"8",       "Set LVDT Track and Hold Latch Control",      LVDT_BASICMENU_CMD_SET_LATCH,              LVDTBasicMenu_SetLatch           },
   {"9",       "Set LVDT Transformation Ratio (TR) Value",   LVDT_BASICMENU_CMD_SET_TR_VALUE,           LVDTBasicMenu_SetTRValue         },
   {"A",       "Set LVDT Signal Inversion Control",          LVDT_BASICMENU_CMD_SET_SIGNAL_INVERSION,   LVDTBasicMenu_SetSignalInversion },
   {"B",       "Set LVDT Threshold Menu",                    LVDT_BASICMENU_CMD_THRESHOLD,              LVDTBasicMenu_ThresholdMenu      },
   {"C",       "LVDT Floating-Point Menu",                   LVDT_BASICMENU_CMD_FLOATING_POINT,         LVDTBasicMenu_FloatingPointMenu  },
   {"D",       "LVDT BIT Test Menu",                         LVDT_BASICMENU_CMD_TEST,                   LVDTBasicMenu_TestMenu           },
   {"E",       "LVDT Interrupt Menu",                        LVDT_BASICMENU_CMD_INTERRUPT,              LVDTBasicMenu_InterruptMenu      },
   {"F",       "LVDT FIFO Menu",                             LVDT_BASICMENU_CMD_FIFO,                   LVDTBasicMenu_FIFOMenu           },
   {"G",       "Display Values with Conversion",             LVDT_BASICMENU_CMD_DISPLAY_CONVERTED,      NULL                             },
   {"H",       "Display Values as Hex",                      LVDT_BASICMENU_CMD_DISPLAY_HEX,            NULL                             },
   {"I",       "Advanced Options",                           LVDT_BASICMENU_CMD_ADVANCED_OPTIONS,       LVDTBasicMenu_AdvancedOptionsMenu}
};

naiapp_cmdtbl_params_t LVDT_TestMenuCmds[] = {
   {"0",       "Clear BIT Latched Status",                LVDT_TESTMENU_CMD_CLEAR_BIT_STATUS,        LVDTTestMenu_ClearBITStatus    },
   {"1",       "Set BIT Error Limit",                     LVDT_TESTMENU_CMD_SET_BIT_ERROR_LIMIT,     LVDTTestMenu_SetBITErrorLimit  },
   {"2",       "Set LVDT D0 (UBIT) Test Position",        LVDT_TESTMENU_CMD_SET_TEST_POSITION,       LVDTTestMenu_SetTestPosition   },
   {"3",       "Enable or Disable D0 Test (UBIT)",        LVDT_TESTMENU_CMD_ENABLE_D0_TEST,          LVDTTestMenu_SetD0TestEnable   },
   {"4",       "Enable or Disable D3 Test (IBIT)",        LVDT_TESTMENU_CMD_ENABLE_D3_TEST,          LVDTTestMenu_SetD3TestEnable   },
   {"5",       "Check Power-On BIT",                      LVDT_TESTMENU_CMD_CHECK_PBIT,              LVDTTestMenu_CheckPowerOnBIT   },
   {"6",       "Display Values with Conversion",          LVDT_TESTMENU_CMD_DISPLAY_CONVERTED,       NULL                           },
   {"7",       "Display Values as Hex",                   LVDT_TESTMENU_CMD_DISPLAY_HEX,             NULL                           }
};

naiapp_cmdtbl_params_t LVDT_InterruptMenuCmds[] = {
   {"0", "Enable/Disable Interrupts",                LVDT_INTERRUPTMENU_CMD_SET_INTERRUPT_ENABLE,     LVDTInterruptMenu_SetInterruptEnable   },
   {"1", "Set Edge/Level Interrupt Trigger Setting", LVDT_INTERRUPTMENU_CMD_SET_EDGE_LEVEL_INTERRUPT, LVDTInterruptMenu_SetEdgeLevelInterrupt},
   {"2", "Set Interrupt Vector",                     LVDT_INTERRUPTMENU_CMD_SET_INTERRUPT_VECTOR,     LVDTInterruptMenu_SetInterruptVector   },
   {"3", "Set Interrupt Steering",                   LVDT_INTERRUPTMENU_CMD_SET_INTERRUPT_STEERING,   LVDTInterruptMenu_SetInterruptSteering }
};

naiapp_cmdtbl_params_t LVDT_FIFOMenuCmds[] = {
   {"0",      "Set FIFO Threshold",               LVDT_FIFOMENU_CMD_SET_THRESHOLD,           LVDTFIFOMenu_SetFIFOThreshold   },
   {"1",      "Set FIFO Size",                    LVDT_FIFOMENU_CMD_SET_SIZE,                LVDTFIFOMenu_SetFIFOSize        },
   {"2",      "Set FIFO Data Type",               LVDT_FIFOMENU_CMD_SET_DATA_TYPE,           LVDTFIFOMenu_SetFIFODataType    },
   {"3",      "Set FIFO Sample Rate",             LVDT_FIFOMENU_CMD_SET_SAMPLE_RATE,         LVDTFIFOMenu_SetFIFOSampleRate  },
   {"4",      "Set FIFO Delay",                   LVDT_FIFOMENU_CMD_SET_DELAY,               LVDTFIFOMenu_SetFIFODelay       },
   {"5",      "Clear FIFO",                       LVDT_FIFOMENU_CMD_CLEAR_FIFO,              LVDTFIFOMenu_ClearFIFO          },
   {"6",      "Set FIFO Trigger Control",         LVDT_FIFOMENU_CMD_SET_TRIGGER_CTRL,        LVDTFIFOMenu_SetFIFOTrigCtrl    },
   {"7",      "FIFO Software Trigger",            LVDT_FIFOMENU_CMD_SOFTWARE_TRIGGER,        LVDTFIFOMenu_SoftwareTrigger    },
   {"8",      "Clear FIFO Status",                LVDT_FIFOMENU_CMD_CLEAR_FIFO_STATUS,       LVDTFIFOMenu_ClearFIFOStatus    },
   {"9",      "FIFO Interrupt Menu",              LVDT_FIFOMENU_CMD_FIFO_INTERRUPT_MENU,     LVDTFIFOMenu_FIFOInterruptMenu  },
   {"A",      "Display Values with Conversion",   LVDT_FIFOMENU_CMD_DISPLAY_CONVERTED,       NULL                            },
   {"B",      "Display Values as Hex",            LVDT_FIFOMENU_CMD_DISPLAY_HEX,             NULL                            }
};

naiapp_cmdtbl_params_t LVDT_FIFOInterruptMenuCmds[] = {
   {"0", "Enable/Disable FIFO Interrupts",                LVDT_FIFOINTMENU_CMD_SET_INT_ENABLE,     LVDTFIFOIntMenu_SetFIFOIntEnable   },
   {"1", "Set FIFO Edge/Level Interrupt Trigger Setting", LVDT_FIFOINTMENU_CMD_SET_EDGE_LEVEL_INT, LVDTFIFOIntMenu_SetFIFOEdgeLevelInt},
   {"2", "Set FIFO Interrupt Vector",                     LVDT_FIFOINTMENU_CMD_SET_INT_VECTOR,     LVDTFIFOIntMenu_SetFIFOIntVector   },
   {"3", "Set FIFO Interrupt Steering",                   LVDT_FIFOINTMENU_CMD_SET_INT_STEERING,   LVDTFIFOIntMenu_SetFIFOIntSteering }
};
/*****************************************************************************/
/**
<summary>
The purpose of the LVDT_BasicOpsMenu is to illustrate the methods to call in the
naibrd library to perform basic operations with the LVDT modules for
configuration setup and reading the channels.

The following system configuration routines from the nai_sys_cfg.c file are
called to assist with the configuration setup for this program prior to
calling the naibrd LVDT routines.
 - ConfigDevice
 - DisplayDeviceCfg
 - GetBoardSNModCfg
 - CheckModule
</summary>
*/
/*****************************************************************************/
#if defined (__VXWORKS__)
int32_t LVDT_BasicOpsMenu(void)
#else
int32_t main(void)
#endif
{
   bool_t stop = FALSE;
   int32_t cardIndex;
   int32_t moduleCnt;
   int32_t module;
   uint32_t moduleID = 0;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

   if (naiapp_RunBoardMenu(CONFIG_FILE) == TRUE)
   {
      while (stop != TRUE)
      {
         /* Query the user for the card index */
         stop = naiapp_query_CardIndex(naiapp_GetBoardCnt(), 0, &cardIndex);
         if (stop != TRUE)
         {
            check_status(naibrd_GetModuleCount(cardIndex, &moduleCnt));

            /* Query the user for the module number */
            stop = naiapp_query_ModuleNumber(moduleCnt, 1, &module);
            if (stop != TRUE)
            {
               moduleID = naibrd_GetModuleID(cardIndex, module);
               if ((moduleID != 0))
               {
                  LVDTBasicMenu_Run(cardIndex, module, moduleID);
               }
            }
         }

         printf("\nType Q to quit or Enter key to restart application:\n");
         stop = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
      }
   }

   printf("\nType the Enter key to exit the program: ");
   naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   naiapp_access_CloseAllOpenCards();

   return 0;
}
/*****************************************************************************/
/**
<summary>
LVDTBasicMenu_Run illustrates the channel configuration and prepares the menu
which will handle user command requests. Returns TRUE if the user enters
the Quit Command at any point within its scope.
</summary>
*/
/*****************************************************************************/
static bool_t LVDTBasicMenu_Run(int32_t cardIndex, int32_t module, uint32_t modid)
{
   bool_t bQuit = FALSE;
   bool_t bCmdFound = FALSE;
   int32_t MAX_CHANNELS = naibrd_LVDT_GetChannelCount(modid);
   int32_t cmd;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

   naiapp_AppParameters_t  LVDT_basicops_params;
   p_naiapp_AppParameters_t LVDT_basicOps_params = &LVDT_basicops_params;
   LVDT_basicOps_params->cardIndex = cardIndex;
   LVDT_basicOps_params->module = module;
   LVDT_basicOps_params->modId = modid;

   do
   {
      naiapp_utils_LoadParamMenuCommands(LVDT_BASICMENU_CMD_COUNT, LVDT_BasicOpMenuCmds);
      LVDTBasicMenu_displayMeasurements(cardIndex, module, modid);
      naiapp_display_ParamMenuCommands((int8_t*)"LVDT Basic Operations");
      printf("\n Type command or %c to quit : ", NAI_QUIT_CHAR);
      bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
      if (!bQuit && inputResponseCnt > 0)
      {
         bCmdFound = naiapp_utils_GetParamMenuCmdNum(inputResponseCnt, inputBuffer, &cmd);
         if (bCmdFound)
         {
            if (cmd == LVDT_BASICMENU_CMD_DISPLAY_CONVERTED)
               DisplayAsHex = FALSE;
            else if (cmd == LVDT_BASICMENU_CMD_DISPLAY_HEX)
               DisplayAsHex = TRUE;
            else
            {
               if ((cmd == LVDT_BASICMENU_CMD_SET_MODE) || (cmd == LVDT_BASICMENU_CMD_THRESHOLD) ||
                   (cmd == LVDT_BASICMENU_CMD_SET_CHAN_STATUS_ENABLE) || (cmd == LVDT_BASICMENU_CMD_CLEAR_STATUS) ||
                   (cmd == LVDT_BASICMENU_CMD_FLOATING_POINT) || (cmd == LVDT_BASICMENU_CMD_SET_DELTA_POSITION) ||
                   (cmd == LVDT_BASICMENU_CMD_INIT_DELTA_POSITION) || (cmd == LVDT_BASICMENU_CMD_BANDWIDTH) ||
                   (cmd == LVDT_BASICMENU_CMD_BANDWIDTH_SELECT) || (cmd == LVDT_BASICMENU_CMD_SET_LVDT_SCALE) ||
                   (cmd == LVDT_BASICMENU_CMD_SET_TR_VALUE) || (cmd == LVDT_BASICMENU_CMD_SET_SIGNAL_INVERSION) ||
                   (cmd == LVDT_BASICMENU_CMD_SET_LATCH))
               {
                  naiapp_query_ChannelNumber(MAX_CHANNELS, 1, &LVDT_basicOps_params->channel);
               }
               else
               {
                  LVDT_basicOps_params->channel = 1;
               }
               LVDT_BasicOpMenuCmds[cmd].func(APP_PARAM_COUNT, (int32_t*)LVDT_basicOps_params);
            }
         }
         else
            printf(" Invalid command entered\n");
      }
   } while (!bQuit);
   return bQuit;
}
/*****************************************************************************/
/**
<summary>
LVDTBasicMenu_displayMeasurements illustrates the methods to call in the naibrd library
to retrieve the basic operation configuration states and status states
as well as the current lvdt reading for all channels.
</summary>
*/
/*****************************************************************************/
static void LVDTBasicMenu_displayMeasurements(int32_t cardIndex, int32_t module, uint32_t modid)
{
   int32_t channel = 0, MAX_CHANNEL = naibrd_LVDT_GetChannelCount(modid);
   nai_lvdt_format_t mode = 0u;
   uint32_t chanStatusEnable = 0u;

   uint32_t positionRaw = 0u, frequencyRaw = 0u, vaRaw = 0u, vbRaw = 0u, vaVbRaw = 0u, sigVoltRaw = 0u, refVoltRaw = 0u, deltaPosRaw = 0u;
   uint32_t positionBRaw = 0u, velocityRaw = 0u, velocityBRaw = 0u, trA = 0u, trB = 0u;
   float64_t position = 0.0, frequency = 0.0, sigvolt = 0.0, refvolt = 0.0, va = 0.0, vb = 0.0, deltaPos = 0.0;
   float64_t positionB = 0.0, velocity = 0.0, velocityB = 0.0, vaVb = 0.0;
   uint32_t bandwidth = 0u;
   nai_lvdt_bandwidth_select_t bwSelect = 0u;
   uint32_t lvdtScale = 0u;
   uint32_t latchCtrl = 0u;
   naibrd_lvdt_signal_inversion_resp_value_type_t invVaCtrl = NAIBRD_LVDT_RESP_NON_INVERTED_VA;
   naibrd_lvdt_signal_inversion_resp_value_type_t invVbCtrl = NAIBRD_LVDT_RESP_NON_INVERTED_VB;
   naibrd_lvdt_signal_inversion_resp_value_type_t invRefCtrl = NAIBRD_LVDT_RESP_NON_INVERTED_REF;
   naibrd_lvdt_signal_inversion_resp_value_type_t invVaVbCtrl = NAIBRD_LVDT_RESP_DIFF_VA_VB;

   uint32_t BitStatusRealtime = NAI_STATUS_BIT_LO, BitStatusLatched = NAI_STATUS_BIT_LO;
   uint32_t SigLossRealtime = NAI_STATUS_BIT_LO, SigLossLatched = NAI_STATUS_BIT_LO;
   uint32_t RefLossRealtime = NAI_STATUS_BIT_LO, RefLossLatched = NAI_STATUS_BIT_LO;
   uint32_t SigFaultHiRealtime = NAI_STATUS_BIT_LO, SigFaultHiLatched = NAI_STATUS_BIT_LO;
   uint32_t RefFaultHiRealtime = NAI_STATUS_BIT_LO, RefFaultHiLatched = NAI_STATUS_BIT_LO;
   uint32_t OpenRealtime = NAI_STATUS_BIT_LO, OpenLatched = NAI_STATUS_BIT_LO;
   uint32_t ShortRealtime = NAI_STATUS_BIT_LO, ShortLatched = NAI_STATUS_BIT_LO;
   uint32_t SummaryRealtime = NAI_STATUS_BIT_LO, SummaryLatched = NAI_STATUS_BIT_LO;
   uint32_t DeltaPosRealtime = NAI_STATUS_BIT_LO, DeltaPosLatched = NAI_STATUS_BIT_LO;

   bool_t gen5 = FALSE;
   char strChanStatusEnable[20] = "";
   char strBwSelect[12] = "";
   char strInvVaCtrl[14] = "";
   char strInvVbCtrl[14] = "";
   char strInvRefCtrl[14] = "";
   char strInvVaVbCtrl[37] = "";

   switch (modid)
   {
      case NAI_MODULE_ID_LD1:
      case NAI_MODULE_ID_LD2:
      case NAI_MODULE_ID_LD3:
      case NAI_MODULE_ID_LD4:
      case NAI_MODULE_ID_LD5:
      case NAI_MODULE_ID_LR2:
         printf("\n\n===================================================================================================================================================================\n");
         printf("%18s%10s%13s%11s%72s%11s%17s%10s\n", "", "Chan Stat", "", "Pos B (2-", "", "Delta", "", "Vel B (2-");
         printf("%7s%5s%14s%14s%13s%11s%8s%12s%14s%14s%12s%13s%13s%13s\n", "Chan", "Mode", "Enable", "Position", "Wire Only)", "Frequency", "Va", "Vb", "Va+Vb", "SigVolt", "RefVolt", "Position", "Velocity", "Wire Only)");
         printf("-------------------------------------------------------------------------------------------------------------------------------------------------------------------\n");
         gen5 = TRUE;
         break;
      default:
         printf("\n\n=========================================================================================== \n");
         printf("%7s%5s%17s%12s%12s%12s%6s%10s%10s\n", "Chan", "Mode", "Position", "Frequency", "SigVolt", "RefVolt", "BIT", "SigLoss", "RefLoss");
         gen5 = FALSE;
         break;
   }

   for( channel = 1; channel <= MAX_CHANNEL; channel++)
   {
      printf("%4d    ", channel);
      check_status(naibrd_LVDT_GetChanMode(cardIndex, module, channel, &mode));
      LVDTBasicMenu_displayMode(mode);
      //   uint32_t positionRaw, frequencyRaw, vaRaw, vbRaw, sigVoltRaw, refVoltRaw;
      if (DisplayAsHex)
      {
         check_status(naibrd_LVDT_GetChannelRaw(cardIndex, module, channel, NAI_LVDT_CHAN_RAW_POSITION, &positionRaw));
         check_status(naibrd_LVDT_GetChannelRaw(cardIndex, module, channel, NAI_LVDT_CHAN_RAW_FREQUENCY, &frequencyRaw));
         check_status(naibrd_LVDT_GetChannelRaw(cardIndex, module, channel, NAI_LVDT_CHAN_RAW_SIGNAL_VOLTAGE, &sigVoltRaw));
         check_status(naibrd_LVDT_GetChannelRaw(cardIndex, module, channel, NAI_LVDT_CHAN_RAW_REF_VOLTAGE, &refVoltRaw));

         if (gen5)
         {
            check_status(naibrd_LVDT_GetChanStatusEnable(cardIndex, module, channel, &chanStatusEnable));
            switch (chanStatusEnable)
            {
               case TRUE:
                  sprintf(strChanStatusEnable, "Enabled ");
               break;
               case FALSE:
                  sprintf(strChanStatusEnable, "Disabled");
               break;
               default:
                  sprintf(strChanStatusEnable, "Unknown ");
               break;
            }
            check_status(naibrd_LVDT_GetChannelRaw(cardIndex, module, channel, NAI_LVDT_CHAN_RAW_POSITION_2WIRE_B, &positionBRaw));
            check_status(naibrd_LVDT_GetChannelRaw(cardIndex, module, channel, NAI_LVDT_CHAN_RAW_VA, &vaRaw));
            check_status(naibrd_LVDT_GetChannelRaw(cardIndex, module, channel, NAI_LVDT_CHAN_RAW_VB, &vbRaw));
            check_status(naibrd_LVDT_GetChannelRaw(cardIndex, module, channel, NAI_LVDT_CHAN_RAW_VA_VB, &vaVbRaw));
            check_status(naibrd_LVDT_GetChannelRaw(cardIndex, module, channel, NAI_LVDT_CHAN_RAW_DELTA_POSITION, &deltaPosRaw));
            check_status(naibrd_LVDT_GetChannelRaw(cardIndex, module, channel, NAI_LVDT_CHAN_RAW_VELOCITY, &velocityRaw));
            check_status(naibrd_LVDT_GetChannelRaw(cardIndex, module, channel, NAI_LVDT_CHAN_RAW_VELOCITY_2WIRE_B, &velocityBRaw));
            printf("%-10s0x%08X  0x%08X  0x%08X  0x%08X  0x%08X  0x%08X  0x%08X  0x%08X   0x%08X   0x%08X   0x%08X",
                   strChanStatusEnable, positionRaw, positionBRaw, frequencyRaw, vaRaw, vbRaw, vaVbRaw, sigVoltRaw, refVoltRaw,
                   deltaPosRaw, velocityRaw, velocityBRaw);
         }
         else
         {
            check_status(naibrd_LVDT_GetStatus(cardIndex, module, channel, NAI_LVDT_STATUS_BIT_LATCHED, &BitStatusLatched));
            check_status(naibrd_LVDT_GetStatus(cardIndex, module, channel, NAI_LVDT_STATUS_SIGNAL_LATCHED, &SigLossLatched));
            check_status(naibrd_LVDT_GetStatus(cardIndex, module, channel, NAI_LVDT_STATUS_REF_LATCHED, &RefLossLatched));
            printf("0x%08X  0x%08X  0x%08X  0x%08X%5d%8d%8d", positionRaw, frequencyRaw, sigVoltRaw, refVoltRaw, BitStatusLatched, SigLossLatched, RefLossLatched);
         }
      }
      else
      {
         check_status(naibrd_LVDT_GetPosition(cardIndex, module, channel, &position));
         check_status(naibrd_LVDT_GetFrequency(cardIndex, module, channel, &frequency));
         check_status(naibrd_LVDT_GetSignalVoltage(cardIndex, module, channel, &sigvolt));
         check_status(naibrd_LVDT_GetRefVoltage(cardIndex, module, channel, &refvolt));

         if (gen5)
         {
            check_status(naibrd_LVDT_GetChanStatusEnable(cardIndex, module, channel, &chanStatusEnable));
            switch (chanStatusEnable)
            {
               case TRUE:
                  sprintf(strChanStatusEnable, "Enabled ");
               break;
               case FALSE:
                  sprintf(strChanStatusEnable, "Disabled");
               break;
               default:
                  sprintf(strChanStatusEnable, "Unknown ");
               break;
            }
            check_status(naibrd_LVDT_GetTwoWirePosition(cardIndex, module, channel, NAIBRD_LVDT_TWO_WIRE_B, &positionB));
            check_status(naibrd_LVDT_GetVaSignal(cardIndex, module, channel, NAI_LVDT_SIGNAL, &va));
            check_status(naibrd_LVDT_GetVbSignal(cardIndex, module, channel, NAI_LVDT_SIGNAL, &vb));
            check_status(naibrd_LVDT_GetVaVbSignal(cardIndex, module, channel, &vaVb));
            check_status(naibrd_LVDT_GetDeltaPosition(cardIndex, module, channel, &deltaPos));
            check_status(naibrd_LVDT_GetVelocity(cardIndex, module, channel, &velocity));
            check_status(naibrd_LVDT_GetTwoWireVelocity(cardIndex, module, channel, NAIBRD_LVDT_TWO_WIRE_B, &velocityB));
            printf("%-10s%10.4f %11.4f %11.4f %11.4f %11.4f %11.4f %11.4f %11.4f %11.4f  %11.4f  %11.4f",
                   strChanStatusEnable, position, positionB, frequency, va, vb, vaVb, sigvolt, refvolt, deltaPos, velocity, velocityB);
         }
         else
         {
            check_status(naibrd_LVDT_GetStatus(cardIndex, module, channel, NAI_LVDT_STATUS_BIT_LATCHED, &BitStatusLatched));
            check_status(naibrd_LVDT_GetStatus(cardIndex, module, channel, NAI_LVDT_STATUS_SIGNAL_LATCHED, &SigLossLatched));
            check_status(naibrd_LVDT_GetStatus(cardIndex, module, channel, NAI_LVDT_STATUS_REF_LATCHED, &RefLossLatched));
            printf("%10.4f%12.4f%12.4f%12.4f%5d%8d%8d", position, frequency, sigvolt, refvolt, BitStatusLatched, SigLossLatched, RefLossLatched);
         }
      }

      printf("\n");
   }

   if (gen5)
   {
      printf("\n\n================================================================================================================================================================ \n");
      printf("%7s%11s%13s%10s%10s%12s%14s%17s%14s%14s%14s\n", "Chan", "Bandwidth", "Bandwidth", "LVDT", "Track", "TR", "TR", "Invert Va", "Invert Vb", "Invert Ref", "Invert Va-Vb");
      printf("%7s%11s%11s%13s%11s%13s%14s%13s%14s%13s%13s\n", "", "", "Select", "Scale", "and Hold", "Value A", "Value B", "Control", "Control", "Control", "Control");
      printf("----------------------------------------------------------------------------------------------------------------------------------------------------------------\n");
      for (channel = 1; channel <= MAX_CHANNEL; channel++)
      {
         printf("%4d    ", channel);
         check_status(naibrd_LVDT_GetLatch(cardIndex, module, channel, &latchCtrl));
         check_status(naibrd_LVDT_GetSignalInversion(cardIndex, module, channel, NAIBRD_LVDT_SIGNAL_INV_VA, &invVaCtrl));
         switch (invVaCtrl)
         {
            case NAIBRD_LVDT_RESP_NON_INVERTED_VA:
               sprintf(strInvVaCtrl, "Non-Inverted");
            break;
            case NAIBRD_LVDT_RESP_INVERTED_VA:
               sprintf(strInvVaCtrl, "  Inverted  ");
            break;
            default:
               sprintf(strInvVaCtrl, "  Unknown   ");
            break;
         }
         check_status(naibrd_LVDT_GetSignalInversion(cardIndex, module, channel, NAIBRD_LVDT_SIGNAL_INV_VB, &invVbCtrl));
         switch (invVbCtrl)
         {
            case NAIBRD_LVDT_RESP_NON_INVERTED_VB:
               sprintf(strInvVbCtrl, "Non-Inverted");
            break;
            case NAIBRD_LVDT_RESP_INVERTED_VB:
               sprintf(strInvVbCtrl, "  Inverted  ");
            break;
            default:
               sprintf(strInvVbCtrl, "  Unknown   ");
            break;
         }
         check_status(naibrd_LVDT_GetSignalInversion(cardIndex, module, channel, NAIBRD_LVDT_SIGNAL_INV_REF, &invRefCtrl));
         switch (invRefCtrl)
         {
            case NAIBRD_LVDT_RESP_NON_INVERTED_REF:
               sprintf(strInvRefCtrl, "Non-Inverted");
            break;
            case NAIBRD_LVDT_RESP_INVERTED_REF:
               sprintf(strInvRefCtrl, "  Inverted  ");
            break;
            default:
               sprintf(strInvRefCtrl, "  Unknown   ");
            break;
         }
         check_status(naibrd_LVDT_GetSignalInversion(cardIndex, module, channel, NAIBRD_LVDT_SIGNAL_INV_DIFF, &invVaVbCtrl));
         switch (invVaVbCtrl)
         {
            case NAIBRD_LVDT_RESP_DIFF_VA_VB:
               sprintf(strInvVaVbCtrl, "Non-Inverted ((Va - Vb) / (Va + Vb))");
            break;
            case NAIBRD_LVDT_RESP_DIFF_VB_VA:
               sprintf(strInvVaVbCtrl, "Inverted ((Vb - Va) / (Va + Vb))    ");
            break;
            default:
               sprintf(strInvVaVbCtrl, "  Unknown                           ");
            break;
         }
         check_status(naibrd_LVDT_GetTRValue(cardIndex, module, channel, NAIBRD_LVDT_TWO_WIRE_A, &trA));
         check_status(naibrd_LVDT_GetTRValue(cardIndex, module, channel, NAIBRD_LVDT_TWO_WIRE_B, &trB));
         check_status(naibrd_LVDT_GetBandwidthSelect(cardIndex, module, channel, &bwSelect));
         switch (bwSelect)
         {
            case NAI_LVDT_BW_MANUAL:
               sprintf(strBwSelect, " Manual  ");
            break;
            case NAI_LVDT_BW_AUTOMATIC:
               sprintf(strBwSelect, "Automatic");
            break;
            default:
               sprintf(strBwSelect, " Unknown ");
            break;
         }
         check_status(naibrd_LVDT_GetLVDTScale(cardIndex, module, channel, &lvdtScale));
         if (DisplayAsHex)
         {
            check_status(naibrd_LVDT_GetChannelRaw(cardIndex, module, channel, NAI_LVDT_CHAN_RAW_BANDWIDTH, &bandwidth));
            printf("0x%08X%13s 0x%08X%6s%1d%8s0x%08X    0x%08X   %12s  %12s %12s %-37s\n", bandwidth, strBwSelect, lvdtScale, "",
                   latchCtrl, "", trA, trB, strInvVaCtrl, strInvVbCtrl, strInvRefCtrl, strInvVaVbCtrl);
         }
         else
         {
            check_status(naibrd_LVDT_GetBandwidth(cardIndex, module, channel, &bandwidth));
            printf("%10u%13s %10u%6s%1u%7s%10u    %10u    %12s  %12s %12s %-37s\n", bandwidth, strBwSelect, lvdtScale, "", latchCtrl,
                   "", trA, trB, strInvVaCtrl, strInvVbCtrl, strInvRefCtrl, strInvVaVbCtrl);
         }
      }

      printf("\n\n====================================== Status ====================================== \n");
      printf("%7s%5s%9s%8s%8s%8s%6s%8s%9s%16s\n", "Chan", "BIT", "Sig Lo", "Ref Lo", "Sig Hi", "Ref Hi", "Open", "Short", "Summary", "Delta Position");
      printf("%7s%6s%7s%8s%8s%8s%8s%7s%8s%12s\n", "", "(R/L)", "(R/L)", "(R/L)", "(R/L)", "(R/L)", "(R/L)", "(R/L)", "(R/L)", "(R/L)");
      printf("------------------------------------------------------------------------------------\n");
      for (channel = 1; channel <= MAX_CHANNEL; channel++)
      {
         printf("%4d    ", channel);
         check_status(naibrd_LVDT_GetStatus(cardIndex, module, channel, NAI_LVDT_STATUS_BIT_REALTIME, &BitStatusRealtime));
         check_status(naibrd_LVDT_GetStatus(cardIndex, module, channel, NAI_LVDT_STATUS_BIT_LATCHED, &BitStatusLatched));
         check_status(naibrd_LVDT_GetStatus(cardIndex, module, channel, NAI_LVDT_STATUS_SIGNAL_REALTIME, &SigLossRealtime));
         check_status(naibrd_LVDT_GetStatus(cardIndex, module, channel, NAI_LVDT_STATUS_SIGNAL_LATCHED, &SigLossLatched));
         check_status(naibrd_LVDT_GetStatus(cardIndex, module, channel, NAI_LVDT_STATUS_REF_REALTIME, &RefLossRealtime));
         check_status(naibrd_LVDT_GetStatus(cardIndex, module, channel, NAI_LVDT_STATUS_REF_LATCHED, &RefLossLatched));
         check_status(naibrd_LVDT_GetStatus(cardIndex, module, channel, NAI_LVDT_STATUS_SIGNAL_HIGH_REALTIME, &SigFaultHiRealtime));
         check_status(naibrd_LVDT_GetStatus(cardIndex, module, channel, NAI_LVDT_STATUS_SIGNAL_HIGH_LATCHED, &SigFaultHiLatched));
         check_status(naibrd_LVDT_GetStatus(cardIndex, module, channel, NAI_LVDT_STATUS_REF_HIGH_REALTIME, &RefFaultHiRealtime));
         check_status(naibrd_LVDT_GetStatus(cardIndex, module, channel, NAI_LVDT_STATUS_REF_HIGH_LATCHED, &RefFaultHiLatched));
         check_status(naibrd_LVDT_GetStatus(cardIndex, module, channel, NAI_LVDT_STATUS_OPEN_REALTIME, &OpenRealtime));
         check_status(naibrd_LVDT_GetStatus(cardIndex, module, channel, NAI_LVDT_STATUS_OPEN_LATCHED, &OpenLatched));
         check_status(naibrd_LVDT_GetStatus(cardIndex, module, channel, NAI_LVDT_STATUS_SHORT_REALTIME, &ShortRealtime));
         check_status(naibrd_LVDT_GetStatus(cardIndex, module, channel, NAI_LVDT_STATUS_SHORT_LATCHED, &ShortLatched));
         check_status(naibrd_LVDT_GetStatus(cardIndex, module, channel, NAI_LVDT_STATUS_SUMMARY_REALTIME, &SummaryRealtime));
         check_status(naibrd_LVDT_GetStatus(cardIndex, module, channel, NAI_LVDT_STATUS_SUMMARY_LATCHED, &SummaryLatched));
         check_status(naibrd_LVDT_GetStatus(cardIndex, module, channel, NAI_LVDT_STATUS_DELTA_POS_REALTIME, &DeltaPosRealtime));
         check_status(naibrd_LVDT_GetStatus(cardIndex, module, channel, NAI_LVDT_STATUS_DELTA_POS_LATCHED, &DeltaPosLatched));
         printf("(%1d/%1d)  (%1d/%1d)   (%1d/%1d)   (%1d/%1d)   (%1d/%1d)   (%1d/%1d)  (%1d/%1d)   (%1d/%1d)       (%1d/%1d)\n",
                BitStatusRealtime, BitStatusLatched, SigLossRealtime, SigLossLatched, RefLossRealtime, RefLossLatched, SigFaultHiRealtime,
                SigFaultHiLatched, RefFaultHiRealtime, RefFaultHiLatched, OpenRealtime, OpenLatched, ShortRealtime, ShortLatched,
                SummaryRealtime, SummaryLatched, DeltaPosRealtime, DeltaPosLatched);
      }
   }

}
/*****************************************************************************/
/**
<summary>
LVDTBasicMenu_displayMode prints mode value.
</summary>
*/
/*****************************************************************************/
static void LVDTBasicMenu_displayMode(nai_lvdt_format_t mode)
{
   if (mode == NAI_LVDT_4WIRE)
      printf("4-wire(%d)   ", mode);
   else if (mode == NAI_LVDT_2WIRE)
      printf("2-wire(%d)   ", mode);
   else
      printf("UNKNOWN(%d)  ", mode);
}
/*****************************************************************************/
/**
<summary>
LVDTBasicMenu_displayStatus prints to stdin the BIT status, Signal Loss and
Reference Loss Status.
</summary>
*/
/*****************************************************************************/
/*Future use*/
/*
static void LVDTBasicMenu_displayStatus(nai_status_bit_t BitStatus,  nai_status_bit_t SigLoss, nai_status_bit_t RefLoss)
{
   if (BitStatus == NAI_STATUS_BIT_HI)
      printf("   1  ");
   else if (BitStatus == NAI_STATUS_BIT_LO)
      printf("     0     ");
   else
      printf("   Error   ");
   if (SigLoss == NAI_STATUS_BIT_HI)
      printf("     1  ");
   else if (SigLoss == NAI_STATUS_BIT_LO)
      printf("     0    ");
   else
      printf("   Error     ");
   if (RefLoss == NAI_STATUS_BIT_HI)
      printf("  1\n");
   else if (RefLoss == NAI_STATUS_BIT_LO)
      printf("       0\n");
   else
      printf("  Error\n");
}
*/

static nai_status_t LVDTBasicMenu_SetMode(int32_t paramCount, int32_t* p_params)
{
   bool_t bQuit = FALSE;
   nai_lvdt_format_t mode;
   p_naiapp_AppParameters_t LVDT_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = LVDT_params->cardIndex;
   int32_t module = LVDT_params->module;
   int32_t channel = LVDT_params->channel;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   printf("Select LVDT Mode to set: [2 (2-wire) or 4 (4-wire)]: ");
   bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   if ((!bQuit) && (inputResponseCnt > 0))
   {
      if ((inputBuffer[0] == '2') || (inputBuffer[0] == '4'))
      {
         if (inputBuffer[0] == '2')
            mode = NAI_LVDT_2WIRE;
         else
            mode = NAI_LVDT_4WIRE;
         check_status(naibrd_LVDT_SetChanMode(cardIndex, module, channel, mode));
      }
      else
         printf("\nInvalid LVDT Mode Entered\n");
   }
   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static nai_status_t LVDTBasicMenu_SetChanStatusEnable(int32_t paramCount, int32_t* p_params)
{
   bool_t bQuit = FALSE;
   uint32_t enable = 0u;
   p_naiapp_AppParameters_t LVDT_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = LVDT_params->cardIndex;
   int32_t module = LVDT_params->module;
   int32_t channel = LVDT_params->channel;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   printf("Select Channel Status Enabled/Disabled Setting to set: [0 (Disabled) or 1 (Enabled)]: ");
   bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   if ((!bQuit) && (inputResponseCnt > 0))
   {
      if ((inputBuffer[0] == '0') || (inputBuffer[0] == '1'))
      {
         if (inputBuffer[0] == '1')
         {
            enable = 1u;
         }
         check_status(naibrd_LVDT_SetChanStatusEnable(cardIndex, module, channel, enable));
      }
      else
      {
         printf("\nInvalid Setting Entered\n");
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static nai_status_t LVDTBasicMenu_ClearStatus(int32_t paramCount, int32_t* p_params)
{
   bool_t bQuit = FALSE;
   nai_lvdt_status_type_t statusTypeToClear = 0u;
   char statusTypeStr[18] = "";
   p_naiapp_AppParameters_t LVDT_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = LVDT_params->cardIndex;
   int32_t module = LVDT_params->module;
   int32_t channel = LVDT_params->channel;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   printf("Select Latched Status Type to clear: (0 for BIT, 1 for Signal Fault Low, 2 for Ref Fault Low, 3 for Signal Fault High, 4 for Ref Fault High, 5 for Open, 6 for Short, 7 for Summary, 8 for Delta Position, q for quit): ");
   bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   if ((!bQuit) && (inputResponseCnt > 0))
   {
      switch (inputBuffer[0])
      {
         case '0':
            statusTypeToClear = NAI_LVDT_STATUS_BIT_LATCHED;
            sprintf(statusTypeStr, "BIT");
         break;
         case '1':
            statusTypeToClear = NAI_LVDT_STATUS_SIGNAL_LOW_LATCHED;
            sprintf(statusTypeStr, "Signal Fault Low");
         break;
         case '2':
            statusTypeToClear = NAI_LVDT_STATUS_REF_LOW_LATCHED;
            sprintf(statusTypeStr, "Ref Fault Low");
         break;
         case '3':
            statusTypeToClear = NAI_LVDT_STATUS_SIGNAL_HIGH_LATCHED;
            sprintf(statusTypeStr, "Signal Fault High");
         break;
         case '4':
            statusTypeToClear = NAI_LVDT_STATUS_REF_HIGH_LATCHED;
            sprintf(statusTypeStr, "Ref Fault High");
         break;
         case '5':
            statusTypeToClear = NAI_LVDT_STATUS_OPEN_LATCHED;
            sprintf(statusTypeStr, "Open");
         break;
         case '6':
            statusTypeToClear = NAI_LVDT_STATUS_SHORT_LATCHED;
            sprintf(statusTypeStr, "Short");
         break;
         case '7':
            statusTypeToClear = NAI_LVDT_STATUS_SUMMARY_LATCHED;
            sprintf(statusTypeStr, "Summary");
         break;
         case '8':
            statusTypeToClear = NAI_LVDT_STATUS_DELTA_POS_LATCHED;
            sprintf(statusTypeStr, "Delta Position");
         break;
         case 'q':
         case 'Q':
            bQuit = TRUE;
         break;
         default:
            bQuit = TRUE;
            printf("\nInvalid status type entered\n");
         break;
      }

      if (!bQuit)
      {
         printf("\nAre you sure you want to clear the %s status? (Y for Yes or N for No): ", statusTypeStr);
         bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
         if ((!bQuit) && (inputResponseCnt > 0) && (toupper(inputBuffer[0]) == 'Y'))
         {
            check_status(naibrd_LVDT_ClearStatus(cardIndex, module, channel, statusTypeToClear));
         }
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static nai_status_t LVDTBasicMenu_SetDeltaPosition(int32_t paramCount, int32_t* p_params)
{
   bool_t bQuit = FALSE;
   float64_t deltaPos = 0.0;
   uint32_t deltaPosRaw = 0u;
   p_naiapp_AppParameters_t LVDT_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = LVDT_params->cardIndex;
   int32_t module = LVDT_params->module;
   int32_t channel = LVDT_params->channel;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   if (DisplayAsHex)
   {
      printf("Type Raw Hex Delta Position Value to set: 0x");
      bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
      if ((!bQuit) && (inputResponseCnt > 0))
      {
         deltaPosRaw = (uint32_t)strtoul((const char*)inputBuffer, NULL, 16);
         if (deltaPosRaw == 0u)
         {
            if (inputBuffer[0] == '0')
            {
               check_status(naibrd_LVDT_SetChannelRaw(cardIndex, module, channel, NAI_LVDT_CHAN_RAW_DELTA_POSITION, deltaPosRaw));
            }
            else
            {
               printf("\nInvalid value entered\n");
            }
         }
         else
         {
            check_status(naibrd_LVDT_SetChannelRaw(cardIndex, module, channel, NAI_LVDT_CHAN_RAW_DELTA_POSITION, deltaPosRaw));
         }
      }
   }
   else
   {
      printf("Type Delta Position Value to set: ");
      bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
      if ((!bQuit) && (inputResponseCnt > 0))
      {
         deltaPos = atof((const char*)inputBuffer);
         if (deltaPos == 0.0)
         {
            if (inputBuffer[0] == '0')
            {
               check_status(naibrd_LVDT_SetDeltaPosition(cardIndex, module, channel, deltaPos));
            }
            else
            {
               printf("\nInvalid Delta Position value entered\n");
            }
         }
         else
         {
            check_status(naibrd_LVDT_SetDeltaPosition(cardIndex, module, channel, deltaPos));
         }
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static nai_status_t LVDTBasicMenu_InitDeltaPosition(int32_t paramCount, int32_t* p_params)
{
   bool_t bQuit = FALSE;
   nai_status_t status = NAI_ERROR_UNKNOWN;
   p_naiapp_AppParameters_t LVDT_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = LVDT_params->cardIndex;
   int32_t module = LVDT_params->module;
   int32_t channel = LVDT_params->channel;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   printf("Do you want to enable or disable Delta Position Status reporting for channel %d? (1 for Enable, 0 for Disable): ", channel);
   bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   if ((!bQuit) && (inputResponseCnt > 0))
   {
      if (inputBuffer[0] == '0')
      {
         status = check_status(naibrd_LVDT_SetInitDeltaPosition(cardIndex, module, channel, (bool_t)0x0u));
         if (status == NAI_SUCCESS)
         {
            printf("\nDelta Position Status reporting has been disabled for channel %d.\n", channel);
         }
      }
      else if (inputBuffer[0] == '1')
      {
         status = check_status(naibrd_LVDT_SetInitDeltaPosition(cardIndex, module, channel, (bool_t)0x1u));
         if (status == NAI_SUCCESS)
         {
            printf("\nDelta Position Status reporting has been enabled for channel %d.\n", channel);
         }
      }
      else
      {
         printf("\nInvalid selection entered\n");
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static nai_status_t LVDTBasicMenu_SetBandwidth(int32_t paramCount, int32_t* p_params)
{
   bool_t bQuit = FALSE;
   uint32_t bandwidth = 0u;
   p_naiapp_AppParameters_t LVDT_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = LVDT_params->cardIndex;
   int32_t module = LVDT_params->module;
   int32_t channel = LVDT_params->channel;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   if (DisplayAsHex)
   {
      printf("Type Raw Hex Bandwidth Value to set: 0x");
      bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
      if ((!bQuit) && (inputResponseCnt > 0))
      {
         bandwidth = (uint32_t)strtoul((const char*)inputBuffer, NULL, 16);
         if (bandwidth == 0u)
         {
            if (inputBuffer[0] == '0')
            {
               check_status(naibrd_LVDT_SetChannelRaw(cardIndex, module, channel, NAI_LVDT_CHAN_RAW_BANDWIDTH, bandwidth));
            }
            else
            {
               printf("\nInvalid value entered\n");
            }
         }
         else
         {
            check_status(naibrd_LVDT_SetChannelRaw(cardIndex, module, channel, NAI_LVDT_CHAN_RAW_BANDWIDTH, bandwidth));
         }
      }
   }
   else
   {
      printf("Type Bandwidth Value to set: ");
      bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
      if ((!bQuit) && (inputResponseCnt > 0))
      {
         bandwidth = (uint32_t)strtoul((const char*)inputBuffer, NULL, 10);
         if (bandwidth == 0u)
         {
            if (inputBuffer[0] == '0')
            {
               check_status(naibrd_LVDT_SetBandwidth(cardIndex, module, channel, bandwidth));
            }
            else
            {
               printf("\nInvalid value entered\n");
            }
         }
         else
         {
            check_status(naibrd_LVDT_SetBandwidth(cardIndex, module, channel, bandwidth));
         }
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static nai_status_t LVDTBasicMenu_SetBandwidthSelect(int32_t paramCount, int32_t* p_params)
{
   bool_t bQuit = FALSE;
   p_naiapp_AppParameters_t LVDT_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = LVDT_params->cardIndex;
   int32_t module = LVDT_params->module;
   int32_t channel = LVDT_params->channel;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   printf("Type Bandwidth Select mode setting to set (0 for Manual, 1 for Automatic): ");
   bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   if ((!bQuit) && (inputResponseCnt > 0))
   {
      if (inputBuffer[0] == '0')
      {
         check_status(naibrd_LVDT_SetBandwidthSelect(cardIndex, module, channel, NAI_LVDT_BW_MANUAL));
      }
      else if (inputBuffer[0] == '1')
      {
         check_status(naibrd_LVDT_SetBandwidthSelect(cardIndex, module, channel, NAI_LVDT_BW_AUTOMATIC));
      }
      else
      {
         printf("\nInvalid selection entered\n");
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static nai_status_t LVDTBasicMenu_SetLVDTScale(int32_t paramCount, int32_t* p_params)
{
   bool_t bQuit = FALSE;
   uint32_t lvdtScale = 0u;
   p_naiapp_AppParameters_t LVDT_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = LVDT_params->cardIndex;
   int32_t module = LVDT_params->module;
   int32_t channel = LVDT_params->channel;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   if (DisplayAsHex)
   {
      printf("Type Raw Hex LVDT Scale Value to set: 0x");
      bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
      if ((!bQuit) && (inputResponseCnt > 0))
      {
         lvdtScale = (uint32_t)strtoul((const char*)inputBuffer, NULL, 16);
         if (lvdtScale == 0u)
         {
            if (inputBuffer[0] == '0')
            {
               check_status(naibrd_LVDT_SetLVDTScale(cardIndex, module, channel, lvdtScale));
            }
            else
            {
               printf("\nInvalid value entered\n");
            }
         }
         else
         {
            check_status(naibrd_LVDT_SetLVDTScale(cardIndex, module, channel, lvdtScale));
         }
      }
   }
   else
   {
      printf("Type LVDT Scale Value to set: ");
      bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
      if ((!bQuit) && (inputResponseCnt > 0))
      {
         lvdtScale = (uint32_t)strtoul((const char*)inputBuffer, NULL, 10);
         if (lvdtScale == 0u)
         {
            if (inputBuffer[0] == '0')
            {
               check_status(naibrd_LVDT_SetLVDTScale(cardIndex, module, channel, lvdtScale));
            }
            else
            {
               printf("\nInvalid value entered\n");
            }
         }
         else
         {
            check_status(naibrd_LVDT_SetLVDTScale(cardIndex, module, channel, lvdtScale));
         }
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static nai_status_t LVDTBasicMenu_SetLatch(int32_t paramCount, int32_t* p_params)
{
   bool_t bQuit = FALSE;
   nai_status_t status = NAI_ERROR_UNKNOWN;
   p_naiapp_AppParameters_t LVDT_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = LVDT_params->cardIndex;
   int32_t module = LVDT_params->module;
   int32_t channel = LVDT_params->channel;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   printf("Do you want to enable or disable the Position Data Track and Hold Latch for channel %d? (1 to enable, 0 to disable): ", channel);
   bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   if ((!bQuit) && (inputResponseCnt > 0))
   {
      switch (inputBuffer[0])
      {
         case '0':
            status = check_status(naibrd_LVDT_SetLatch(cardIndex, module, channel, 0x0u));
            if (status == NAI_SUCCESS)
            {
               printf("Track and Hold Latch for channel %d has been disabled.", channel);
            }
         break;
         case '1':
            status = check_status(naibrd_LVDT_SetLatch(cardIndex, module, channel, 0x1u));
            if (status == NAI_SUCCESS)
            {
               printf("Change the Position for channel %d and then read it once. It should retain the original value it had before you changed it.\n", channel);
               printf("Once the channel %d Position is read once, the Track and Hold Latch for channel %d will be reset to 0.\n", channel, channel);
               printf("Press enter when you are ready to continue. This will read the Position for all channels, which will reset\n");
               printf("the Track and Hold Latch for all channels.");
               naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
            }
         break;
         default:
            printf("\nInvalid selection entered\n");
         break;
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static nai_status_t LVDTBasicMenu_SetTRValue(int32_t paramCount, int32_t* p_params)
{
   bool_t bQuit = FALSE;
   uint32_t trValue = 0u;
   naibrd_lvdt_2_wire_t trValueTypeToSet = NAIBRD_LVDT_TWO_WIRE_A;
   char strTrValueTypeToSet[8] = "";
   p_naiapp_AppParameters_t LVDT_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = LVDT_params->cardIndex;
   int32_t module = LVDT_params->module;
   int32_t channel = LVDT_params->channel;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   printf("Type Transformation Ratio Value type to set (a for A-Side TR Value, b for B-Side TR Value, q for quit): ");
   bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   if ((!bQuit) && (inputResponseCnt > 0))
   {
      switch (inputBuffer[0])
      {
         case 'a':
         case 'A':
            trValueTypeToSet = NAIBRD_LVDT_TWO_WIRE_A;
            sprintf(strTrValueTypeToSet, "A-Side");
         break;
         case 'b':
         case 'B':
            trValueTypeToSet = NAIBRD_LVDT_TWO_WIRE_B;
            sprintf(strTrValueTypeToSet, "B-Side");
         break;
         default:
            bQuit = TRUE;
            printf("\nInvalid selection entered\n");
         break;
      }

      if (!bQuit)
      {
         if (DisplayAsHex)
         {
            printf("Type Raw Hex Transformation Ratio %s Value to set: 0x", strTrValueTypeToSet);
            bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
            if ((!bQuit) && (inputResponseCnt > 0))
            {
               trValue = (uint32_t)strtoul((const char*)inputBuffer, NULL, 16);
               if (trValue == 0u)
               {
                  if (inputBuffer[0] == '0')
                  {
                     check_status(naibrd_LVDT_SetTRValue(cardIndex, module, channel, trValueTypeToSet, trValue));
                  }
                  else
                  {
                     printf("\nInvalid value entered\n");
                  }
               }
               else
               {
                  check_status(naibrd_LVDT_SetTRValue(cardIndex, module, channel, trValueTypeToSet, trValue));
               }
            }
         }
         else
         {
            printf("Type Transformation Ratio %s Value to set: ", strTrValueTypeToSet);
            bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
            if ((!bQuit) && (inputResponseCnt > 0))
            {
               trValue = (uint32_t)strtoul((const char*)inputBuffer, NULL, 10);
               if (trValue == 0u)
               {
                  if (inputBuffer[0] == '0')
                  {
                     check_status(naibrd_LVDT_SetTRValue(cardIndex, module, channel, trValueTypeToSet, trValue));
                  }
                  else
                  {
                     printf("\nInvalid Transformation Ratio Value entered\n");
                  }
               }
               else
               {
                  check_status(naibrd_LVDT_SetTRValue(cardIndex, module, channel, trValueTypeToSet, trValue));
               }
            }
         }
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static nai_status_t LVDTBasicMenu_SetSignalInversion(int32_t paramCount, int32_t* p_params)
{
   bool_t bQuit = FALSE;
   naibrd_lvdt_signal_inversion_type_t sigType = NAIBRD_LVDT_SIGNAL_INV_VA;
   char strSigType[10] = "";
   p_naiapp_AppParameters_t LVDT_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = LVDT_params->cardIndex;
   int32_t module = LVDT_params->module;
   int32_t channel = LVDT_params->channel;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   printf("*Note: If the signal inversion control for Va-Vb is set to non-inverted, the algorithm used for position measurement is ");
   printf("(Va - Vb) / (Va + Vb), and if the signal inversion control for Va-Vb is set to inverted, the algorithm used for position ");
   printf("measurement is (Vb - Va) / (Va + Vb).\n");
   printf("Select Signal Type to set signal inversion control for (0 for Va, 1 for Vb, 2 for Reference, 3 for Va-Vb, q for quit): ");
   bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   if ((!bQuit) && (inputResponseCnt > 0))
   {
      switch (inputBuffer[0])
      {
         case '0':
            sigType = NAIBRD_LVDT_SIGNAL_INV_VA;
            sprintf(strSigType, "Va");
         break;
         case '1':
            sigType = NAIBRD_LVDT_SIGNAL_INV_VB;
            sprintf(strSigType, "Vb");
         break;
         case '2':
            sigType = NAIBRD_LVDT_SIGNAL_INV_REF;
            sprintf(strSigType, "Reference");
         break;
         case '3':
            sigType = NAIBRD_LVDT_SIGNAL_INV_DIFF;
            sprintf(strSigType, "Va-Vb");
         break;
         default:
            bQuit = TRUE;
            printf("\nInvalid signal type entered\n");
         break;
      }

      if (!bQuit)
      {
         printf("\nDo you want to set the signal inversion control for the %s signal to inverted or non-inverted? ", strSigType);
         printf("(1 for inverted, 0 for non-inverted): ");
         bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
         if ((!bQuit) && (inputResponseCnt > 0))
         {
            switch (inputBuffer[0])
            {
               case '0':
                  switch (sigType)
                  {
                     case NAIBRD_LVDT_SIGNAL_INV_VA:
                        check_status(naibrd_LVDT_SetSignalInversion(cardIndex, module, channel, sigType, NAIBRD_LVDT_RESP_NON_INVERTED_VA));
                     break;
                     case NAIBRD_LVDT_SIGNAL_INV_VB:
                        check_status(naibrd_LVDT_SetSignalInversion(cardIndex, module, channel, sigType, NAIBRD_LVDT_RESP_NON_INVERTED_VB));
                     break;
                     case NAIBRD_LVDT_SIGNAL_INV_REF:
                        check_status(naibrd_LVDT_SetSignalInversion(cardIndex, module, channel, sigType, NAIBRD_LVDT_RESP_NON_INVERTED_REF));
                     break;
                     case NAIBRD_LVDT_SIGNAL_INV_DIFF:
                        check_status(naibrd_LVDT_SetSignalInversion(cardIndex, module, channel, sigType, NAIBRD_LVDT_RESP_DIFF_VA_VB));
                     break;
                  }
               break;
               case '1':
                  switch (sigType)
                  {
                     case NAIBRD_LVDT_SIGNAL_INV_VA:
                        check_status(naibrd_LVDT_SetSignalInversion(cardIndex, module, channel, sigType, NAIBRD_LVDT_RESP_INVERTED_VA));
                     break;
                     case NAIBRD_LVDT_SIGNAL_INV_VB:
                        check_status(naibrd_LVDT_SetSignalInversion(cardIndex, module, channel, sigType, NAIBRD_LVDT_RESP_INVERTED_VB));
                     break;
                     case NAIBRD_LVDT_SIGNAL_INV_REF:
                        check_status(naibrd_LVDT_SetSignalInversion(cardIndex, module, channel, sigType, NAIBRD_LVDT_RESP_INVERTED_REF));
                     break;
                     case NAIBRD_LVDT_SIGNAL_INV_DIFF:
                        check_status(naibrd_LVDT_SetSignalInversion(cardIndex, module, channel, sigType, NAIBRD_LVDT_RESP_DIFF_VB_VA));
                     break;
                  }
               break;
               default:
                  bQuit = TRUE;
                  printf("\nInvalid selection entered\n");
               break;
            }
         }
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;;
}

static nai_status_t LVDTBasicMenu_ThresholdMenu(int32_t paramCount, int32_t* p_params)
{
   int32_t chan = 0;
   float64_t sigThreshold = 0.0, refThreshold = 0.0, sigHiThres = 0.0, refHiThres = 0.0, openThreshold = 0.0, shortThreshold = 0.0;
   bool_t bQuit = FALSE;
   bool_t bContinue = TRUE;
   int sigOrRef = 0;
   float64_t threshold = 0;
   p_naiapp_AppParameters_t LVDT_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = LVDT_params->cardIndex;
   int32_t module = LVDT_params->module;
   int32_t channel = LVDT_params->channel;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   while (bQuit == FALSE)
   {
      bContinue = TRUE;
      printf("\n\n==========================================================================================\n");
      printf("%7s%13s%13s%14s%14s%14s%15s\n", "Chan", "SigLoThresh", "RefLoThresh", "SigHiThresh", "RefHiThresh", "OpenThresh", "ShortThresh");
      for( chan = 1; chan <= 4; chan++)
      {
         check_status(naibrd_LVDT_GetSigLossThreshold(cardIndex, module, chan, &sigThreshold));
         check_status(naibrd_LVDT_GetRefLossThreshold(cardIndex, module, chan, &refThreshold));
         check_status(naibrd_LVDT_GetThreshold(cardIndex, module, chan, NAIBRD_LVDT_SIG_FAULT_HI_THRESHOLD, &sigHiThres));
         check_status(naibrd_LVDT_GetThreshold(cardIndex, module, chan, NAIBRD_LVDT_REF_FAULT_HI_THRESHOLD, &refHiThres));
         check_status(naibrd_LVDT_GetOpenThreshold(cardIndex, module, chan, &openThreshold));
         check_status(naibrd_LVDT_GetShortThreshold(cardIndex, module, chan, &shortThreshold));

         printf("%4d", chan);
         printf(" %15.4f %12.4f %13.4f %13.4f %13.4f %14.4f\n", sigThreshold, refThreshold, sigHiThres, refHiThres, openThreshold, shortThreshold);
      }

      printf("\nSelect threshold type to change for channel %d (0 for signal low, 1 for reference low, 2 for signal high, 3 for reference high, 4 for open, 5 for short, q for quit): ", channel);
      bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
      if((!bQuit) && (inputResponseCnt > 0))
      {
         if (inputBuffer[0] == '0')
         {
            sigOrRef = 0;
         }
         else if (inputBuffer[0] == '1')
         {
            sigOrRef = 1;
         }
         else if (inputBuffer[0] == '2')
         {
            sigOrRef = 2;
         }
         else if (inputBuffer[0] == '3')
         {
            sigOrRef = 3;
         }
         else if (inputBuffer[0] == '4')
         {
            sigOrRef = 4;
         }
         else if (inputBuffer[0] == '5')
         {
            sigOrRef = 5;
         }
         else
         {
            bContinue = FALSE;
         }

         if (bContinue)
         {
            printf("Enter a threshold: ");
            bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
            if ((!bQuit) && (inputResponseCnt > 0))
            {
               threshold = atof((const char*)inputBuffer);

               if (threshold > 0)
               {
                  if(sigOrRef == 0)
                     check_status(naibrd_LVDT_SetSigLossThreshold(cardIndex, module, channel, threshold));
                  else if (sigOrRef == 1)
                     check_status(naibrd_LVDT_SetRefLossThreshold(cardIndex, module, channel, threshold));
                  else if (sigOrRef == 2)
                     check_status(naibrd_LVDT_SetThreshold(cardIndex, module, channel, NAIBRD_LVDT_SIG_FAULT_HI_THRESHOLD, threshold));
                  else if (sigOrRef == 3)
                     check_status(naibrd_LVDT_SetThreshold(cardIndex, module, channel, NAIBRD_LVDT_REF_FAULT_HI_THRESHOLD, threshold));
                  else if (sigOrRef == 4)
                     check_status(naibrd_LVDT_SetOpenThreshold(cardIndex, module, channel, threshold));
                  else if (sigOrRef == 5)
                     check_status(naibrd_LVDT_SetShortThreshold(cardIndex, module, channel, threshold));
               }
               else if (threshold == 0)
               {
                  if (inputBuffer[0] == '0')
                  {
                     if(sigOrRef == 0)
                        check_status(naibrd_LVDT_SetSigLossThreshold(cardIndex, module, channel, threshold));
                     else if (sigOrRef == 1)
                        check_status(naibrd_LVDT_SetRefLossThreshold(cardIndex, module, channel, threshold));
                     else if (sigOrRef == 2)
                        check_status(naibrd_LVDT_SetThreshold(cardIndex, module, channel, NAIBRD_LVDT_SIG_FAULT_HI_THRESHOLD, threshold));
                     else if (sigOrRef == 3)
                        check_status(naibrd_LVDT_SetThreshold(cardIndex, module, channel, NAIBRD_LVDT_REF_FAULT_HI_THRESHOLD, threshold));
                     else if (sigOrRef == 4)
                        check_status(naibrd_LVDT_SetOpenThreshold(cardIndex, module, channel, threshold));
                     else if (sigOrRef == 5)
                        check_status(naibrd_LVDT_SetShortThreshold(cardIndex, module, channel, threshold));
                  }
                  else
                  {
                     printf("Invalid Threshold Entered\n");
                  }
               }
               else
               {
                  printf("Invalid Threshold Entered\n");
               }
            }
         }
      }
   }
   return NAI_SUCCESS;
}

static nai_status_t LVDTBasicMenu_FloatingPointMenu(int32_t paramCount, int32_t* p_params)
{
   bool_t floatModeEnabled = FALSE;
   int32_t chan = 0;
   int32_t maxChannel = 0;
   float64_t positionAOffset = 0.0, positionBOffset = 0.0, positionAScale = 0.0, positionBScale = 0.0;
   float64_t velocityAOffset = 0.0, velocityBOffset = 0.0, velocityAScale = 0.0, velocityBScale = 0.0;
   uint32_t attributeTypeToSet = 0u;
   bool_t bQuit = FALSE;
   bool_t bExit = FALSE;
   float64_t valueToSet = 0.0;
   char strFloatModeEnabled[10] = "";
   char strAttributeType[20] = "";
   p_naiapp_AppParameters_t LVDT_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = LVDT_params->cardIndex;
   int32_t module = LVDT_params->module;
   int32_t channel = LVDT_params->channel;
   uint32_t modId = LVDT_params->modId;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif
   maxChannel = naibrd_LVDT_GetChannelCount(modId);

   while (bQuit == FALSE)
   {
      printf("====================================================================================================\n");
      printf("%4s%12s%12s%12s%12s%12s%12s%12s%12s\n", "Chan", "Position A", "Position A", "Position B", "Position B", "Velocity A", "Velocity A", "Velocity B", "Velocity B");
      printf("%4s%9s%13s%11s%13s%11s%13s%11s%13s\n", "", "Scale", "Offset", "Scale", "Offset", "Scale", "Offset", "Scale", "Offset");
      printf("----------------------------------------------------------------------------------------------------\n");
      for (chan = 1; chan <= maxChannel; chan++)
      {
         check_status(naibrd_LVDT_GetFloatingPointPositionScale(cardIndex, module, chan, NAIBRD_LVDT_TWO_WIRE_A, &positionAScale));
         check_status(naibrd_LVDT_GetFloatingPointPositionOffset(cardIndex, module, chan, NAIBRD_LVDT_TWO_WIRE_A, &positionAOffset));
         check_status(naibrd_LVDT_GetFloatingPointPositionScale(cardIndex, module, chan, NAIBRD_LVDT_TWO_WIRE_B, &positionBScale));
         check_status(naibrd_LVDT_GetFloatingPointPositionOffset(cardIndex, module, chan, NAIBRD_LVDT_TWO_WIRE_B, &positionBOffset));
         check_status(naibrd_LVDT_GetFloatingPointVelocityScale(cardIndex, module, chan, NAIBRD_LVDT_TWO_WIRE_A, &velocityAScale));
         check_status(naibrd_LVDT_GetFloatingPointVelocityOffset(cardIndex, module, chan, NAIBRD_LVDT_TWO_WIRE_A, &velocityAOffset));
         check_status(naibrd_LVDT_GetFloatingPointVelocityScale(cardIndex, module, chan, NAIBRD_LVDT_TWO_WIRE_B, &velocityBScale));
         check_status(naibrd_LVDT_GetFloatingPointVelocityOffset(cardIndex, module, chan, NAIBRD_LVDT_TWO_WIRE_B, &velocityBOffset));

         printf("%2d", chan);
         printf("%14.4f%12.4f%12.4f%12.4f%12.4f%12.4f%12.4f%12.4f\n", positionAScale, positionAOffset, positionBScale, positionBOffset,
                velocityAScale, velocityAOffset, velocityBScale, velocityBOffset);
      }
      check_status(naibrd_GetFloatingPointModeEnable(cardIndex, module, &floatModeEnabled));
      switch (floatModeEnabled)
      {
         case FALSE:
            sprintf(strFloatModeEnabled, "DISABLED");
         break;
         case TRUE:
            sprintf(strFloatModeEnabled, "ENABLED ");
         break;
         default:
            sprintf(strFloatModeEnabled, "UNKNOWN ");
         break;
      }
      printf("Floating-Point Mode: %s\n\n", strFloatModeEnabled);
      printf("\nDo you want to enable/disable floating-point mode, set floating-point attributes, or refresh the display? (0 for mode, 1 for attributes, q for quit, anything else to refresh the display): ");
      bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
      if ((!bQuit) && (inputResponseCnt > 0) && ((inputBuffer[0] == '0') || (inputBuffer[0] == '1')))
      {
         if (inputBuffer[0] == '1')
         {
            printf("\nSet Floating-Point Attributes (0 for Position A Scale, 1 for Position A Offset, 2 for Position B Scale, 3 for Position B Offset, ");
            printf("4 for Velocity A Scale, 5 for Velocity A Offset, 6 for Velocity B Scale, 7 for Velocity B Offset, anything else to refresh the display): ");
            bExit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
            if ((!bExit) && (inputResponseCnt > 0))
            {
               switch (inputBuffer[0])
               {
                  case '0':
                     attributeTypeToSet = 0u;
                     sprintf(strAttributeType, "Position A Scale");
                  break;
                  case '1':
                     attributeTypeToSet = 1u;
                     sprintf(strAttributeType, "Position A Offset");
                  break;
                  case '2':
                     attributeTypeToSet = 2u;
                     sprintf(strAttributeType, "Position B Scale");
                  break;
                  case '3':
                     attributeTypeToSet = 3u;
                     sprintf(strAttributeType, "Position B Offset");
                  break;
                  case '4':
                     attributeTypeToSet = 4u;
                     sprintf(strAttributeType, "Velocity A Scale");
                  break;
                  case '5':
                     attributeTypeToSet = 5u;
                     sprintf(strAttributeType, "Velocity A Offset");
                  break;
                  case '6':
                     attributeTypeToSet = 6u;
                     sprintf(strAttributeType, "Velocity B Scale");
                  break;
                  case '7':
                     attributeTypeToSet = 7u;
                     sprintf(strAttributeType, "Velocity B Offset");
                  break;
                  default:
                     bExit = TRUE;
                  break;
               }

               if (!bExit)
               {
                  printf("\nEnter %s value to set: ", strAttributeType);
                  bExit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
                  if ((!bExit) && (inputResponseCnt > 0))
                  {
                     valueToSet = atof((const char*)inputBuffer);
                     if (valueToSet == 0.0)
                     {
                        if (inputBuffer[0] == '0')
                        {
                           switch (attributeTypeToSet)
                           {
                              case 0u:
                                 check_status(naibrd_LVDT_SetFloatingPointPositionScale(cardIndex, module, channel, NAIBRD_LVDT_TWO_WIRE_A, valueToSet));
                              break;
                              case 1u:
                                 check_status(naibrd_LVDT_SetFloatingPointPositionOffset(cardIndex, module, channel, NAIBRD_LVDT_TWO_WIRE_A, valueToSet));
                              break;
                              case 2u:
                                 check_status(naibrd_LVDT_SetFloatingPointPositionScale(cardIndex, module, channel, NAIBRD_LVDT_TWO_WIRE_B, valueToSet));
                              break;
                              case 3u:
                                 check_status(naibrd_LVDT_SetFloatingPointPositionOffset(cardIndex, module, channel, NAIBRD_LVDT_TWO_WIRE_B, valueToSet));
                              break;
                              case 4u:
                                 check_status(naibrd_LVDT_SetFloatingPointVelocityScale(cardIndex, module, channel, NAIBRD_LVDT_TWO_WIRE_A, valueToSet));
                              break;
                              case 5u:
                                 check_status(naibrd_LVDT_SetFloatingPointVelocityOffset(cardIndex, module, channel, NAIBRD_LVDT_TWO_WIRE_A, valueToSet));
                              break;
                              case 6u:
                                 check_status(naibrd_LVDT_SetFloatingPointVelocityScale(cardIndex, module, channel, NAIBRD_LVDT_TWO_WIRE_B, valueToSet));
                              break;
                              case 7u:
                                 check_status(naibrd_LVDT_SetFloatingPointVelocityOffset(cardIndex, module, channel, NAIBRD_LVDT_TWO_WIRE_B, valueToSet));
                              break;
                           }
                        }
                        else
                        {
                           printf("\nInvalid value entered\n");
                        }
                     }
                     else
                     {
                        switch (attributeTypeToSet)
                        {
                           case 0u:
                              check_status(naibrd_LVDT_SetFloatingPointPositionScale(cardIndex, module, channel, NAIBRD_LVDT_TWO_WIRE_A, valueToSet));
                           break;
                           case 1u:
                              check_status(naibrd_LVDT_SetFloatingPointPositionOffset(cardIndex, module, channel, NAIBRD_LVDT_TWO_WIRE_A, valueToSet));
                           break;
                           case 2u:
                              check_status(naibrd_LVDT_SetFloatingPointPositionScale(cardIndex, module, channel, NAIBRD_LVDT_TWO_WIRE_B, valueToSet));
                           break;
                           case 3u:
                              check_status(naibrd_LVDT_SetFloatingPointPositionOffset(cardIndex, module, channel, NAIBRD_LVDT_TWO_WIRE_B, valueToSet));
                           break;
                           case 4u:
                              check_status(naibrd_LVDT_SetFloatingPointVelocityScale(cardIndex, module, channel, NAIBRD_LVDT_TWO_WIRE_A, valueToSet));
                           break;
                           case 5u:
                              check_status(naibrd_LVDT_SetFloatingPointVelocityOffset(cardIndex, module, channel, NAIBRD_LVDT_TWO_WIRE_A, valueToSet));
                           break;
                           case 6u:
                              check_status(naibrd_LVDT_SetFloatingPointVelocityScale(cardIndex, module, channel, NAIBRD_LVDT_TWO_WIRE_B, valueToSet));
                           break;
                           case 7u:
                              check_status(naibrd_LVDT_SetFloatingPointVelocityOffset(cardIndex, module, channel, NAIBRD_LVDT_TWO_WIRE_B, valueToSet));
                           break;
                        }
                     }
                  }
               }
            }
         }
         else
         {
            printf("\nEnable or Disable floating-point mode? (0 to disable, 1 to enable, anything else to refresh the display): ");
            bExit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
            if ((!bExit) && (inputResponseCnt > 0))
            {
               switch (inputBuffer[0])
               {
                  case '0':
                     check_status(naibrd_SetFloatingPointModeEnable(cardIndex, module, FALSE));
                  break;
                  case '1':
                     check_status(naibrd_SetFloatingPointModeEnable(cardIndex, module, TRUE));
                  break;
               }
            }
         }
      }
   }

   return NAI_SUCCESS;
}

static nai_status_t LVDTBasicMenu_TestMenu(int32_t paramCount, int32_t* p_params)
{
   bool_t bQuit = FALSE;
   bool_t bCmdFound = FALSE;
   int32_t cmd = 0;
   float64_t testPosition = 0.0;
   uint32_t testPositionRaw = 0u;
   bool_t d0TestEnabled = FALSE;
   bool_t d3TestEnabled = FALSE;
   bool_t pBitComplete = 0u;
   uint32_t bitStatusRealtime = 0u;
   uint32_t bitStatusLatched = 0u;
   float64_t bitErrorLimit = 0.0;
   uint32_t bitErrorLimitRaw = 0u;
   int32_t channelCount = 0;
   char strD0TestEnabled[10] = "";
   char strD3TestEnabled[10] = "";
   char strPBITComplete[15] = "";
   p_naiapp_AppParameters_t LVDT_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = LVDT_params->cardIndex;
   int32_t module = LVDT_params->module;
   int32_t channel = LVDT_params->channel;
   uint32_t modId = LVDT_params->modId;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   channelCount = naibrd_LVDT_GetChannelCount(modId);
   naiapp_utils_LoadParamMenuCommands(LVDT_TESTMENU_CMD_COUNT, LVDT_TestMenuCmds);
   do
   {
      printf("\n\n =============================== \n");
      printf(" Chan    BIT Status   BIT Error\n");
      printf("           (R/L)        Limit\n");
      printf(" -------------------------------\n");
      for (channel = 1; channel <= channelCount; channel++)
      {
         check_status(naibrd_LVDT_GetStatus(cardIndex, module, channel, NAI_LVDT_STATUS_BIT_REALTIME, &bitStatusRealtime));
         check_status(naibrd_LVDT_GetStatus(cardIndex, module, channel, NAI_LVDT_STATUS_BIT_LATCHED, &bitStatusLatched));
         if (DisplayAsHex)
         {
            check_status(naibrd_LVDT_GetChannelRaw(cardIndex, module, channel, NAI_LVDT_CHAN_RAW_BIT_ERROR_LIMIT, &bitErrorLimitRaw));
            printf("  %2d       (%1d/%1d)     0x%08X\n", channel, bitStatusRealtime, bitStatusLatched, bitErrorLimitRaw);
         }
         else
         {
            check_status(naibrd_LVDT_GetBITErrorLimit(cardIndex, module, channel, &bitErrorLimit));
            printf("  %2d       (%1d/%1d)   %12.4f\n", channel, bitStatusRealtime, bitStatusLatched, bitErrorLimit);
         }
      }
      if (DisplayAsHex)
      {
         check_status(naibrd_LVDT_GetRaw(cardIndex, module, NAI_LVDT_RAW_TEST_POSITION, &testPositionRaw));
      }
      else
      {
         check_status(naibrd_LVDT_GetTestPosition(cardIndex, module, &testPosition));
      }
      check_status(naibrd_LVDT_GetModuleBITEnable(cardIndex, module, NAI_LVDT_TEST_ENABLE_D0, &d0TestEnabled));
      switch (d0TestEnabled)
      {
         case TRUE:
            sprintf(strD0TestEnabled, "ENABLED ");
         break;
         case FALSE:
            sprintf(strD0TestEnabled, "DISABLED");
         break;
         default:
            sprintf(strD0TestEnabled, "UNKNOWN ");
         break;
      }
      check_status(naibrd_LVDT_GetModuleBITEnable(cardIndex, module, NAI_LVDT_TEST_ENABLE_D3, &d3TestEnabled));
      switch (d3TestEnabled)
      {
         case TRUE:
            sprintf(strD3TestEnabled, "ENABLED ");
         break;
         case FALSE:
            sprintf(strD3TestEnabled, "DISABLED");
         break;
         default:
            sprintf(strD3TestEnabled, "UNKNOWN ");
         break;
      }
      check_status(naibrd_LVDT_CheckPowerOnBITComplete(cardIndex, module, &pBitComplete));
      switch (pBitComplete)
      {
         case TRUE:
            sprintf(strPBITComplete, "COMPLETED");
         break;
         case FALSE:
            sprintf(strPBITComplete, "NOT COMPLETED");
         break;
         default:
            sprintf(strPBITComplete, "UNKNOWN");
         break;
      }
      if (DisplayAsHex)
      {
         printf("\nTest Position Raw Hex Value: 0x%08X\n", testPositionRaw);
      }
      else
      {
         printf("\nTest Position: %-16.8f\n", testPosition);
      }
      printf("D0 Test (UBIT) Enabled/Disabled: %s\n", strD0TestEnabled);
      printf("D3 Test (IBIT) Enabled/Disabled: %s\n", strD3TestEnabled);
      printf("Power-On BIT Complete: %s\n", strPBITComplete);
      naiapp_display_ParamMenuCommands((int8_t*)"LVDT Test Menu");
      printf("\n Type command or %c to quit : ", NAI_QUIT_CHAR);
      bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
      if ((!bQuit) && (inputResponseCnt > 0))
      {
         bCmdFound = naiapp_utils_GetParamMenuCmdNum(inputResponseCnt, inputBuffer, &cmd);
         if (bCmdFound)
         {
            if (cmd == LVDT_TESTMENU_CMD_DISPLAY_CONVERTED)
            {
               DisplayAsHex = FALSE;
            }
            else if (cmd == LVDT_TESTMENU_CMD_DISPLAY_HEX)
            {
               DisplayAsHex = TRUE;
            }
            else if ((cmd == LVDT_TESTMENU_CMD_CLEAR_BIT_STATUS) || (cmd == LVDT_TESTMENU_CMD_SET_BIT_ERROR_LIMIT))
            {
               naiapp_query_ChannelNumber(channelCount, 1, &LVDT_params->channel);
               LVDT_TestMenuCmds[cmd].func(paramCount, p_params);
            }
            else
            {
               LVDT_TestMenuCmds[cmd].func(paramCount, p_params);
            }
         }
         else
         {
            printf(" Invalid command entered\n");
         }
      }
   } while (!bQuit);

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static nai_status_t LVDTBasicMenu_InterruptMenu(int32_t paramCount, int32_t* p_params)
{
   int32_t channelCount = 0;
   bool_t bCmdFound = FALSE;
   bool_t bQuit = FALSE;
   int32_t cmd = 0;
   p_naiapp_AppParameters_t LVDT_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = LVDT_params->cardIndex;
   int32_t module = LVDT_params->module;
   uint32_t modId = LVDT_params->modId;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   channelCount = naibrd_LVDT_GetChannelCount(modId);
   naiapp_utils_LoadParamMenuCommands(LVDT_INTERRUPTMENU_CMD_COUNT, LVDT_InterruptMenuCmds);
   do
   {
      LVDTBasicMenu_DisplayInterruptData(cardIndex, module, modId);
      naiapp_display_ParamMenuCommands((int8_t*)"LVDT Interrupt Menu");
      printf("\n Type command or %c to quit : ", NAI_QUIT_CHAR);
      bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
      if ((!bQuit) && (inputResponseCnt > 0))
      {
         bCmdFound = naiapp_utils_GetParamMenuCmdNum(inputResponseCnt, inputBuffer, &cmd);
         if (bCmdFound)
         {
            if ((cmd == LVDT_INTERRUPTMENU_CMD_SET_INTERRUPT_ENABLE) || (cmd == LVDT_INTERRUPTMENU_CMD_SET_EDGE_LEVEL_INTERRUPT))
            {
               naiapp_query_ChannelNumber(channelCount, 1, &LVDT_params->channel);
               LVDT_InterruptMenuCmds[cmd].func(paramCount, p_params);
            }
            else
            {
               LVDT_InterruptMenuCmds[cmd].func(paramCount, p_params);
            }
         }
         else
         {
            printf(" Invalid command entered\n");
         }
      }
   } while (!bQuit);

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static void LVDTBasicMenu_DisplayInterruptData(int32_t cardIndex, int32_t module, uint32_t modid)
{
   int32_t channelCount = 0;
   nai_lvdt_enable_t intEnable = 0u;
   nai_lvdt_interrupt_t edgeLevelInt = 0u;
   int32_t channel = 0;
   uint32_t intVector = 0u;
   naibrd_int_steering_t intSteering = 0;
   char strIntEnable[10] = "";
   char strEdgeLevelInt[8] = "";
   char strIntSteering[48] = "";

   channelCount = naibrd_LVDT_GetChannelCount(modid);
   printf("\n\n ====  ======== BIT ========  ==== Signal Low =====  ==== Signal High ====  ====== Ref Low ======  ===== Ref High ======\n");
   printf(" Chan  Interrupt  Edge/Level  Interrupt  Edge/Level  Interrupt  Edge/Level  Interrupt  Edge/Level  Interrupt  Edge/Level\n");
   printf("        Enable    Interrupt    Enable    Interrupt    Enable    Interrupt    Enable    Interrupt    Enable    Interrupt\n");
   printf(" ----  ---------------------  ---------------------  ---------------------  ---------------------  ---------------------\n");
   for (channel = 1; channel <= channelCount; channel++)
   {
      printf(" %2d    ", channel);

      check_status(naibrd_LVDT_GetInterruptEnable(cardIndex, module, channel, NAI_LVDT_STATUS_BIT_LATCHED, &intEnable));
      switch (intEnable)
      {
         case NAI_LVDT_STATE_DISABLED:
            sprintf(strIntEnable, "Disabled");
         break;
         case NAI_LVDT_STATE_ENABLED:
            sprintf(strIntEnable, "Enabled ");
         break;
         default:
            sprintf(strIntEnable, "Unknown ");
         break;
      }
      check_status(naibrd_LVDT_GetEdgeLevelInterrupt(cardIndex, module, channel, NAI_LVDT_STATUS_BIT_LATCHED, &edgeLevelInt));
      switch (edgeLevelInt)
      {
         case NAI_LVDT_EDGE_INTERRUPT:
            sprintf(strEdgeLevelInt, " Edge  ");
         break;
         case NAI_LVDT_LEVEL_INTERRUPT:
            sprintf(strEdgeLevelInt, " Level ");
         break;
         default:
            sprintf(strEdgeLevelInt, "Unknown");
         break;
      }
      printf("%8s   %7s     ", strIntEnable, strEdgeLevelInt);

      check_status(naibrd_LVDT_GetInterruptEnable(cardIndex, module, channel, NAI_LVDT_STATUS_SIGNAL_LOW_LATCHED, &intEnable));
      switch (intEnable)
      {
         case NAI_LVDT_STATE_DISABLED:
            sprintf(strIntEnable, "Disabled");
         break;
         case NAI_LVDT_STATE_ENABLED:
            sprintf(strIntEnable, "Enabled ");
         break;
         default:
            sprintf(strIntEnable, "Unknown ");
         break;
      }
      check_status(naibrd_LVDT_GetEdgeLevelInterrupt(cardIndex, module, channel, NAI_LVDT_STATUS_SIGNAL_LOW_LATCHED, &edgeLevelInt));
      switch (edgeLevelInt)
      {
         case NAI_LVDT_EDGE_INTERRUPT:
            sprintf(strEdgeLevelInt, " Edge  ");
         break;
         case NAI_LVDT_LEVEL_INTERRUPT:
            sprintf(strEdgeLevelInt, " Level ");
         break;
         default:
            sprintf(strEdgeLevelInt, "Unknown");
         break;
      }
      printf("%8s   %7s     ", strIntEnable, strEdgeLevelInt);

      check_status(naibrd_LVDT_GetInterruptEnable(cardIndex, module, channel, NAI_LVDT_STATUS_SIGNAL_HIGH_LATCHED, &intEnable));
      switch (intEnable)
      {
         case NAI_LVDT_STATE_DISABLED:
            sprintf(strIntEnable, "Disabled");
         break;
         case NAI_LVDT_STATE_ENABLED:
            sprintf(strIntEnable, "Enabled ");
         break;
         default:
            sprintf(strIntEnable, "Unknown ");
         break;
      }
      check_status(naibrd_LVDT_GetEdgeLevelInterrupt(cardIndex, module, channel, NAI_LVDT_STATUS_SIGNAL_HIGH_LATCHED, &edgeLevelInt));
      switch (edgeLevelInt)
      {
         case NAI_LVDT_EDGE_INTERRUPT:
            sprintf(strEdgeLevelInt, " Edge  ");
         break;
         case NAI_LVDT_LEVEL_INTERRUPT:
            sprintf(strEdgeLevelInt, " Level ");
         break;
         default:
            sprintf(strEdgeLevelInt, "Unknown");
         break;
      }
      printf("%8s   %7s     ", strIntEnable, strEdgeLevelInt);

      check_status(naibrd_LVDT_GetInterruptEnable(cardIndex, module, channel, NAI_LVDT_STATUS_REF_LOW_LATCHED, &intEnable));
      switch (intEnable)
      {
         case NAI_LVDT_STATE_DISABLED:
            sprintf(strIntEnable, "Disabled");
         break;
         case NAI_LVDT_STATE_ENABLED:
            sprintf(strIntEnable, "Enabled ");
         break;
         default:
            sprintf(strIntEnable, "Unknown ");
         break;
      }
      check_status(naibrd_LVDT_GetEdgeLevelInterrupt(cardIndex, module, channel, NAI_LVDT_STATUS_REF_LOW_LATCHED, &edgeLevelInt));
      switch (edgeLevelInt)
      {
         case NAI_LVDT_EDGE_INTERRUPT:
            sprintf(strEdgeLevelInt, " Edge  ");
         break;
         case NAI_LVDT_LEVEL_INTERRUPT:
            sprintf(strEdgeLevelInt, " Level ");
         break;
         default:
            sprintf(strEdgeLevelInt, "Unknown");
         break;
      }
      printf("%8s   %7s     ", strIntEnable, strEdgeLevelInt);

      check_status(naibrd_LVDT_GetInterruptEnable(cardIndex, module, channel, NAI_LVDT_STATUS_REF_HIGH_LATCHED, &intEnable));
      switch (intEnable)
      {
         case NAI_LVDT_STATE_DISABLED:
            sprintf(strIntEnable, "Disabled");
         break;
         case NAI_LVDT_STATE_ENABLED:
            sprintf(strIntEnable, "Enabled ");
         break;
         default:
            sprintf(strIntEnable, "Unknown ");
         break;
      }
      check_status(naibrd_LVDT_GetEdgeLevelInterrupt(cardIndex, module, channel, NAI_LVDT_STATUS_REF_HIGH_LATCHED, &edgeLevelInt));
      switch (edgeLevelInt)
      {
         case NAI_LVDT_EDGE_INTERRUPT:
            sprintf(strEdgeLevelInt, " Edge  ");
         break;
         case NAI_LVDT_LEVEL_INTERRUPT:
            sprintf(strEdgeLevelInt, " Level ");
         break;
         default:
            sprintf(strEdgeLevelInt, "Unknown");
         break;
      }
      printf("%8s   %7s\n", strIntEnable, strEdgeLevelInt);
   }

   check_status(naibrd_LVDT_GetInterruptVector(cardIndex, module, NAI_LVDT_STATUS_BIT_LATCHED, &intVector));
   printf("\nBIT Interrupt Vector:         0x%08X,   ", intVector);
   check_status(naibrd_LVDT_GetInterruptSteering(cardIndex, module, NAI_LVDT_STATUS_BIT_LATCHED, &intSteering));
   switch (intSteering)
   {
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_VME:
         sprintf(strIntSteering, "VME Bus");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_ON_BOARD_0:
         sprintf(strIntSteering, "On Board 0 (Custom Application on ARM)");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_ON_BOARD_1:
         sprintf(strIntSteering, "On Board 1 (NAI Ethernet Listener Application)");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_ON_BOARD_2:
         sprintf(strIntSteering, "On Board 2");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_PCIE_APP:
         sprintf(strIntSteering, "PCIe Bus");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_CPCI_APP:
         sprintf(strIntSteering, "CPCI Bus");
      break;
      default:
         sprintf(strIntSteering, "Unknown");
      break;
   }
   printf("BIT Interrupt Steering:         %s\n", strIntSteering);

   check_status(naibrd_LVDT_GetInterruptVector(cardIndex, module, NAI_LVDT_STATUS_SIGNAL_LOW_LATCHED, &intVector));
   printf("Signal Low Interrupt Vector:  0x%08X,   ", intVector);
   check_status(naibrd_LVDT_GetInterruptSteering(cardIndex, module, NAI_LVDT_STATUS_SIGNAL_LOW_LATCHED, &intSteering));
   switch (intSteering)
   {
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_VME:
         sprintf(strIntSteering, "VME Bus");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_ON_BOARD_0:
         sprintf(strIntSteering, "On Board 0 (Custom Application on ARM)");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_ON_BOARD_1:
         sprintf(strIntSteering, "On Board 1 (NAI Ethernet Listener Application)");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_ON_BOARD_2:
         sprintf(strIntSteering, "On Board 2");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_PCIE_APP:
         sprintf(strIntSteering, "PCIe Bus");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_CPCI_APP:
         sprintf(strIntSteering, "CPCI Bus");
      break;
      default:
         sprintf(strIntSteering, "Unknown");
      break;
   }
   printf("Signal Low Interrupt Steering:  %s\n", strIntSteering);

   check_status(naibrd_LVDT_GetInterruptVector(cardIndex, module, NAI_LVDT_STATUS_SIGNAL_HIGH_LATCHED, &intVector));
   printf("Signal High Interrupt Vector: 0x%08X,   ", intVector);
   check_status(naibrd_LVDT_GetInterruptSteering(cardIndex, module, NAI_LVDT_STATUS_SIGNAL_HIGH_LATCHED, &intSteering));
   switch (intSteering)
   {
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_VME:
         sprintf(strIntSteering, "VME Bus");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_ON_BOARD_0:
         sprintf(strIntSteering, "On Board 0 (Custom Application on ARM)");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_ON_BOARD_1:
         sprintf(strIntSteering, "On Board 1 (NAI Ethernet Listener Application)");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_ON_BOARD_2:
         sprintf(strIntSteering, "On Board 2");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_PCIE_APP:
         sprintf(strIntSteering, "PCIe Bus");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_CPCI_APP:
         sprintf(strIntSteering, "CPCI Bus");
      break;
      default:
         sprintf(strIntSteering, "Unknown");
      break;
   }
   printf("Signal High Interrupt Steering: %s\n", strIntSteering);

   check_status(naibrd_LVDT_GetInterruptVector(cardIndex, module, NAI_LVDT_STATUS_REF_LOW_LATCHED, &intVector));
   printf("Ref Low Interrupt Vector:     0x%08X,   ", intVector);
   check_status(naibrd_LVDT_GetInterruptSteering(cardIndex, module, NAI_LVDT_STATUS_REF_LOW_LATCHED, &intSteering));
   switch (intSteering)
   {
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_VME:
         sprintf(strIntSteering, "VME Bus");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_ON_BOARD_0:
         sprintf(strIntSteering, "On Board 0 (Custom Application on ARM)");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_ON_BOARD_1:
         sprintf(strIntSteering, "On Board 1 (NAI Ethernet Listener Application)");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_ON_BOARD_2:
         sprintf(strIntSteering, "On Board 2");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_PCIE_APP:
         sprintf(strIntSteering, "PCIe Bus");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_CPCI_APP:
         sprintf(strIntSteering, "CPCI Bus");
      break;
      default:
         sprintf(strIntSteering, "Unknown");
      break;
   }
   printf("Ref Low Interrupt Steering:     %s\n", strIntSteering);

   check_status(naibrd_LVDT_GetInterruptVector(cardIndex, module, NAI_LVDT_STATUS_REF_HIGH_LATCHED, &intVector));
   printf("Ref High Interrupt Vector:    0x%08X,   ", intVector);
   check_status(naibrd_LVDT_GetInterruptSteering(cardIndex, module, NAI_LVDT_STATUS_REF_HIGH_LATCHED, &intSteering));
   switch (intSteering)
   {
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_VME:
         sprintf(strIntSteering, "VME Bus");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_ON_BOARD_0:
         sprintf(strIntSteering, "On Board 0 (Custom Application on ARM)");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_ON_BOARD_1:
         sprintf(strIntSteering, "On Board 1 (NAI Ethernet Listener Application)");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_ON_BOARD_2:
         sprintf(strIntSteering, "On Board 2");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_PCIE_APP:
         sprintf(strIntSteering, "PCIe Bus");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_CPCI_APP:
         sprintf(strIntSteering, "CPCI Bus");
      break;
      default:
         sprintf(strIntSteering, "Unknown");
      break;
   }
   printf("Ref High Interrupt Steering:    %s\n", strIntSteering);

   printf("\n\n ====  ======= Open ========  ======= Short =======  == Delta Position ===  ====== Summary ======\n");
   printf(" Chan  Interrupt  Edge/Level  Interrupt  Edge/Level  Interrupt  Edge/Level  Interrupt  Edge/Level\n");
   printf("        Enable    Interrupt    Enable    Interrupt    Enable    Interrupt    Enable    Interrupt\n");
   printf(" ----  ---------------------  ---------------------  ---------------------  ---------------------\n");
   for (channel = 1; channel <= channelCount; channel++)
   {
      printf(" %2d    ", channel);

      check_status(naibrd_LVDT_GetInterruptEnable(cardIndex, module, channel, NAI_LVDT_STATUS_OPEN_LATCHED, &intEnable));
      switch (intEnable)
      {
         case NAI_LVDT_STATE_DISABLED:
            sprintf(strIntEnable, "Disabled");
         break;
         case NAI_LVDT_STATE_ENABLED:
            sprintf(strIntEnable, "Enabled ");
         break;
         default:
            sprintf(strIntEnable, "Unknown ");
         break;
      }
      check_status(naibrd_LVDT_GetEdgeLevelInterrupt(cardIndex, module, channel, NAI_LVDT_STATUS_OPEN_LATCHED, &edgeLevelInt));
      switch (edgeLevelInt)
      {
         case NAI_LVDT_EDGE_INTERRUPT:
            sprintf(strEdgeLevelInt, " Edge  ");
         break;
         case NAI_LVDT_LEVEL_INTERRUPT:
            sprintf(strEdgeLevelInt, " Level ");
         break;
         default:
            sprintf(strEdgeLevelInt, "Unknown");
         break;
      }
      printf("%8s   %7s     ", strIntEnable, strEdgeLevelInt);

      check_status(naibrd_LVDT_GetInterruptEnable(cardIndex, module, channel, NAI_LVDT_STATUS_SHORT_LATCHED, &intEnable));
      switch (intEnable)
      {
         case NAI_LVDT_STATE_DISABLED:
            sprintf(strIntEnable, "Disabled");
         break;
         case NAI_LVDT_STATE_ENABLED:
            sprintf(strIntEnable, "Enabled ");
         break;
         default:
            sprintf(strIntEnable, "Unknown ");
         break;
      }
      check_status(naibrd_LVDT_GetEdgeLevelInterrupt(cardIndex, module, channel, NAI_LVDT_STATUS_SHORT_LATCHED, &edgeLevelInt));
      switch (edgeLevelInt)
      {
         case NAI_LVDT_EDGE_INTERRUPT:
            sprintf(strEdgeLevelInt, " Edge  ");
         break;
         case NAI_LVDT_LEVEL_INTERRUPT:
            sprintf(strEdgeLevelInt, " Level ");
         break;
         default:
            sprintf(strEdgeLevelInt, "Unknown");
         break;
      }
      printf("%8s   %7s     ", strIntEnable, strEdgeLevelInt);

      check_status(naibrd_LVDT_GetInterruptEnable(cardIndex, module, channel, NAI_LVDT_STATUS_DELTA_POS_LATCHED, &intEnable));
      switch (intEnable)
      {
         case NAI_LVDT_STATE_DISABLED:
            sprintf(strIntEnable, "Disabled");
         break;
         case NAI_LVDT_STATE_ENABLED:
            sprintf(strIntEnable, "Enabled ");
         break;
         default:
            sprintf(strIntEnable, "Unknown ");
         break;
      }
      check_status(naibrd_LVDT_GetEdgeLevelInterrupt(cardIndex, module, channel, NAI_LVDT_STATUS_DELTA_POS_LATCHED, &edgeLevelInt));
      switch (edgeLevelInt)
      {
         case NAI_LVDT_EDGE_INTERRUPT:
            sprintf(strEdgeLevelInt, " Edge  ");
         break;
         case NAI_LVDT_LEVEL_INTERRUPT:
            sprintf(strEdgeLevelInt, " Level ");
         break;
         default:
            sprintf(strEdgeLevelInt, "Unknown");
         break;
      }
      printf("%8s   %7s     ", strIntEnable, strEdgeLevelInt);

      check_status(naibrd_LVDT_GetInterruptEnable(cardIndex, module, channel, NAI_LVDT_STATUS_SUMMARY_LATCHED, &intEnable));
      switch (intEnable)
      {
         case NAI_LVDT_STATE_DISABLED:
            sprintf(strIntEnable, "Disabled");
         break;
         case NAI_LVDT_STATE_ENABLED:
            sprintf(strIntEnable, "Enabled ");
         break;
         default:
            sprintf(strIntEnable, "Unknown ");
         break;
      }
      check_status(naibrd_LVDT_GetEdgeLevelInterrupt(cardIndex, module, channel, NAI_LVDT_STATUS_SUMMARY_LATCHED, &edgeLevelInt));
      switch (edgeLevelInt)
      {
         case NAI_LVDT_EDGE_INTERRUPT:
            sprintf(strEdgeLevelInt, " Edge  ");
         break;
         case NAI_LVDT_LEVEL_INTERRUPT:
            sprintf(strEdgeLevelInt, " Level ");
         break;
         default:
            sprintf(strEdgeLevelInt, "Unknown");
         break;
      }
      printf("%8s   %7s\n", strIntEnable, strEdgeLevelInt);
   }

   check_status(naibrd_LVDT_GetInterruptVector(cardIndex, module, NAI_LVDT_STATUS_OPEN_LATCHED, &intVector));
   printf("\nOpen Interrupt Vector:           0x%08X,   ", intVector);
   check_status(naibrd_LVDT_GetInterruptSteering(cardIndex, module, NAI_LVDT_STATUS_OPEN_LATCHED, &intSteering));
   switch (intSteering)
   {
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_VME:
         sprintf(strIntSteering, "VME Bus");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_ON_BOARD_0:
         sprintf(strIntSteering, "On Board 0 (Custom Application on ARM)");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_ON_BOARD_1:
         sprintf(strIntSteering, "On Board 1 (NAI Ethernet Listener Application)");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_ON_BOARD_2:
         sprintf(strIntSteering, "On Board 2");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_PCIE_APP:
         sprintf(strIntSteering, "PCIe Bus");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_CPCI_APP:
         sprintf(strIntSteering, "CPCI Bus");
      break;
      default:
         sprintf(strIntSteering, "Unknown");
      break;
   }
   printf("Open Interrupt Steering:           %s\n", strIntSteering);

   check_status(naibrd_LVDT_GetInterruptVector(cardIndex, module, NAI_LVDT_STATUS_SHORT_LATCHED, &intVector));
   printf("Short Interrupt Vector:          0x%08X,   ", intVector);
   check_status(naibrd_LVDT_GetInterruptSteering(cardIndex, module, NAI_LVDT_STATUS_SHORT_LATCHED, &intSteering));
   switch (intSteering)
   {
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_VME:
         sprintf(strIntSteering, "VME Bus");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_ON_BOARD_0:
         sprintf(strIntSteering, "On Board 0 (Custom Application on ARM)");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_ON_BOARD_1:
         sprintf(strIntSteering, "On Board 1 (NAI Ethernet Listener Application)");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_ON_BOARD_2:
         sprintf(strIntSteering, "On Board 2");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_PCIE_APP:
         sprintf(strIntSteering, "PCIe Bus");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_CPCI_APP:
         sprintf(strIntSteering, "CPCI Bus");
      break;
      default:
         sprintf(strIntSteering, "Unknown");
      break;
   }
   printf("Short Interrupt Steering:          %s\n", strIntSteering);

   check_status(naibrd_LVDT_GetInterruptVector(cardIndex, module, NAI_LVDT_STATUS_DELTA_POS_LATCHED, &intVector));
   printf("Delta Position Interrupt Vector: 0x%08X,   ", intVector);
   check_status(naibrd_LVDT_GetInterruptSteering(cardIndex, module, NAI_LVDT_STATUS_DELTA_POS_LATCHED, &intSteering));
   switch (intSteering)
   {
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_VME:
         sprintf(strIntSteering, "VME Bus");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_ON_BOARD_0:
         sprintf(strIntSteering, "On Board 0 (Custom Application on ARM)");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_ON_BOARD_1:
         sprintf(strIntSteering, "On Board 1 (NAI Ethernet Listener Application)");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_ON_BOARD_2:
         sprintf(strIntSteering, "On Board 2");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_PCIE_APP:
         sprintf(strIntSteering, "PCIe Bus");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_CPCI_APP:
         sprintf(strIntSteering, "CPCI Bus");
      break;
      default:
         sprintf(strIntSteering, "Unknown");
      break;
   }
   printf("Delta Position Interrupt Steering: %s\n", strIntSteering);

   check_status(naibrd_LVDT_GetInterruptVector(cardIndex, module, NAI_LVDT_STATUS_SUMMARY_LATCHED, &intVector));
   printf("Summary Interrupt Vector:        0x%08X,   ", intVector);
   check_status(naibrd_LVDT_GetInterruptSteering(cardIndex, module, NAI_LVDT_STATUS_SUMMARY_LATCHED, &intSteering));
   switch (intSteering)
   {
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_VME:
         sprintf(strIntSteering, "VME Bus");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_ON_BOARD_0:
         sprintf(strIntSteering, "On Board 0 (Custom Application on ARM)");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_ON_BOARD_1:
         sprintf(strIntSteering, "On Board 1 (NAI Ethernet Listener Application)");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_ON_BOARD_2:
         sprintf(strIntSteering, "On Board 2");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_PCIE_APP:
         sprintf(strIntSteering, "PCIe Bus");
      break;
      case (naibrd_int_steering_t)NAIBRD_INT_STEERING_CPCI_APP:
         sprintf(strIntSteering, "CPCI Bus");
      break;
      default:
         sprintf(strIntSteering, "Unknown");
      break;
   }
   printf("Summary Interrupt Steering:        %s\n", strIntSteering);
}

static nai_status_t LVDTBasicMenu_FIFOMenu(int32_t paramCount, int32_t* p_params)
{
   int32_t channelCount = 0;
   bool_t bQuit = FALSE;
   bool_t bCmdFound = FALSE;
   int32_t cmd = 0;
   p_naiapp_AppParameters_t LVDT_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = LVDT_params->cardIndex;
   int32_t module = LVDT_params->module;
   int32_t channel = LVDT_params->channel;
   uint32_t modId = LVDT_params->modId;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   channelCount = naibrd_LVDT_GetChannelCount(modId);
   do
   {
      naiapp_utils_LoadParamMenuCommands(LVDT_FIFOMENU_CMD_COUNT, LVDT_FIFOMenuCmds);
      LVDTBasicMenu_DisplayFIFOData(cardIndex, module, modId);
      naiapp_display_ParamMenuCommands((int8_t*)"LVDT FIFO Menu");
      printf("\n Type command or %c to quit : ", NAI_QUIT_CHAR);
      bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
      if ((!bQuit) && (inputResponseCnt > 0))
      {
         bCmdFound = naiapp_utils_GetParamMenuCmdNum(inputResponseCnt, inputBuffer, &cmd);
         if (bCmdFound)
         {
            if (cmd == LVDT_FIFOMENU_CMD_DISPLAY_CONVERTED)
            {
               DisplayAsHex = FALSE;
            }
            else if (cmd == LVDT_FIFOMENU_CMD_DISPLAY_HEX)
            {
               DisplayAsHex = TRUE;
            }
            else
            {
               if ((cmd != LVDT_FIFOMENU_CMD_SOFTWARE_TRIGGER) && (cmd != LVDT_FIFOMENU_CMD_FIFO_INTERRUPT_MENU))
               {
                  naiapp_query_ChannelNumber(channelCount, 1, &channel);
               }
               LVDT_FIFOMenuCmds[cmd].func(paramCount, p_params);
            }
         }
         else
         {
            printf(" Invalid command entered\n");
         }
      }
   } while (!bQuit);

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static void LVDTBasicMenu_DisplayFIFOData(int32_t cardIndex, int32_t module, uint32_t modid)
{
   int32_t channel = 0;
   int32_t channelCount = 0;
   uint32_t fifoCount = 0u;
   uint32_t fifoDataRaw = 0u;
   uint32_t almostEmptyThres = 0u;
   uint32_t lowThres = 0u;
   uint32_t highThres = 0u;
   uint32_t almostFullThres = 0u;
   uint32_t fifoSize = 0u;
   uint32_t sampleRateRaw = 0u;
   float64_t sampleRate = 0.0;
   uint32_t dataType = 0u;
   uint32_t delay = 0u;
   uint32_t trigMode = 0u;
   uint32_t fifoStatusRealtime = 0u, fifoStatusLatched = 0u;
   uint32_t emptyRealtime = 0u, almostEmptyRealtime = 0u, lowRealtime = 0u, highRealtime = 0u, almostFullRealtime = 0u, fullRealtime = 0u, doneRealtime = 0u;
   uint32_t emptyLatched = 0u, almostEmptyLatched = 0u, lowLatched = 0u, highLatched = 0u, almostFullLatched = 0u, fullLatched = 0u, doneLatched = 0u;

   channelCount = naibrd_LVDT_GetChannelCount(modid);
   printf("\n\n ====  ======================  ================== Thresholds ===================  ============================================================\n");
   printf(" Chan       Count        Data   AlmostEmpty         Low        High   AlmostFull        Size   SampleRate    DataType       Delay  TriggerMode\n");
   printf(" ----  ----------------------  -------------------------------------------------  ------------------------------------------------------------\n");
   for (channel = 1; channel <= channelCount; channel++)
   {
      check_status(naibrd_LVDT_GetFIFOValue(cardIndex, module, channel, &fifoDataRaw));
      check_status(naibrd_LVDT_GetFIFOCount(cardIndex, module, channel, &fifoCount));
      check_status(naibrd_LVDT_GetFIFOAlmostEmptyThreshold(cardIndex, module, channel, &almostEmptyThres));
      check_status(naibrd_LVDT_GetFIFOLoThreshold(cardIndex, module, channel, &lowThres));
      check_status(naibrd_LVDT_GetFIFOHiThreshold(cardIndex, module, channel, &highThres));
      check_status(naibrd_LVDT_GetFIFOAlmostFullThreshold(cardIndex, module, channel, &almostFullThres));
      check_status(naibrd_LVDT_GetFIFOSize(cardIndex, module, channel, &fifoSize));
      if (DisplayAsHex)
      {
         check_status(naibrd_LVDT_GetFIFOSampleRate(cardIndex, module, channel, &sampleRateRaw));
      }
      else
      {
         check_status(naibrd_LVDT_GetFIFOSampleRateValue(cardIndex, module, channel, &sampleRate));
      }
      check_status(naibrd_LVDT_GetFIFODataType(cardIndex, module, channel, &dataType));
      check_status(naibrd_LVDT_GetFIFODelay(cardIndex, module, channel, &delay));
      check_status(naibrd_LVDT_GetFIFOTrigMode(cardIndex, module, channel, &trigMode));
      if (DisplayAsHex)
      {
         printf(" %2d    0x%08X  0x%08X   0x%08X   0x%08X  0x%08X   0x%08X  0x%08X   0x%08X  0x%08X  0x%08X  0x%08X\n", channel, fifoCount,
                fifoDataRaw, almostEmptyThres, lowThres, highThres, almostFullThres, fifoSize, sampleRateRaw, dataType, delay, trigMode);
      }
      else
      {
         printf(" %2d    %10u  %10u  %10u    %10u  %10u  %10u   %10u  %11.2f  %10u  %10u  %10u\n", channel, fifoCount, fifoDataRaw,
                almostEmptyThres, lowThres, highThres, almostFullThres, fifoSize, sampleRate, dataType, delay, trigMode);
      }
   }
   printf("\n\n");
   printf(" ====  ========================== Statuses ===========================\n");
   printf(" Chan  Empty  AlmostEmpty   Low   High   AlmostFull  Full   SampleDone\n");
   printf("       (R/L)     (R/L)     (R/L)  (R/L)    (R/L)     (R/L)    (R/L)   \n");
   printf(" ----  ---------------------------------------------------------------\n");
   for (channel = 1; channel <= channelCount; channel++)
   {
      check_status(naibrd_LVDT_GetFIFORealtimeStatus(cardIndex, module, channel, &fifoStatusRealtime));
      check_status(naibrd_LVDT_GetFIFOLatchedStatus(cardIndex, module, channel, &fifoStatusLatched));
      /* Empty Status is Bit 0 */
      emptyRealtime = fifoStatusRealtime & 0x1u;
      emptyLatched = fifoStatusLatched & 0x1u;
      /* Almost Empty Status is Bit 1 */
      almostEmptyRealtime = (fifoStatusRealtime >> 1) & 0x1u;
      almostEmptyLatched = (fifoStatusLatched >> 1) & 0x1u;
      /* Low Watermark Status is Bit 2 */
      lowRealtime = (fifoStatusRealtime >> 2) & 0x1u;
      lowLatched = (fifoStatusLatched >> 2) & 0x1u;
      /* High Watermark Status is Bit 3 */
      highRealtime = (fifoStatusRealtime >> 3) & 0x1u;
      highLatched = (fifoStatusLatched >> 3) & 0x1u;
      /* Almost Full Status is Bit 4 */
      almostFullRealtime = (fifoStatusRealtime >> 4) & 0x1u;
      almostFullLatched = (fifoStatusLatched >> 4) & 0x1u;
      /* Full Status is Bit 5 */
      fullRealtime = (fifoStatusRealtime >> 5) & 0x1u;
      fullLatched = (fifoStatusLatched >> 5) & 0x1u;
      /* Sample Done Status is Bit 6 */
      doneRealtime = (fifoStatusRealtime >> 6) & 0x1u;
      doneLatched = (fifoStatusLatched >> 6) & 0x1u;
      printf(" %2d    (%1d/%1d)     (%1d/%1d)     (%1d/%1d)  (%1d/%1d)    (%1d/%1d)     (%1d/%1d)    (%1d/%1d)\n", channel, emptyRealtime,
             emptyLatched, almostEmptyRealtime, almostEmptyLatched, lowRealtime, lowLatched, highRealtime, highLatched, almostFullRealtime,
             almostFullLatched, fullRealtime, fullLatched, doneRealtime, doneLatched);
   }
}

static nai_status_t LVDTBasicMenu_AdvancedOptionsMenu(int32_t paramCount, int32_t* p_params)
{
   bool_t bQuit = FALSE;
   int32_t chan = 0;
   bool_t isHex = FALSE;

   float64_t detectVa = 0, detectVb = 0;

   uint32_t detectVaRaw = 0, detectVbRaw = 0;

   p_naiapp_AppParameters_t LVDT_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = LVDT_params->cardIndex;
   int32_t module = LVDT_params->module;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   do
   {
     printf("================================\n");
      printf("%7s%12s%12s\n", "Chan", "Va Detect", "Vb Detect");

     for (chan = 1; chan <= 4; chan++)
     {
        if (!isHex)
        {
           naibrd_LVDT_GetVaSignal(cardIndex, module, chan, NAI_LVDT_SIGNAL_DETECT, &detectVa);
           naibrd_LVDT_GetVbSignal(cardIndex, module, chan, NAI_LVDT_SIGNAL_DETECT, &detectVb);

           printf("%4d%15.4f%12.4f\n", chan, detectVa, detectVb);
        }
        else
        {
           naibrd_LVDT_GetChannelRaw(cardIndex, module, chan, NAI_LVDT_CHAN_RAW_DETECT_VA, &detectVaRaw);
           naibrd_LVDT_GetChannelRaw(cardIndex, module, chan, NAI_LVDT_CHAN_RAW_DETECT_VB, &detectVbRaw);

           printf("%4d        0x%08X  0x%08X\n", chan, detectVaRaw, detectVbRaw);
        }
     }

     printf("\nDisplay Advanced Values (1 for decimal, 2 for hex, q for quit)?: ");
     bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
      switch(inputBuffer[0])
      {
     case '1':
        isHex = FALSE;
        break;
     case '2':
        isHex = TRUE;
        break;
      case 'q':
         bQuit = TRUE;
         break;
      }
   } while (bQuit == FALSE);

   return TRUE;
}

static nai_status_t LVDTTestMenu_ClearBITStatus(int32_t paramCount, int32_t* p_params)
{
   bool_t bQuit = FALSE;
   p_naiapp_AppParameters_t LVDT_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = LVDT_params->cardIndex;
   int32_t module = LVDT_params->module;
   int32_t channel = LVDT_params->channel;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif
   printf("Are you sure you want to clear the Latched BIT status? (Y for Yes or N for No): ");
   bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   if ((!bQuit) && (inputResponseCnt > 0) && (toupper(inputBuffer[0]) == 'Y'))
   {
      check_status(naibrd_LVDT_ClearStatus(cardIndex, module, channel, NAI_LVDT_STATUS_BIT_LATCHED));
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static nai_status_t LVDTTestMenu_SetBITErrorLimit(int32_t paramCount, int32_t* p_params)
{
   bool_t bQuit = FALSE;
   float64_t bitErrorLimit = 0.0;
   uint32_t bitErrorLimitRaw = 0u;
   p_naiapp_AppParameters_t LVDT_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = LVDT_params->cardIndex;
   int32_t module = LVDT_params->module;
   int32_t channel = LVDT_params->channel;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif
   if (DisplayAsHex)
   {
      printf("Type BIT Error Limit Raw Hex value to set: 0x");
      bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
      if ((!bQuit) && (inputResponseCnt > 0))
      {
         bitErrorLimitRaw = (uint32_t)strtoul((const char*)inputBuffer, NULL, 16);
         if (bitErrorLimitRaw == 0u)
         {
            if (inputBuffer[0] == '0')
            {
               check_status(naibrd_LVDT_SetChannelRaw(cardIndex, module, channel, NAI_LVDT_CHAN_RAW_BIT_ERROR_LIMIT, bitErrorLimitRaw));
            }
            else
            {
               printf("\nInvalid value entered\n");
            }
         }
         else
         {
            check_status(naibrd_LVDT_SetChannelRaw(cardIndex, module, channel, NAI_LVDT_CHAN_RAW_BIT_ERROR_LIMIT, bitErrorLimitRaw));
         }
      }
   }
   else
   {
      printf("Type BIT Error Limit value to set: ");
      bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
      if ((!bQuit) && (inputResponseCnt > 0))
      {
         bitErrorLimit = atof((const char*)inputBuffer);
         if (bitErrorLimit == 0.0)
         {
            if (inputBuffer[0] == '0')
            {
               check_status(naibrd_LVDT_SetBITErrorLimit(cardIndex, module, channel, bitErrorLimit));
            }
            else
            {
               printf("\nInvalid BIT Error Limit entered\n");
            }
         }
         else
         {
            check_status(naibrd_LVDT_SetBITErrorLimit(cardIndex, module, channel, bitErrorLimit));
         }
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static nai_status_t LVDTTestMenu_SetTestPosition(int32_t paramCount, int32_t* p_params)
{
   bool_t bQuit = FALSE;
   float64_t testPosition = 0.0;
   uint32_t testPositionRaw = 0u;
   p_naiapp_AppParameters_t LVDT_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = LVDT_params->cardIndex;
   int32_t module = LVDT_params->module;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif
   if (DisplayAsHex)
   {
      printf("Type Test Position Raw Hex value to set: 0x");
      bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
      if ((!bQuit) && (inputResponseCnt > 0))
      {
         testPositionRaw = (uint32_t)strtoul((const char*)inputBuffer, NULL, 16);
         if (testPositionRaw == 0u)
         {
            if (inputBuffer[0] == '0')
            {
               check_status(naibrd_LVDT_SetRaw(cardIndex, module, NAI_LVDT_RAW_TEST_POSITION, testPositionRaw));
            }
            else
            {
               printf("\nInvalid value entered\n");
            }
         }
         else
         {
            check_status(naibrd_LVDT_SetRaw(cardIndex, module, NAI_LVDT_RAW_TEST_POSITION, testPositionRaw));
         }
      }
   }
   else
   {
      printf("Type Test Position value to set: ");
      bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
      if ((!bQuit) && (inputResponseCnt > 0))
      {
         testPosition = atof((const char*)inputBuffer);
         if (testPosition == 0.0)
         {
            if (inputBuffer[0] == '0')
            {
               check_status(naibrd_LVDT_SetTestPosition(cardIndex, module, testPosition));
            }
            else
            {
               printf("\nInvalid Test Position entered\n");
            }
         }
         else
         {
            check_status(naibrd_LVDT_SetTestPosition(cardIndex, module, testPosition));
         }
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static nai_status_t LVDTTestMenu_SetD0TestEnable(int32_t paramCount, int32_t* p_params)
{
   bool_t bQuit = FALSE;
   p_naiapp_AppParameters_t LVDT_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = LVDT_params->cardIndex;
   int32_t module = LVDT_params->module;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   printf("Enable or Disable D0 Test (0 for disable, 1 for enable): ");
   bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   if ((!bQuit) && (inputResponseCnt > 0))
   {
      switch (inputBuffer[0])
      {
         case '0':
            check_status(naibrd_LVDT_SetModuleBITEnable(cardIndex, module, NAI_LVDT_TEST_ENABLE_D0, (bool_t)FALSE));
         break;
         case '1':
            check_status(naibrd_LVDT_SetModuleBITEnable(cardIndex, module, NAI_LVDT_TEST_ENABLE_D0, (bool_t)TRUE));
         break;
         default:
            printf("\nInvalid selection entered\n");
         break;
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static nai_status_t LVDTTestMenu_SetD3TestEnable(int32_t paramCount, int32_t* p_params)
{
   bool_t bQuit = FALSE;
   p_naiapp_AppParameters_t LVDT_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = LVDT_params->cardIndex;
   int32_t module = LVDT_params->module;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   printf("Enable or Disable D3 Test (0 for disable, 1 for enable): ");
   bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   if ((!bQuit) && (inputResponseCnt > 0))
   {
      switch (inputBuffer[0])
      {
         case '0':
            check_status(naibrd_LVDT_SetModuleBITEnable(cardIndex, module, NAI_LVDT_TEST_ENABLE_D3, (bool_t)FALSE));
         break;
         case '1':
            check_status(naibrd_LVDT_SetModuleBITEnable(cardIndex, module, NAI_LVDT_TEST_ENABLE_D3, (bool_t)TRUE));
         break;
         default:
            printf("\nInvalid selection entered\n");
         break;
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static nai_status_t LVDTTestMenu_CheckPowerOnBIT(int32_t paramCount, int32_t* p_params)
{
   bool_t bQuit = FALSE;
   int32_t channelCount = 0;
   bool_t pBitComplete = FALSE;
   uint32_t bitStatus = 0u;
   char strBitStatus[12] = "";
   p_naiapp_AppParameters_t LVDT_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = LVDT_params->cardIndex;
   int32_t module = LVDT_params->module;
   int32_t channel = LVDT_params->channel;
   uint32_t modId = LVDT_params->modId;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   channelCount = naibrd_LVDT_GetChannelCount(modId);

   /* Check to see if PBIT ran for the module. */
   printf("Checking if the Power-On BIT test has run...\n");
   check_status(naibrd_LVDT_CheckPowerOnBITComplete(cardIndex, module, &pBitComplete));
   switch (pBitComplete)
   {
      case 0u:
         printf("\nPBIT Complete: NOT COMPLETED\n");
      break;
      case 1u:
         printf("\nPBIT Complete: COMPLETED\n");
      break;
      default:
         printf("\nPBIT Complete: UNKNOWN\n");
      break;
   }

   if (pBitComplete)
   {
      /* Read the BIT status */
      printf("Checking the result of the Power-on BIT test...\n");
      for (channel = 1; channel <= channelCount; channel++)
      {
         check_status(naibrd_LVDT_GetStatus(cardIndex, module, channel, NAI_LVDT_STATUS_BIT_LATCHED, &bitStatus));
         switch (bitStatus)
         {
            case 0:
               sprintf(strBitStatus, "BIT Passed");
            break;
            case 1:
               sprintf(strBitStatus, "BIT FAILED");
            break;
            default:
               sprintf(strBitStatus, "Unknown");
            break;
         }
         printf("Ch. %d: %s\n", channel, strBitStatus);
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static nai_status_t LVDTInterruptMenu_SetInterruptEnable(int32_t paramCount, int32_t* p_params)
{
   bool_t bQuit = FALSE;
   nai_lvdt_status_type_t statusType = 0u;
   char statusTypeStr[18] = "";
   p_naiapp_AppParameters_t LVDT_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = LVDT_params->cardIndex;
   int32_t module = LVDT_params->module;
   int32_t channel = LVDT_params->channel;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   printf("Select Status Type to enable/disable interrupts for: (0 for BIT, 1 for Signal Fault Low, 2 for Ref Fault Low, ");
   printf("3 for Signal Fault High, 4 for Ref Fault High, 5 for Open, 6 for Short, 7 for Summary, 8 for Delta Position, q for quit): ");
   bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   if ((!bQuit) && (inputResponseCnt > 0))
   {
      switch (inputBuffer[0])
      {
         case '0':
            statusType = NAI_LVDT_STATUS_BIT_LATCHED;
            sprintf(statusTypeStr, "BIT");
         break;
         case '1':
            statusType = NAI_LVDT_STATUS_SIGNAL_LOW_LATCHED;
            sprintf(statusTypeStr, "Signal Fault Low");
         break;
         case '2':
            statusType = NAI_LVDT_STATUS_REF_LOW_LATCHED;
            sprintf(statusTypeStr, "Ref Fault Low");
         break;
         case '3':
            statusType = NAI_LVDT_STATUS_SIGNAL_HIGH_LATCHED;
            sprintf(statusTypeStr, "Signal Fault High");
         break;
         case '4':
            statusType = NAI_LVDT_STATUS_REF_HIGH_LATCHED;
            sprintf(statusTypeStr, "Ref Fault High");
         break;
         case '5':
            statusType = NAI_LVDT_STATUS_OPEN_LATCHED;
            sprintf(statusTypeStr, "Open");
         break;
         case '6':
            statusType = NAI_LVDT_STATUS_SHORT_LATCHED;
            sprintf(statusTypeStr, "Short");
         break;
         case '7':
            statusType = NAI_LVDT_STATUS_SUMMARY_LATCHED;
            sprintf(statusTypeStr, "Summary");
         break;
         case '8':
            statusType = NAI_LVDT_STATUS_DELTA_POS_LATCHED;
            sprintf(statusTypeStr, "Delta Position");
         break;
         case 'q':
         case 'Q':
            bQuit = TRUE;
         break;
         default:
            bQuit = TRUE;
            printf("\nInvalid status type entered\n");
         break;
      }

      if (!bQuit)
      {
         printf("\nDo you want to enable or disable interrupts for the %s status? (1 to enable, 0 to disable): ", statusTypeStr);
         bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
         if ((!bQuit) && (inputResponseCnt > 0))
         {
            switch (inputBuffer[0])
            {
               case '0':
                  check_status(naibrd_LVDT_SetInterruptEnable(cardIndex, module, channel, statusType, NAI_LVDT_STATE_DISABLED));
               break;
               case '1':
                  check_status(naibrd_LVDT_SetInterruptEnable(cardIndex, module, channel, statusType, NAI_LVDT_STATE_ENABLED));
               break;
               default:
                  bQuit = TRUE;
                  printf("\nInvalid selection entered\n");
               break;
            }
         }
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static nai_status_t LVDTInterruptMenu_SetEdgeLevelInterrupt(int32_t paramCount, int32_t* p_params)
{
   bool_t bQuit = FALSE;
   nai_lvdt_status_type_t statusType = 0u;
   char statusTypeStr[18] = "";
   p_naiapp_AppParameters_t LVDT_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = LVDT_params->cardIndex;
   int32_t module = LVDT_params->module;
   int32_t channel = LVDT_params->channel;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   printf("Select Status Type to set interrupt edge/level trigger type for: (0 for BIT, 1 for Signal Fault Low, 2 for Ref Fault Low, ");
   printf("3 for Signal Fault High, 4 for Ref Fault High, 5 for Open, 6 for Short, 7 for Summary, 8 for Delta Position, q for quit): ");
   bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   if ((!bQuit) && (inputResponseCnt > 0))
   {
      switch (inputBuffer[0])
      {
         case '0':
            statusType = NAI_LVDT_STATUS_BIT_LATCHED;
            sprintf(statusTypeStr, "BIT");
         break;
         case '1':
            statusType = NAI_LVDT_STATUS_SIGNAL_LOW_LATCHED;
            sprintf(statusTypeStr, "Signal Fault Low");
         break;
         case '2':
            statusType = NAI_LVDT_STATUS_REF_LOW_LATCHED;
            sprintf(statusTypeStr, "Ref Fault Low");
         break;
         case '3':
            statusType = NAI_LVDT_STATUS_SIGNAL_HIGH_LATCHED;
            sprintf(statusTypeStr, "Signal Fault High");
         break;
         case '4':
            statusType = NAI_LVDT_STATUS_REF_HIGH_LATCHED;
            sprintf(statusTypeStr, "Ref Fault High");
         break;
         case '5':
            statusType = NAI_LVDT_STATUS_OPEN_LATCHED;
            sprintf(statusTypeStr, "Open");
         break;
         case '6':
            statusType = NAI_LVDT_STATUS_SHORT_LATCHED;
            sprintf(statusTypeStr, "Short");
         break;
         case '7':
            statusType = NAI_LVDT_STATUS_SUMMARY_LATCHED;
            sprintf(statusTypeStr, "Summary");
         break;
         case '8':
            statusType = NAI_LVDT_STATUS_DELTA_POS_LATCHED;
            sprintf(statusTypeStr, "Delta Position");
         break;
         case 'q':
         case 'Q':
            bQuit = TRUE;
         break;
         default:
            bQuit = TRUE;
            printf("\nInvalid status type entered\n");
         break;
      }

      if (!bQuit)
      {
         printf("\nSelect interrupt edge/level trigger type to set for the %s status (0 for Edge, 1 for Level): ", statusTypeStr);
         bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
         if ((!bQuit) && (inputResponseCnt > 0))
         {
            switch (inputBuffer[0])
            {
               case '0':
                  check_status(naibrd_LVDT_SetEdgeLevelInterrupt(cardIndex, module, channel, statusType, NAI_LVDT_EDGE_INTERRUPT));
               break;
               case '1':
                  check_status(naibrd_LVDT_SetEdgeLevelInterrupt(cardIndex, module, channel, statusType, NAI_LVDT_LEVEL_INTERRUPT));
               break;
               default:
                  bQuit = TRUE;
                  printf("\nInvalid selection entered\n");
               break;
            }
         }
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static nai_status_t LVDTInterruptMenu_SetInterruptVector(int32_t paramCount, int32_t* p_params)
{
   bool_t bQuit = FALSE;
   nai_lvdt_status_type_t statusType = 0u;
   uint32_t vector = 0u;
   char statusTypeStr[18] = "";
   p_naiapp_AppParameters_t LVDT_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = LVDT_params->cardIndex;
   int32_t module = LVDT_params->module;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   printf("Select Status Type to set interrupt vector for: (0 for BIT, 1 for Signal Fault Low, 2 for Ref Fault Low, ");
   printf("3 for Signal Fault High, 4 for Ref Fault High, 5 for Open, 6 for Short, 7 for Summary, 8 for Delta Position, q for quit): ");
   bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   if ((!bQuit) && (inputResponseCnt > 0))
   {
      switch (inputBuffer[0])
      {
         case '0':
            statusType = NAI_LVDT_STATUS_BIT_LATCHED;
            sprintf(statusTypeStr, "BIT");
         break;
         case '1':
            statusType = NAI_LVDT_STATUS_SIGNAL_LOW_LATCHED;
            sprintf(statusTypeStr, "Signal Fault Low");
         break;
         case '2':
            statusType = NAI_LVDT_STATUS_REF_LOW_LATCHED;
            sprintf(statusTypeStr, "Ref Fault Low");
         break;
         case '3':
            statusType = NAI_LVDT_STATUS_SIGNAL_HIGH_LATCHED;
            sprintf(statusTypeStr, "Signal Fault High");
         break;
         case '4':
            statusType = NAI_LVDT_STATUS_REF_HIGH_LATCHED;
            sprintf(statusTypeStr, "Ref Fault High");
         break;
         case '5':
            statusType = NAI_LVDT_STATUS_OPEN_LATCHED;
            sprintf(statusTypeStr, "Open");
         break;
         case '6':
            statusType = NAI_LVDT_STATUS_SHORT_LATCHED;
            sprintf(statusTypeStr, "Short");
         break;
         case '7':
            statusType = NAI_LVDT_STATUS_SUMMARY_LATCHED;
            sprintf(statusTypeStr, "Summary");
         break;
         case '8':
            statusType = NAI_LVDT_STATUS_DELTA_POS_LATCHED;
            sprintf(statusTypeStr, "Delta Position");
         break;
         case 'q':
         case 'Q':
            bQuit = TRUE;
         break;
         default:
            bQuit = TRUE;
            printf("\nInvalid status type entered\n");
         break;
      }

      if (!bQuit)
      {
         printf("\nType interrupt vector in hex to set for the %s status: 0x", statusTypeStr);
         bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
         if ((!bQuit) && (inputResponseCnt > 0))
         {
            vector = (uint32_t)strtoul((const char*)inputBuffer, NULL, 16);
            if (vector == 0u)
            {
               if (inputBuffer[0] == '0')
               {
                  check_status(naibrd_LVDT_SetInterruptVector(cardIndex, module, statusType, vector));
               }
               else
               {
                  printf("\nInvalid value entered\n");
               }
            }
            else
            {
               check_status(naibrd_LVDT_SetInterruptVector(cardIndex, module, statusType, vector));
            }
         }
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static nai_status_t LVDTInterruptMenu_SetInterruptSteering(int32_t paramCount, int32_t* p_params)
{
   bool_t bQuit = FALSE;
   nai_lvdt_status_type_t statusType = 0u;
   char statusTypeStr[18] = "";
   p_naiapp_AppParameters_t LVDT_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = LVDT_params->cardIndex;
   int32_t module = LVDT_params->module;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   printf("Select Status Type to steer interrupts for: (0 for BIT, 1 for Signal Fault Low, 2 for Ref Fault Low, ");
   printf("3 for Signal Fault High, 4 for Ref Fault High, 5 for Open, 6 for Short, 7 for Summary, 8 for Delta Position, q for quit): ");
   bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   if ((!bQuit) && (inputResponseCnt > 0))
   {
      switch (inputBuffer[0])
      {
         case '0':
            statusType = NAI_LVDT_STATUS_BIT_LATCHED;
            sprintf(statusTypeStr, "BIT");
         break;
         case '1':
            statusType = NAI_LVDT_STATUS_SIGNAL_LOW_LATCHED;
            sprintf(statusTypeStr, "Signal Fault Low");
         break;
         case '2':
            statusType = NAI_LVDT_STATUS_REF_LOW_LATCHED;
            sprintf(statusTypeStr, "Ref Fault Low");
         break;
         case '3':
            statusType = NAI_LVDT_STATUS_SIGNAL_HIGH_LATCHED;
            sprintf(statusTypeStr, "Signal Fault High");
         break;
         case '4':
            statusType = NAI_LVDT_STATUS_REF_HIGH_LATCHED;
            sprintf(statusTypeStr, "Ref Fault High");
         break;
         case '5':
            statusType = NAI_LVDT_STATUS_OPEN_LATCHED;
            sprintf(statusTypeStr, "Open");
         break;
         case '6':
            statusType = NAI_LVDT_STATUS_SHORT_LATCHED;
            sprintf(statusTypeStr, "Short");
         break;
         case '7':
            statusType = NAI_LVDT_STATUS_SUMMARY_LATCHED;
            sprintf(statusTypeStr, "Summary");
         break;
         case '8':
            statusType = NAI_LVDT_STATUS_DELTA_POS_LATCHED;
            sprintf(statusTypeStr, "Delta Position");
         break;
         case 'q':
         case 'Q':
            bQuit = TRUE;
         break;
         default:
            bQuit = TRUE;
            printf("\nInvalid status type entered\n");
         break;
      }

      if (!bQuit)
      {
         printf("\nSelect direction to steer interrupts for the %s status ", statusTypeStr);
         printf("(1 for VME Bus, 2 for On Board 0 (Custom Application on ARM), 3 for On Board 1 (NAI Ethernet Listener Application), ");
         printf("4 for On Board 2, 5 for PCIe Bus, 6 for CPCI Bus): ");
         bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
         if ((!bQuit) && (inputResponseCnt > 0))
         {
            switch (inputBuffer[0])
            {
               case '1':
                  check_status(naibrd_LVDT_SetInterruptSteering(cardIndex, module, statusType, (naibrd_int_steering_t)NAIBRD_INT_STEERING_VME));
               break;
               case '2':
                  check_status(naibrd_LVDT_SetInterruptSteering(cardIndex, module, statusType, (naibrd_int_steering_t)NAIBRD_INT_STEERING_ON_BOARD_0));
               break;
               case '3':
                  check_status(naibrd_LVDT_SetInterruptSteering(cardIndex, module, statusType, (naibrd_int_steering_t)NAIBRD_INT_STEERING_ON_BOARD_1));
               break;
               case '4':
                  check_status(naibrd_LVDT_SetInterruptSteering(cardIndex, module, statusType, (naibrd_int_steering_t)NAIBRD_INT_STEERING_ON_BOARD_2));
               break;
               case '5':
                  check_status(naibrd_LVDT_SetInterruptSteering(cardIndex, module, statusType, (naibrd_int_steering_t)NAIBRD_INT_STEERING_PCIE_APP));
               break;
               case '6':
                  check_status(naibrd_LVDT_SetInterruptSteering(cardIndex, module, statusType, (naibrd_int_steering_t)NAIBRD_INT_STEERING_CPCI_APP));
               break;
               default:
                  bQuit = TRUE;
                  printf("\nInvalid selection entered\n");
               break;
            }
         }
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static nai_status_t LVDTFIFOMenu_SetFIFOThreshold(int32_t paramCount, int32_t* p_params)
{
   bool_t bQuit = FALSE;
   uint32_t threshold = 0u;
   uint32_t thresholdTypeToSet = 0u;
   char strThresholdTypeToSet[15] = "";
   p_naiapp_AppParameters_t LVDT_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = LVDT_params->cardIndex;
   int32_t module = LVDT_params->module;
   int32_t channel = LVDT_params->channel;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   printf("Enter FIFO Threshold type to set (0 for almost empty, 1 for low watermark, 2 for high watermark, 3 for almost full): ");
   bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   if ((!bQuit) && (inputResponseCnt > 0))
   {
      switch (inputBuffer[0])
      {
         case '0':
            thresholdTypeToSet = 0u;
            sprintf(strThresholdTypeToSet, "Almost Empty");
         break;
         case '1':
            thresholdTypeToSet = 1u;
            sprintf(strThresholdTypeToSet, "Low Watermark");
         break;
         case '2':
            thresholdTypeToSet = 2u;
            sprintf(strThresholdTypeToSet, "High Watermark");
         break;
         case '3':
            thresholdTypeToSet = 3u;
            sprintf(strThresholdTypeToSet, "Almost Full");
         break;
         default:
            bQuit = TRUE;
            printf("\nInvalid selection entered\n");
         break;
      }

      if (!bQuit)
      {
         if (DisplayAsHex)
         {
            printf("Type Raw Hex %s Threshold Value to set: 0x", strThresholdTypeToSet);
            bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
            if ((!bQuit) && (inputResponseCnt > 0))
            {
               threshold = (uint32_t)strtoul((const char*)inputBuffer, NULL, 16);
               if (threshold == 0u)
               {
                  if (inputBuffer[0] == '0')
                  {
                     switch (thresholdTypeToSet)
                     {
                        case 0u:
                           check_status(naibrd_LVDT_SetFIFOAlmostEmptyThreshold(cardIndex, module, channel, threshold));
                        break;
                        case 1u:
                           check_status(naibrd_LVDT_SetFIFOLoThreshold(cardIndex, module, channel, threshold));
                        break;
                        case 2u:
                           check_status(naibrd_LVDT_SetFIFOHiThreshold(cardIndex, module, channel, threshold));
                        break;
                        case 3u:
                           check_status(naibrd_LVDT_SetFIFOAlmostFullThreshold(cardIndex, module, channel, threshold));
                        break;
                     }
                  }
                  else
                  {
                     printf("\nInvalid value entered\n");
                  }
               }
               else
               {
                  switch (thresholdTypeToSet)
                  {
                     case 0u:
                        check_status(naibrd_LVDT_SetFIFOAlmostEmptyThreshold(cardIndex, module, channel, threshold));
                     break;
                     case 1u:
                        check_status(naibrd_LVDT_SetFIFOLoThreshold(cardIndex, module, channel, threshold));
                     break;
                     case 2u:
                        check_status(naibrd_LVDT_SetFIFOHiThreshold(cardIndex, module, channel, threshold));
                     break;
                     case 3u:
                        check_status(naibrd_LVDT_SetFIFOAlmostFullThreshold(cardIndex, module, channel, threshold));
                     break;
                  }
               }
            }
         }
         else
         {
            printf("Type %s Threshold Value to set: ", strThresholdTypeToSet);
            bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
            if ((!bQuit) && (inputResponseCnt > 0))
            {
               threshold = (uint32_t)strtoul((const char*)inputBuffer, NULL, 10);
               if (threshold == 0u)
               {
                  if (inputBuffer[0] == '0')
                  {
                     switch (thresholdTypeToSet)
                     {
                        case 0u:
                           check_status(naibrd_LVDT_SetFIFOAlmostEmptyThreshold(cardIndex, module, channel, threshold));
                        break;
                        case 1u:
                           check_status(naibrd_LVDT_SetFIFOLoThreshold(cardIndex, module, channel, threshold));
                        break;
                        case 2u:
                           check_status(naibrd_LVDT_SetFIFOHiThreshold(cardIndex, module, channel, threshold));
                        break;
                        case 3u:
                           check_status(naibrd_LVDT_SetFIFOAlmostFullThreshold(cardIndex, module, channel, threshold));
                        break;
                     }
                  }
                  else
                  {
                     printf("\nInvalid value entered\n");
                  }
               }
               else
               {
                  switch (thresholdTypeToSet)
                  {
                     case 0u:
                        check_status(naibrd_LVDT_SetFIFOAlmostEmptyThreshold(cardIndex, module, channel, threshold));
                     break;
                     case 1u:
                        check_status(naibrd_LVDT_SetFIFOLoThreshold(cardIndex, module, channel, threshold));
                     break;
                     case 2u:
                        check_status(naibrd_LVDT_SetFIFOHiThreshold(cardIndex, module, channel, threshold));
                     break;
                     case 3u:
                        check_status(naibrd_LVDT_SetFIFOAlmostFullThreshold(cardIndex, module, channel, threshold));
                     break;
                  }
               }
            }
         }
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static nai_status_t LVDTFIFOMenu_SetFIFOSize(int32_t paramCount, int32_t* p_params)
{
   bool_t bQuit = FALSE;
   uint32_t fifoSize = 0u;
   p_naiapp_AppParameters_t LVDT_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = LVDT_params->cardIndex;
   int32_t module = LVDT_params->module;
   int32_t channel = LVDT_params->channel;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   if (DisplayAsHex)
   {
      printf("Type Raw Hex FIFO Size setting to set: 0x");
      bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
      if ((!bQuit) && (inputResponseCnt > 0))
      {
         fifoSize = (uint32_t)strtoul((const char*)inputBuffer, NULL, 16);
         if (fifoSize == 0u)
         {
            if (inputBuffer[0] == '0')
            {
               check_status(naibrd_LVDT_SetFIFOSize(cardIndex, module, channel, fifoSize));
            }
            else
            {
               printf("\nInvalid value entered\n");
            }
         }
         else
         {
            check_status(naibrd_LVDT_SetFIFOSize(cardIndex, module, channel, fifoSize));
         }
      }
   }
   else
   {
      printf("Type FIFO Size setting to set: ");
      bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
      if ((!bQuit) && (inputResponseCnt > 0))
      {
         fifoSize = (uint32_t)strtoul((const char*)inputBuffer, NULL, 10);
         if (fifoSize == 0u)
         {
            if (inputBuffer[0] == '0')
            {
               check_status(naibrd_LVDT_SetFIFOSize(cardIndex, module, channel, fifoSize));
            }
            else
            {
               printf("\nInvalid value entered\n");
            }
         }
         else
         {
            check_status(naibrd_LVDT_SetFIFOSize(cardIndex, module, channel, fifoSize));
         }
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;;
}

static nai_status_t LVDTFIFOMenu_SetFIFODataType(int32_t paramCount, int32_t* p_params)
{
   bool_t bQuit = FALSE;
   uint32_t fifoDataType = 0u;
   p_naiapp_AppParameters_t LVDT_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = LVDT_params->cardIndex;
   int32_t module = LVDT_params->module;
   int32_t channel = LVDT_params->channel;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   if (DisplayAsHex)
   {
      printf("Type Raw Hex FIFO Data Type setting to set: 0x");
      bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
      if ((!bQuit) && (inputResponseCnt > 0))
      {
         fifoDataType = (uint32_t)strtoul((const char*)inputBuffer, NULL, 16);
         if (fifoDataType == 0u)
         {
            if (inputBuffer[0] == '0')
            {
               check_status(naibrd_LVDT_SetFIFODataType(cardIndex, module, channel, fifoDataType));
            }
            else
            {
               printf("\nInvalid value entered\n");
            }
         }
         else
         {
            check_status(naibrd_LVDT_SetFIFODataType(cardIndex, module, channel, fifoDataType));
         }
      }
   }
   else
   {
      printf("Type FIFO Data Type setting to set: ");
      bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
      if ((!bQuit) && (inputResponseCnt > 0))
      {
         fifoDataType = (uint32_t)strtoul((const char*)inputBuffer, NULL, 10);
         if (fifoDataType == 0u)
         {
            if (inputBuffer[0] == '0')
            {
               check_status(naibrd_LVDT_SetFIFODataType(cardIndex, module, channel, fifoDataType));
            }
            else
            {
               printf("\nInvalid value entered\n");
            }
         }
         else
         {
            check_status(naibrd_LVDT_SetFIFODataType(cardIndex, module, channel, fifoDataType));
         }
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static nai_status_t LVDTFIFOMenu_SetFIFOSampleRate(int32_t paramCount, int32_t* p_params)
{
   bool_t bQuit = FALSE;
   float64_t sampleRate = 0.0;
   uint32_t sampleRateRaw = 0u;
   p_naiapp_AppParameters_t LVDT_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = LVDT_params->cardIndex;
   int32_t module = LVDT_params->module;
   int32_t channel = LVDT_params->channel;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   if (DisplayAsHex)
   {
      printf("Type Raw Hex FIFO Sample Rate Value to set: 0x");
      bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
      if ((!bQuit) && (inputResponseCnt > 0))
      {
         sampleRateRaw = (uint32_t)strtoul((const char*)inputBuffer, NULL, 16);
         if (sampleRateRaw == 0u)
         {
            if (inputBuffer[0] == '0')
            {
               check_status(naibrd_LVDT_SetFIFOSampleRate(cardIndex, module, channel, sampleRateRaw));
            }
            else
            {
               printf("\nInvalid value entered\n");
            }
         }
         else
         {
            check_status(naibrd_LVDT_SetFIFOSampleRate(cardIndex, module, channel, sampleRateRaw));
         }
      }
   }
   else
   {
      printf("Type FIFO Sample Rate Value to set: ");
      bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
      if ((!bQuit) && (inputResponseCnt > 0))
      {
         sampleRate = atof((const char*)inputBuffer);
         if (sampleRate == 0.0)
         {
            if (inputBuffer[0] == '0')
            {
               check_status(naibrd_LVDT_SetFIFOSampleRateValue(cardIndex, module, channel, sampleRate));
            }
            else
            {
               printf("\nInvalid Sample Rate value entered\n");
            }
         }
         else
         {
            check_status(naibrd_LVDT_SetFIFOSampleRateValue(cardIndex, module, channel, sampleRate));
         }
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static nai_status_t LVDTFIFOMenu_SetFIFODelay(int32_t paramCount, int32_t* p_params)
{
   bool_t bQuit = FALSE;
   uint32_t delay = 0u;
   p_naiapp_AppParameters_t LVDT_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = LVDT_params->cardIndex;
   int32_t module = LVDT_params->module;
   int32_t channel = LVDT_params->channel;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   if (DisplayAsHex)
   {
      printf("Type Raw Hex FIFO Delay setting to set: 0x");
      bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
      if ((!bQuit) && (inputResponseCnt > 0))
      {
         delay = (uint32_t)strtoul((const char*)inputBuffer, NULL, 16);
         if (delay == 0u)
         {
            if (inputBuffer[0] == '0')
            {
               check_status(naibrd_LVDT_SetFIFODelay(cardIndex, module, channel, delay));
            }
            else
            {
               printf("\nInvalid value entered\n");
            }
         }
         else
         {
            check_status(naibrd_LVDT_SetFIFODelay(cardIndex, module, channel, delay));
         }
      }
   }
   else
   {
      printf("Type FIFO Delay setting to set: ");
      bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
      if ((!bQuit) && (inputResponseCnt > 0))
      {
         delay = (uint32_t)strtoul((const char*)inputBuffer, NULL, 10);
         if (delay == 0u)
         {
            if (inputBuffer[0] == '0')
            {
               check_status(naibrd_LVDT_SetFIFODelay(cardIndex, module, channel, delay));
            }
            else
            {
               printf("\nInvalid value entered\n");
            }
         }
         else
         {
            check_status(naibrd_LVDT_SetFIFODelay(cardIndex, module, channel, delay));
         }
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static nai_status_t LVDTFIFOMenu_ClearFIFO(int32_t paramCount, int32_t* p_params)
{
   bool_t bQuit = FALSE;
   nai_status_t status = NAI_ERROR_UNKNOWN;
   p_naiapp_AppParameters_t LVDT_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = LVDT_params->cardIndex;
   int32_t module = LVDT_params->module;
   int32_t channel = LVDT_params->channel;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   printf("Are you sure you want to clear the FIFO? (Y for Yes, N for No): ");
   bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   if ((!bQuit) && (inputResponseCnt > 0) && (toupper(inputBuffer[0]) == 'Y'))
   {
      status = check_status(naibrd_LVDT_ClearFIFO(cardIndex, module, channel));
      if (status == NAI_SUCCESS)
      {
         printf("\nFIFO Cleared!\n");
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static nai_status_t LVDTFIFOMenu_SetFIFOTrigCtrl(int32_t paramCount, int32_t* p_params)
{
   bool_t bQuit = FALSE;
   uint32_t fifoTrigMode = 0u;
   p_naiapp_AppParameters_t LVDT_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = LVDT_params->cardIndex;
   int32_t module = LVDT_params->module;
   int32_t channel = LVDT_params->channel;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   if (DisplayAsHex)
   {
      printf("Type Raw Hex FIFO Trigger Mode setting to set: 0x");
      bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
      if ((!bQuit) && (inputResponseCnt > 0))
      {
         fifoTrigMode = (uint32_t)strtoul((const char*)inputBuffer, NULL, 16);
         if (fifoTrigMode == 0u)
         {
            if (inputBuffer[0] == '0')
            {
               check_status(naibrd_LVDT_SetFIFOTrigMode(cardIndex, module, channel, fifoTrigMode));
            }
            else
            {
               printf("\nInvalid value entered\n");
            }
         }
         else
         {
            check_status(naibrd_LVDT_SetFIFOTrigMode(cardIndex, module, channel, fifoTrigMode));
         }
      }
   }
   else
   {
      printf("Type FIFO Trigger Mode setting to set: ");
      bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
      if ((!bQuit) && (inputResponseCnt > 0))
      {
         fifoTrigMode = (uint32_t)strtoul((const char*)inputBuffer, NULL, 10);
         if (fifoTrigMode == 0u)
         {
            if (inputBuffer[0] == '0')
            {
               check_status(naibrd_LVDT_SetFIFOTrigMode(cardIndex, module, channel, fifoTrigMode));
            }
            else
            {
               printf("\nInvalid value entered\n");
            }
         }
         else
         {
            check_status(naibrd_LVDT_SetFIFOTrigMode(cardIndex, module, channel, fifoTrigMode));
         }
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static nai_status_t LVDTFIFOMenu_SoftwareTrigger(int32_t paramCount, int32_t* p_params)
{
   bool_t bQuit = FALSE;
   nai_status_t status = NAI_ERROR_UNKNOWN;
   p_naiapp_AppParameters_t LVDT_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = LVDT_params->cardIndex;
   int32_t module = LVDT_params->module;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   printf("Are you sure you want to trigger the FIFO? (Y for Yes, N for No): ");
   bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   if ((!bQuit) && (inputResponseCnt > 0) && (toupper(inputBuffer[0]) == 'Y'))
   {
      status = check_status(naibrd_LVDT_SoftwareTrigger(cardIndex, module));
      if (status == NAI_SUCCESS)
      {
         printf("\nFIFO Triggered!\n");
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static nai_status_t LVDTFIFOMenu_ClearFIFOStatus(int32_t paramCount, int32_t* p_params)
{
   bool_t bQuit = FALSE;
   naibrd_lvdt_event_mapped_status_type_t fifoStatusTypeToClear = NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_EMPTY_LATCH;
   char strFifoStatusTypeToClear[15] = "";
   p_naiapp_AppParameters_t LVDT_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = LVDT_params->cardIndex;
   int32_t module = LVDT_params->module;
   int32_t channel = LVDT_params->channel;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   printf("Select FIFO Latched Status type to clear (0 for empty, 1 for almost empty, 2 for low watermark, 3 for high watermark, ");
   printf("4 for almost full, 5 for full, 6 for sample done): ");
   bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   if ((!bQuit) && (inputResponseCnt > 0))
   {
      switch (inputBuffer[0])
      {
         case '0':
            fifoStatusTypeToClear = NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_EMPTY_LATCH;
            sprintf(strFifoStatusTypeToClear, "Empty");
         break;
         case '1':
            fifoStatusTypeToClear = NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_ALMOST_EMPTY_LATCH;
            sprintf(strFifoStatusTypeToClear, "Almost Empty");
         break;
         case '2':
            fifoStatusTypeToClear = NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_LOW_THRESHOLD_LATCH;
            sprintf(strFifoStatusTypeToClear, "Low Watermark");
         break;
         case '3':
            fifoStatusTypeToClear = NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_HIGH_THRESHOLD_LATCH;
            sprintf(strFifoStatusTypeToClear, "High Watermark");
         break;
         case '4':
            fifoStatusTypeToClear = NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_ALMOST_FULL_LATCH;
            sprintf(strFifoStatusTypeToClear, "Almost Full");
         break;
         case '5':
            fifoStatusTypeToClear = NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_FULL_LATCH;
            sprintf(strFifoStatusTypeToClear, "Full");
         break;
         case '6':
            fifoStatusTypeToClear = NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_DONE_LATCH;
            sprintf(strFifoStatusTypeToClear, "Sample Done");
         break;
         default:
            bQuit = TRUE;
            printf("\nInvalid selection entered\n");
         break;
      }

      if (!bQuit)
      {
         printf("Are you sure you want to clear the FIFO %s Latched Status? (Y for Yes, N for No): ", strFifoStatusTypeToClear);
         bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
         if ((!bQuit) && (inputResponseCnt > 0) && (toupper(inputBuffer[0]) == 'Y'))
         {
            check_status(naibrd_LVDT_ClearEventMappedStatus(cardIndex, module, channel, fifoStatusTypeToClear));
         }
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static nai_status_t LVDTFIFOMenu_FIFOInterruptMenu(int32_t paramCount, int32_t* p_params)
{
   int32_t channelCount = 0;
   bool_t bQuit = FALSE;
   bool_t bCmdFound = FALSE;
   int32_t cmd = 0;
   p_naiapp_AppParameters_t LVDT_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = LVDT_params->cardIndex;
   int32_t module = LVDT_params->module;
   int32_t channel = LVDT_params->channel;
   uint32_t modId = LVDT_params->modId;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   channelCount = naibrd_LVDT_GetChannelCount(modId);
   naiapp_utils_LoadParamMenuCommands(LVDT_FIFOINTMENU_CMD_COUNT, LVDT_FIFOInterruptMenuCmds);
   do
   {
      LVDTFIFOMenu_DisplayFIFOInterruptData(cardIndex, module, modId);
      naiapp_display_ParamMenuCommands((int8_t*)"LVDT FIFO Interrupt Menu");
      printf("\n Type command or %c to quit : ", NAI_QUIT_CHAR);
      bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
      if ((!bQuit) && (inputResponseCnt > 0))
      {
         bCmdFound = naiapp_utils_GetParamMenuCmdNum(inputResponseCnt, inputBuffer, &cmd);
         if (bCmdFound)
         {
            naiapp_query_ChannelNumber(channelCount, 1, &channel);
            LVDT_FIFOInterruptMenuCmds[cmd].func(paramCount, p_params);
         }
         else
         {
            printf(" Invalid command entered\n");
         }
      }
   } while (!bQuit);

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static void LVDTFIFOMenu_DisplayFIFOInterruptData(int32_t cardIndex, int32_t module, uint32_t modid)
{
   int32_t channel = 0;
   int32_t channelCount = 0;
   bool_t intEnable = 0u;
   nai_lvdt_interrupt_t edgeLevelInt = 0u;
   uint32_t intVector = 0u;
   naibrd_int_steering_t intSteering = 0;
   char strIntEnable[10] = "";
   char strEdgeLevelInt[8] = "";
   char strIntSteering[48] = "";

   channelCount = naibrd_LVDT_GetChannelCount(modid);
   printf("\n\n");
   printf(" ====  ======= Empty =======  === Almost Empty ====  === Low Watermark ===  == High Watermark ===\n");
   printf(" Chan  Interrupt  Edge/Level  Interrupt  Edge/Level  Interrupt  Edge/Level  Interrupt  Edge/Level\n");
   printf("        Enable    Interrupt    Enable    Interrupt    Enable    Interrupt    Enable    Interrupt\n");
   printf(" ----  ---------------------  ---------------------  ---------------------  ---------------------\n");
   for (channel = 1; channel <= channelCount; channel++)
   {
      printf(" %2d    ", channel);

      check_status(naibrd_LVDT_GetEventMappedInterruptEnable(cardIndex, module, channel, NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_EMPTY_LATCH, &intEnable));
      switch (intEnable)
      {
         case (bool_t)FALSE:
            sprintf(strIntEnable, "Disabled");
         break;
         case (bool_t)TRUE:
            sprintf(strIntEnable, "Enabled ");
         break;
         default:
            sprintf(strIntEnable, "Unknown ");
         break;
      }
      check_status(naibrd_LVDT_GetEventMappedInterruptTriggerType(cardIndex, module, channel, NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_EMPTY_LATCH, &edgeLevelInt));
      switch (edgeLevelInt)
      {
         case NAI_LVDT_EDGE_INTERRUPT:
            sprintf(strEdgeLevelInt, " Edge  ");
         break;
         case NAI_LVDT_LEVEL_INTERRUPT:
            sprintf(strEdgeLevelInt, " Level ");
         break;
         default:
            sprintf(strEdgeLevelInt, "Unknown");
         break;
      }
      printf("%8s   %7s     ", strIntEnable, strEdgeLevelInt);

      check_status(naibrd_LVDT_GetEventMappedInterruptEnable(cardIndex, module, channel, NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_ALMOST_EMPTY_LATCH, &intEnable));
      switch (intEnable)
      {
         case (bool_t)FALSE:
            sprintf(strIntEnable, "Disabled");
         break;
         case (bool_t)TRUE:
            sprintf(strIntEnable, "Enabled ");
         break;
         default:
            sprintf(strIntEnable, "Unknown ");
         break;
      }
      check_status(naibrd_LVDT_GetEventMappedInterruptTriggerType(cardIndex, module, channel, NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_ALMOST_EMPTY_LATCH, &edgeLevelInt));
      switch (edgeLevelInt)
      {
         case NAI_LVDT_EDGE_INTERRUPT:
            sprintf(strEdgeLevelInt, " Edge  ");
         break;
         case NAI_LVDT_LEVEL_INTERRUPT:
            sprintf(strEdgeLevelInt, " Level ");
         break;
         default:
            sprintf(strEdgeLevelInt, "Unknown");
         break;
      }
      printf("%8s   %7s     ", strIntEnable, strEdgeLevelInt);

      check_status(naibrd_LVDT_GetEventMappedInterruptEnable(cardIndex, module, channel, NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_LOW_THRESHOLD_LATCH, &intEnable));
      switch (intEnable)
      {
         case (bool_t)FALSE:
            sprintf(strIntEnable, "Disabled");
         break;
         case (bool_t)TRUE:
            sprintf(strIntEnable, "Enabled ");
         break;
         default:
            sprintf(strIntEnable, "Unknown ");
         break;
      }
      check_status(naibrd_LVDT_GetEventMappedInterruptTriggerType(cardIndex, module, channel, NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_LOW_THRESHOLD_LATCH, &edgeLevelInt));
      switch (edgeLevelInt)
      {
         case NAI_LVDT_EDGE_INTERRUPT:
            sprintf(strEdgeLevelInt, " Edge  ");
         break;
         case NAI_LVDT_LEVEL_INTERRUPT:
            sprintf(strEdgeLevelInt, " Level ");
         break;
         default:
            sprintf(strEdgeLevelInt, "Unknown");
         break;
      }
      printf("%8s   %7s     ", strIntEnable, strEdgeLevelInt);

      check_status(naibrd_LVDT_GetEventMappedInterruptEnable(cardIndex, module, channel, NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_HIGH_THRESHOLD_LATCH, &intEnable));
      switch (intEnable)
      {
         case (bool_t)FALSE:
            sprintf(strIntEnable, "Disabled");
         break;
         case (bool_t)TRUE:
            sprintf(strIntEnable, "Enabled ");
         break;
         default:
            sprintf(strIntEnable, "Unknown ");
         break;
      }
      check_status(naibrd_LVDT_GetEventMappedInterruptTriggerType(cardIndex, module, channel, NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_HIGH_THRESHOLD_LATCH, &edgeLevelInt));
      switch (edgeLevelInt)
      {
         case NAI_LVDT_EDGE_INTERRUPT:
            sprintf(strEdgeLevelInt, " Edge  ");
         break;
         case NAI_LVDT_LEVEL_INTERRUPT:
            sprintf(strEdgeLevelInt, " Level ");
         break;
         default:
            sprintf(strEdgeLevelInt, "Unknown");
         break;
      }
      printf("%8s   %7s\n", strIntEnable, strEdgeLevelInt);
   }

   printf("\n\n");
   printf(" ====  ==== Almost Full ====  ======= Full ========  ==== Sample Done ====\n");
   printf(" Chan  Interrupt  Edge/Level  Interrupt  Edge/Level  Interrupt  Edge/Level\n");
   printf("        Enable    Interrupt    Enable    Interrupt    Enable    Interrupt\n");
   printf(" ----  ---------------------  ---------------------  ---------------------\n");
   for (channel = 1; channel <= channelCount; channel++)
   {
      printf(" %2d    ", channel);

      check_status(naibrd_LVDT_GetEventMappedInterruptEnable(cardIndex, module, channel, NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_ALMOST_FULL_LATCH, &intEnable));
      switch (intEnable)
      {
         case (bool_t)FALSE:
            sprintf(strIntEnable, "Disabled");
         break;
         case (bool_t)TRUE:
            sprintf(strIntEnable, "Enabled ");
         break;
         default:
            sprintf(strIntEnable, "Unknown ");
         break;
      }
      check_status(naibrd_LVDT_GetEventMappedInterruptTriggerType(cardIndex, module, channel, NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_ALMOST_FULL_LATCH, &edgeLevelInt));
      switch (edgeLevelInt)
      {
         case NAI_LVDT_EDGE_INTERRUPT:
            sprintf(strEdgeLevelInt, " Edge  ");
         break;
         case NAI_LVDT_LEVEL_INTERRUPT:
            sprintf(strEdgeLevelInt, " Level ");
         break;
         default:
            sprintf(strEdgeLevelInt, "Unknown");
         break;
      }
      printf("%8s   %7s     ", strIntEnable, strEdgeLevelInt);

      check_status(naibrd_LVDT_GetEventMappedInterruptEnable(cardIndex, module, channel, NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_FULL_LATCH, &intEnable));
      switch (intEnable)
      {
         case (bool_t)FALSE:
            sprintf(strIntEnable, "Disabled");
         break;
         case (bool_t)TRUE:
            sprintf(strIntEnable, "Enabled ");
         break;
         default:
            sprintf(strIntEnable, "Unknown ");
         break;
      }
      check_status(naibrd_LVDT_GetEventMappedInterruptTriggerType(cardIndex, module, channel, NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_FULL_LATCH, &edgeLevelInt));
      switch (edgeLevelInt)
      {
         case NAI_LVDT_EDGE_INTERRUPT:
            sprintf(strEdgeLevelInt, " Edge  ");
         break;
         case NAI_LVDT_LEVEL_INTERRUPT:
            sprintf(strEdgeLevelInt, " Level ");
         break;
         default:
            sprintf(strEdgeLevelInt, "Unknown");
         break;
      }
      printf("%8s   %7s     ", strIntEnable, strEdgeLevelInt);

      check_status(naibrd_LVDT_GetEventMappedInterruptEnable(cardIndex, module, channel, NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_DONE_LATCH, &intEnable));
      switch (intEnable)
      {
         case (bool_t)FALSE:
            sprintf(strIntEnable, "Disabled");
         break;
         case (bool_t)TRUE:
            sprintf(strIntEnable, "Enabled ");
         break;
         default:
            sprintf(strIntEnable, "Unknown ");
         break;
      }
      check_status(naibrd_LVDT_GetEventMappedInterruptTriggerType(cardIndex, module, channel, NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_DONE_LATCH, &edgeLevelInt));
      switch (edgeLevelInt)
      {
         case NAI_LVDT_EDGE_INTERRUPT:
            sprintf(strEdgeLevelInt, " Edge  ");
         break;
         case NAI_LVDT_LEVEL_INTERRUPT:
            sprintf(strEdgeLevelInt, " Level ");
         break;
         default:
            sprintf(strEdgeLevelInt, "Unknown");
         break;
      }
      printf("%8s   %7s\n", strIntEnable, strEdgeLevelInt);
   }

   printf("\n");
   for (channel = 1; channel <= channelCount; channel++)
   {
      check_status(naibrd_LVDT_GetEventMappedInterruptVector(cardIndex, module, channel, NAIBRD_LVDT_EVT_MAP_CATEGORY_FIFO, &intVector));
      printf("FIFO Channel %d Interrupt Vector: 0x%08X,   ", channel, intVector);
      check_status(naibrd_LVDT_GetEventMappedInterruptSteering(cardIndex, module, channel, NAIBRD_LVDT_EVT_MAP_CATEGORY_FIFO, &intSteering));
      switch (intSteering)
      {
         case (naibrd_int_steering_t)NAIBRD_INT_STEERING_VME:
            sprintf(strIntSteering, "VME Bus");
         break;
         case (naibrd_int_steering_t)NAIBRD_INT_STEERING_ON_BOARD_0:
            sprintf(strIntSteering, "On Board 0 (Custom Application on ARM)");
         break;
         case (naibrd_int_steering_t)NAIBRD_INT_STEERING_ON_BOARD_1:
            sprintf(strIntSteering, "On Board 1 (NAI Ethernet Listener Application)");
         break;
         case (naibrd_int_steering_t)NAIBRD_INT_STEERING_ON_BOARD_2:
            sprintf(strIntSteering, "On Board 2");
         break;
         case (naibrd_int_steering_t)NAIBRD_INT_STEERING_PCIE_APP:
            sprintf(strIntSteering, "PCIe Bus");
         break;
         case (naibrd_int_steering_t)NAIBRD_INT_STEERING_CPCI_APP:
            sprintf(strIntSteering, "CPCI Bus");
         break;
         default:
            sprintf(strIntSteering, "Unknown");
         break;
      }
      printf("FIFO Channel %d Interrupt Steering: %s\n", channel, strIntSteering);
   }
}

static nai_status_t LVDTFIFOIntMenu_SetFIFOIntEnable(int32_t paramCount, int32_t* p_params)
{
   bool_t bQuit = FALSE;
   naibrd_lvdt_event_mapped_status_type_t statusType = NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_EMPTY_LATCH;
   char statusTypeStr[15] = "";
   p_naiapp_AppParameters_t LVDT_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = LVDT_params->cardIndex;
   int32_t module = LVDT_params->module;
   int32_t channel = LVDT_params->channel;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   printf("Select FIFO Status Type to enable/disable interrupts for (0 for Empty, 1 for Almost Empty, 2 for Low Watermark, ");
   printf("3 for High Watermark, 4 for Almost Full, 5 for Full, 6 for Sample Done, q for quit): ");
   bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   if ((!bQuit) && (inputResponseCnt > 0))
   {
      switch (inputBuffer[0])
      {
         case '0':
            statusType = NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_EMPTY_LATCH;
            sprintf(statusTypeStr, "Empty");
         break;
         case '1':
            statusType = NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_ALMOST_EMPTY_LATCH;
            sprintf(statusTypeStr, "Almost Empty");
         break;
         case '2':
            statusType = NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_LOW_THRESHOLD_LATCH;
            sprintf(statusTypeStr, "Low Watermark");
         break;
         case '3':
            statusType = NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_HIGH_THRESHOLD_LATCH;
            sprintf(statusTypeStr, "High Watermark");
         break;
         case '4':
            statusType = NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_ALMOST_FULL_LATCH;
            sprintf(statusTypeStr, "Almost Full");
         break;
         case '5':
            statusType = NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_FULL_LATCH;
            sprintf(statusTypeStr, "Full");
         break;
         case '6':
            statusType = NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_DONE_LATCH;
            sprintf(statusTypeStr, "Sample Done");
         break;
         default:
            bQuit = TRUE;
            printf("\nInvalid FIFO status type entered\n");
         break;
      }

      if (!bQuit)
      {
         printf("\nDo you want to enable or disable interrupts for the FIFO %s status? (1 to enable, 0 to disable): ", statusTypeStr);
         bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
         if ((!bQuit) && (inputResponseCnt > 0))
         {
            switch (inputBuffer[0])
            {
               case '0':
                  check_status(naibrd_LVDT_SetEventMappedInterruptEnable(cardIndex, module, channel, statusType, (bool_t)FALSE));
               break;
               case '1':
                  check_status(naibrd_LVDT_SetEventMappedInterruptEnable(cardIndex, module, channel, statusType, (bool_t)TRUE));
               break;
               default:
                  bQuit = TRUE;
                  printf("\nInvalid selection entered\n");
               break;
            }
         }
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static nai_status_t LVDTFIFOIntMenu_SetFIFOEdgeLevelInt(int32_t paramCount, int32_t* p_params)
{
   bool_t bQuit = FALSE;
   naibrd_lvdt_event_mapped_status_type_t statusType = NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_EMPTY_LATCH;
   char statusTypeStr[15] = "";
   p_naiapp_AppParameters_t LVDT_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = LVDT_params->cardIndex;
   int32_t module = LVDT_params->module;
   int32_t channel = LVDT_params->channel;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   printf("Select FIFO Status Type to set interrupt edge/level trigger type for (0 for Empty, 1 for Almost Empty, 2 for Low Watermark, ");
   printf("3 for High Watermark, 4 for Almost Full, 5 for Full, 6 for Sample Done, q for quit): ");
   bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   if ((!bQuit) && (inputResponseCnt > 0))
   {
      switch (inputBuffer[0])
      {
         case '0':
            statusType = NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_EMPTY_LATCH;
            sprintf(statusTypeStr, "Empty");
         break;
         case '1':
            statusType = NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_ALMOST_EMPTY_LATCH;
            sprintf(statusTypeStr, "Almost Empty");
         break;
         case '2':
            statusType = NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_LOW_THRESHOLD_LATCH;
            sprintf(statusTypeStr, "Low Watermark");
         break;
         case '3':
            statusType = NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_HIGH_THRESHOLD_LATCH;
            sprintf(statusTypeStr, "High Watermark");
         break;
         case '4':
            statusType = NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_ALMOST_FULL_LATCH;
            sprintf(statusTypeStr, "Almost Full");
         break;
         case '5':
            statusType = NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_FULL_LATCH;
            sprintf(statusTypeStr, "Full");
         break;
         case '6':
            statusType = NAIBRD_LVDT_EVT_MAP_STATUS_FIFO_DONE_LATCH;
            sprintf(statusTypeStr, "Sample Done");
         break;
         default:
            bQuit = TRUE;
            printf("\nInvalid FIFO status type entered\n");
         break;
      }

      if (!bQuit)
      {
         printf("\nSelect interrupt edge/level trigger type to set for the FIFO %s status (0 for Edge, 1 for Level): ", statusTypeStr);
         bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
         if ((!bQuit) && (inputResponseCnt > 0))
         {
            switch (inputBuffer[0])
            {
               case '0':
                  check_status(naibrd_LVDT_SetEventMappedInterruptTriggerType(cardIndex, module, channel, statusType, NAI_LVDT_EDGE_INTERRUPT));
               break;
               case '1':
                  check_status(naibrd_LVDT_SetEventMappedInterruptTriggerType(cardIndex, module, channel, statusType, NAI_LVDT_LEVEL_INTERRUPT));
               break;
               default:
                  bQuit = TRUE;
                  printf("\nInvalid selection entered\n");
               break;
            }
         }
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static nai_status_t LVDTFIFOIntMenu_SetFIFOIntVector(int32_t paramCount, int32_t* p_params)
{
   bool_t bQuit = FALSE;
   uint32_t vector = 0u;
   p_naiapp_AppParameters_t LVDT_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = LVDT_params->cardIndex;
   int32_t module = LVDT_params->module;
   int32_t channel = LVDT_params->channel;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   printf("\nType interrupt vector in hex to set for the FIFO Channel %d Status: 0x", channel);
   bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   if ((!bQuit) && (inputResponseCnt > 0))
   {
      vector = (uint32_t)strtoul((const char*)inputBuffer, NULL, 16);
      if (vector == 0u)
      {
         if (inputBuffer[0] == '0')
         {
            check_status(naibrd_LVDT_SetEventMappedInterruptVector(cardIndex, module, channel, NAIBRD_LVDT_EVT_MAP_CATEGORY_FIFO, vector));
         }
         else
         {
            printf("\nInvalid value entered\n");
         }
      }
      else
      {
         check_status(naibrd_LVDT_SetEventMappedInterruptVector(cardIndex, module, channel, NAIBRD_LVDT_EVT_MAP_CATEGORY_FIFO, vector));
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static nai_status_t LVDTFIFOIntMenu_SetFIFOIntSteering(int32_t paramCount, int32_t* p_params)
{
   bool_t bQuit = FALSE;
   p_naiapp_AppParameters_t LVDT_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = LVDT_params->cardIndex;
   int32_t module = LVDT_params->module;
   int32_t channel = LVDT_params->channel;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   printf("\nSelect direction to steer interrupts for the FIFO Channel %d status ", channel);
   printf("(1 for VME Bus, 2 for On Board 0 (Custom Application on ARM), 3 for On Board 1 (NAI Ethernet Listener Application), ");
   printf("4 for On Board 2, 5 for PCIe Bus, 6 for CPCI Bus): ");
   bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   if ((!bQuit) && (inputResponseCnt > 0))
   {
      switch (inputBuffer[0])
      {
         case '1':
            check_status(naibrd_LVDT_SetEventMappedInterruptSteering(cardIndex, module, channel, NAIBRD_LVDT_EVT_MAP_CATEGORY_FIFO, (naibrd_int_steering_t)NAIBRD_INT_STEERING_VME));
         break;
         case '2':
            check_status(naibrd_LVDT_SetEventMappedInterruptSteering(cardIndex, module, channel, NAIBRD_LVDT_EVT_MAP_CATEGORY_FIFO, (naibrd_int_steering_t)NAIBRD_INT_STEERING_ON_BOARD_0));
         break;
         case '3':
            check_status(naibrd_LVDT_SetEventMappedInterruptSteering(cardIndex, module, channel, NAIBRD_LVDT_EVT_MAP_CATEGORY_FIFO, (naibrd_int_steering_t)NAIBRD_INT_STEERING_ON_BOARD_1));
         break;
         case '4':
            check_status(naibrd_LVDT_SetEventMappedInterruptSteering(cardIndex, module, channel, NAIBRD_LVDT_EVT_MAP_CATEGORY_FIFO, (naibrd_int_steering_t)NAIBRD_INT_STEERING_ON_BOARD_2));
         break;
         case '5':
            check_status(naibrd_LVDT_SetEventMappedInterruptSteering(cardIndex, module, channel, NAIBRD_LVDT_EVT_MAP_CATEGORY_FIFO, (naibrd_int_steering_t)NAIBRD_INT_STEERING_PCIE_APP));
         break;
         case '6':
            check_status(naibrd_LVDT_SetEventMappedInterruptSteering(cardIndex, module, channel, NAIBRD_LVDT_EVT_MAP_CATEGORY_FIFO, (naibrd_int_steering_t)NAIBRD_INT_STEERING_CPCI_APP));
         break;
         default:
            bQuit = TRUE;
            printf("\nInvalid selection entered\n");
         break;
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

Help Bot

X