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

DL BasicOpsMenu

DL BasicOpsMenu

Explanation

About Sample Application Code for North Atlantic Industries' (NAI) Embedded Function Modules

Overview This C application interacts with embedded function modules from North Atlantic Industries (NAI) using their Software Support Kit (SSK). The primary purpose is to manage and retrieve data from their Digital-to-Analog (DL) function module. The program runs a menu-driven interface, allowing users to perform various operations such as setting the power state, configuring channels, and displaying module measurements.

Key Components and Functionality

Included Libraries: 1. Standard Libraries: c #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <ctype.h> These libraries provide standard input/output functions, memory management, string manipulation, time-related functions, and character type handling.

  1. NAI Specific Libraries: c #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" #include "nai.h" #include "naibrd.h" #include "functions/naibrd_dl.h" These headers are specific to NAI, providing APIs for board access, menu handling, queries, display utilities, and Digital-to-Analog (DL) operations.

Constants and Enumerations: 1. Boolean Constants: c #if !defined (TRUE) #define TRUE 1 #endif #if !defined (FALSE) #define FALSE 0 #endif

  1. Application Metadata: c static const int8_t SAMPLE_PGM_NAME = (int8_t) "DL Module Basic Operation Program"; static const int8_t CONFIG_FILE = (int8_t) "default_DL_BasicOps.txt"; static bool_t displayHex = FALSE;

  2. Menu Commands Enumeration: c enum dl_basicOpsMenu_commands { DL_BASICMENU_CMD_SET_POWER_STATE, DL_BASICMENU_CMD_SET_CHANNEL_OUTPUT, DL_BASICMENU_CMD_SET_POSITION, DL_BASICMENU_CMD_SET_CONFIGURATION, DL_BASICMENU_CMD_SET_DISPLAY_HEX, DL_BASICMENU_CMD_COUNT };

Core Functional Areas:

  1. Main Entry Point: c #if defined (VXWORKS) int32_t DL_BasicOpsMenu(void) #else int32_t main(void) #endif This function initializes the program, runs the NAI board menu, queries the user for input, and executes commands based on user responses.

  2. Menu Display and User Interaction: c static bool_t DLBasicMenu_Run(int32_t cardIndex, int32_t module, uint32_t modid); This function manages the main loop of the application, displaying measurements and querying user commands.

  3. Measurement Display: c static void DLBasicMenu_DisplayMeasurements(int32_t cardIndex, int32_t module, int32_t modid); This function retrieves and displays measurements from the DL module, showing various parameters such as mode, reference voltage, position, frequency, current, and power state.

  4. Settings Update Functions:

    • Power State: c static bool_t DLBasicMenu_SetPowerState(int32_t cardIndex, int32_t module, int32_t channel);

    • Channel Output: c static nai_status_t DLBasicMenu_SetChannelOutput(int32_t paramCount, int32_t* p_params);

    • Position: c static nai_status_t DL_BasicMenu_SetPosition(int32_t paramCount, int32_t* p_params);

    • Configuration: c static nai_status_t DL_BasicMenu_SetConfiguration(int32_t paramCount, int32_t* p_params);

Functionality Breakdown: 1. Main Loop: - Initializes and runs the board menu using naiapp_RunBoardMenu. - Continuously queries the user for card index and module number. - Runs the DLBasicMenu_Run function for the selected module. - Provides options for restarting or quitting the application.

  1. DLBasicMenu_Run Loop:

    • Displays measurement data using DLBasicMenu_DisplayMeasurements.

    • Loads and displays menu commands.

    • Handles user command input and executes corresponding functions.

  2. Measurement Display:

    • Uses various naibrd API functions to fetch and display module-specific parameters.

    • Supports both decimal and hexadecimal display modes, configurable by the user.

  3. Configuration and Settings Functions:

    • Each function queries the user for the relevant input, processes the data, and updates the module settings via naibrd API calls.

    • Examples include setting power states, configuring output modes, and updating channel positions.

Conclusion This sample application demonstrates basic interaction with NAI’s DL module, providing a user-friendly interface to query and modify settings. It shows how to leverage NAI’s SSK to interact with embedded function modules, handle user inputs, and perform necessary configurations and measurements.

#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_dl.h"

#if !defined (TRUE)
#define TRUE   1
#endif
#if !defined (FALSE)
#define FALSE   0
#endif

static const int8_t *SAMPLE_PGM_NAME = (int8_t*) "DL Module Basic Operation Program";
static const int8_t *CONFIG_FILE = (int8_t*) "default_DL_BasicOps.txt";
static bool_t displayHex = FALSE;

static bool_t DLBasicMenu_Run(int32_t cardIndex, int32_t module, uint32_t modid);
static void DLBasicMenu_DisplayMeasurements(int32_t cardIndex, int32_t module, int32_t modid);
static bool_t DLBasicMenu_SetPowerState(int32_t cardIndex, int32_t module, int32_t channel);
static nai_status_t DLBasicMenu_SetChannelOutput(int32_t paramCount, int32_t* p_params);
static nai_status_t DL_BasicMenu_SetPosition(int32_t paramCount, int32_t* p_params);
static nai_status_t DL_BasicMenu_SetConfiguration(int32_t paramCount, int32_t* p_params);

enum dl_basicOpsMenu_commands
{
   DL_BASICMENU_CMD_SET_POWER_STATE,
   DL_BASICMENU_CMD_SET_CHANNEL_OUTPUT,
   DL_BASICMENU_CMD_SET_POSITION,
   DL_BASICMENU_CMD_SET_CONFIGURATION,
   DL_BASICMENU_CMD_SET_DISPLAY_HEX,
   DL_BASICMENU_CMD_COUNT
};

naiapp_cmdtbl_params_t DL_BasicOpsMenuCmds[] =
{
   {"1",   "Set Power State",                     DL_BASICMENU_CMD_SET_POWER_STATE,      NULL                         },
   {"2",   "Set Channel Output (Gen 2/3 only)",   DL_BASICMENU_CMD_SET_CHANNEL_OUTPUT,   DLBasicMenu_SetChannelOutput },
   {"3",   "Set Position",                        DL_BASICMENU_CMD_SET_POSITION,         DL_BasicMenu_SetPosition     },
   {"4",   "Set Configuration",                   DL_BASICMENU_CMD_SET_CONFIGURATION,    DL_BasicMenu_SetConfiguration},
   {"5",   "Set Display Mode",                    DL_BASICMENU_CMD_SET_DISPLAY_HEX,      NULL                         }
};

#if defined (__VXWORKS__)
int32_t DL_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))
               {
                  DLBasicMenu_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;
}

static bool_t DLBasicMenu_Run(int32_t cardIndex, int32_t module, uint32_t modid)
{
   bool_t bQuit = FALSE;
   bool_t bCmdFound = FALSE;
   int32_t MAX_CHANNELS = naibrd_DL_GetChannelCount(modid);
   int32_t cmd;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;
   naiapp_AppParameters_t  dl_params;
   p_naiapp_AppParameters_t dl_basicops_params = &dl_params;
   dl_basicops_params->cardIndex = cardIndex;
   dl_basicops_params->module = module;
   dl_basicops_params->modId = modid;

   naiapp_utils_LoadParamMenuCommands(DL_BASICMENU_CMD_COUNT, DL_BasicOpsMenuCmds);

   printf("\n\n\n\n");
   do
   {
      DLBasicMenu_DisplayMeasurements(cardIndex, module, modid);
      naiapp_display_ParamMenuCommands((int8_t*)SAMPLE_PGM_NAME);
      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)
         {
            switch (cmd)
            {
               case DL_BASICMENU_CMD_SET_POWER_STATE:
                  naiapp_query_ChannelNumber(MAX_CHANNELS, 1, &dl_basicops_params->channel);
                  bQuit = DLBasicMenu_SetPowerState(cardIndex, module, dl_basicops_params->channel);
                  break;
               case DL_BASICMENU_CMD_SET_CHANNEL_OUTPUT:
               case DL_BASICMENU_CMD_SET_POSITION:
               case DL_BASICMENU_CMD_SET_CONFIGURATION:
                  naiapp_query_ChannelNumber(MAX_CHANNELS, 1, &dl_basicops_params->channel);
                  DL_BasicOpsMenuCmds[cmd].func(APP_PARAM_COUNT, (int32_t*)dl_basicops_params);
                  break;
               case DL_BASICMENU_CMD_SET_DISPLAY_HEX:
                  printf("\n 0 for DECIMAL, 1 for HEX: ");
                  bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
                  if (atoi((char*)inputBuffer) == 0)
                  {
                     displayHex = FALSE;
                  }
                  else
                  {
                     displayHex = TRUE;
                  }
                  break;
            }
         }
      }
   } while (!bQuit);

   return bQuit;
}

static void DLBasicMenu_DisplayMeasurements(int32_t cardIndex, int32_t module, int32_t modid)
{
   int32_t channel = 0, MAX_CHANNEL = naibrd_DL_GetChannelCount(modid);

   printf("\n============================");
   printf("\n====Display Measurements====");
   printf("\n============================\n\n");

   if (displayHex == FALSE)
   {
      printf("%7s%8s%14s%14s%12s%14s%13s%13s%8s%8s%10s%9s\n", "Chan", "Mode", "Exp.Ref(V)", "Exp.Sig(V)", "Position", "W.Position", "Ref Volt.", "Sig Volt.", "Freq", "Curr", "Output", "Power");
      for (channel = 1; channel <= MAX_CHANNEL; channel++)
      {
         nai_dl_wire_mode_type_t outWireMode = 0;
         float64_t outExpRefVolt = 0;
         float64_t outExpSigVolt = 0;
         float64_t outPosition = 0;
         float64_t outWrapPosition = 0;
         float64_t outRefVolt = 0;
         float64_t outSigVolt = 0;
         float64_t outFreq = 0;
         float64_t outCurr = 0;
         nai_dl_vll_mode_type_t outOutputState = 0;
         nai_dl_on_off_t outPowerSupplyState = 0;

         naibrd_DL_GetWireMode(cardIndex, module, channel, &outWireMode);
         naibrd_DL_GetConfigurationValue(cardIndex, module, channel, NAI_DL_CONFIGURATION_REF_VOLT, &outExpRefVolt);
         naibrd_DL_GetConfigurationValue(cardIndex, module, channel, NAI_DL_CONFIGURATION_VLL_VOLT, &outExpSigVolt);
         naibrd_DL_GetPosition(cardIndex, module, channel, DL_SUBCHANNEL_A, &outPosition);
         naibrd_DL_GetMeasuredValue(cardIndex, module, channel, NAI_DL_MEASURED_WRAP_POSITION_SUBCHANNEL_A, &outWrapPosition);
         naibrd_DL_GetMeasuredValue(cardIndex, module, channel, NAI_DL_MEASURED_REF_VOLTAGE, &outRefVolt);
         naibrd_DL_GetMeasuredValue(cardIndex, module, channel, NAI_DL_MEASURED_VLL_VOLTAGE, &outSigVolt);
         naibrd_DL_GetMeasuredValue(cardIndex, module, channel, NAI_DL_MEASURED_REF_FREQUENCY, &outFreq);
         naibrd_DL_GetMeasuredValue(cardIndex, module, channel, NAI_DL_MEASURED_SIGNAL_CURRENT, &outCurr);
         naibrd_DL_GetOutputMode(cardIndex, module, channel, &outOutputState);
         naibrd_DL_GetPowerSupplyState(cardIndex, module, channel, &outPowerSupplyState);

         printf("%4d     ", channel);
         switch (outWireMode)
         {
            case NAI_DL_2WIRE_MODE:
               printf("%5s", "2-WI");
               break;
            case NAI_DL_4WIRE_MODE:
               printf("%5s", "4-WI");
               break;
            default:
               printf("%5s", "N/A");
               break;
         }
         printf("     %7.3f   %11.3f    %10.3f   %10.3f   %10.3f   %10.3f%9.0f    %5.0f   ", outExpRefVolt, outExpSigVolt, outPosition, outWrapPosition, outRefVolt, outSigVolt, outFreq, outCurr);
         switch (outOutputState)
         {
         case NAI_DL_VLL_MODE_RATIO:
            printf("%6s   ", "RATIO");
            break;
         case NAI_DL_VLL_MODE_FIXED:
            printf("%6s   ", "FIXED");
            break;
         }
         switch (outPowerSupplyState)
         {
            case DL_OFF:
               printf("%5s", "OFF");
               break;
            case DL_ON:
               printf("%5s", "ON");
               break;
         }

         printf("\n");
      }
   }
   else
   {
      printf("%7s%8s%14s%14s%12s%16s%13s%14s%9s%11s%11s%7s\n", "Chan", "Mode", "Exp.Ref(V)", "Exp.Sig(V)", "Position", "W.Position", "Ref Volt.", "Sig Volt.", "Freq", "Curr", "Output", "Power");
      for (channel = 1; channel <= MAX_CHANNEL; channel++)
      {

         nai_dl_wire_mode_type_t outWireMode = 0;
         uint32_t outExpRefVolt = 0;
         uint32_t outExpVllVolt = 0;
         uint32_t outPosition = 0;
         uint32_t outWrapPosition = 0;
         uint32_t outWrapRefVolt = 0;
         uint32_t outWrapVllVolt = 0;
         uint32_t outFreq = 0;
         uint32_t outCurr = 0u;
         nai_dl_vll_mode_type_t outOutputState = 0;
         nai_dl_on_off_t outPowerSupplyState = 0;

         naibrd_DL_GetWireMode(cardIndex, module, channel, &outWireMode);
         naibrd_DL_GetRawValueByChannel(cardIndex, module, channel, NAI_DL_RAW_WRAP_REF_VOLT, &outWrapRefVolt);
         naibrd_DL_GetRawValueByChannel(cardIndex, module, channel, NAI_DL_RAW_WRAP_VLL_VOLT, &outWrapVllVolt);
         naibrd_DL_GetRawValueByChannel(cardIndex, module, channel, NAI_DL_RAW_POSITION_SUBCHANNEL_A, &outPosition);
         naibrd_DL_GetRawValueByChannel(cardIndex, module, channel, NAI_DL_RAW_WRAP_POSITION_SUBCHANNEL_A, &outWrapPosition);
         naibrd_DL_GetRawValueByChannel(cardIndex, module, channel, NAI_DL_RAW_REF_VOLT, &outExpRefVolt);
         naibrd_DL_GetRawValueByChannel(cardIndex, module, channel, NAI_DL_RAW_VLL_VOLT, &outExpVllVolt);
         naibrd_DL_GetRawValueByChannel(cardIndex, module, channel, NAI_DL_RAW_WRAP_REF_FREQ, &outFreq);
         naibrd_DL_GetRawValueByChannel(cardIndex, module, channel, NAI_DL_RAW_WRAP_CURRENT_SUBCHANNEL_A, &outCurr);
         naibrd_DL_GetOutputMode(cardIndex, module, channel, &outOutputState);
         naibrd_DL_GetPowerSupplyState(cardIndex, module, channel, &outPowerSupplyState);

         printf("%4d     ", channel);
         switch (outWireMode)
         {
         case NAI_DL_2WIRE_MODE:
            printf("%5s", "2-WI");
            break;
         case NAI_DL_4WIRE_MODE:
            printf("%5s", "4-WI");
            break;
         default:
            printf("%5s", "N/A");
            break;
         }
         printf("     0x%08X    0x%08X   0x%08X     0x%08X   0x%08X    0x%08X  0x%08X 0x%08X ", outExpRefVolt, outExpVllVolt, outPosition, outWrapPosition, outWrapRefVolt, outWrapVllVolt, outFreq, outCurr);
         switch (outOutputState)
         {
         case NAI_DL_VLL_MODE_RATIO:
            printf("%6s ", "RATIO");
            break;
         case NAI_DL_VLL_MODE_FIXED:
            printf("%6s ", "FIXED");
            break;
         }
         switch (outPowerSupplyState)
         {
         case DL_OFF:
            printf("%5s", "OFF");
            break;
         case DL_ON:
            printf("%5s", "ON");
            break;
         }

         printf("\n");

      }
   }

   printf("\n%7s%4s%4s%4s%4s\n", "Chan", "BIT", "SIG", "REF", "PLL");
   for (channel = 1; channel <= MAX_CHANNEL; channel++)
   {

      nai_dl_module_status_t bitStatus = 0;
      nai_dl_module_status_t signalLoss = 0;
      nai_dl_module_status_t refStatus = 0;
      nai_dl_module_status_t pllStatus = 0;

      naibrd_DL_GetStatus(cardIndex, module, channel, NAI_DL_STATUS_BIT, &bitStatus);
      naibrd_DL_GetStatus(cardIndex, module, channel, NAI_DL_STATUS_SIGNAL_LOSS, &signalLoss);
      naibrd_DL_GetStatus(cardIndex, module, channel, NAI_DL_STATUS_REF_LOSS, &refStatus);
      naibrd_DL_GetStatus(cardIndex, module, channel, NAI_DL_STATUS_PLL, &pllStatus);

      printf("%4d%5d%4d%4d%4d\n", channel, bitStatus, signalLoss, refStatus, pllStatus);

   }
}
static bool_t DLBasicMenu_SetPowerState(int32_t cardIndex, int32_t module, int32_t channel)
{
   bool_t bQuit = FALSE;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

   printf("\n 0 for OFF, 1 for ON: ");
   bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   naibrd_DL_SetPowerSupplyState(cardIndex, module, channel, (nai_dl_on_off_t)atoi((char*)inputBuffer));

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

   printf("\n 0 for OFF, 1 for ON: ");
   bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   naibrd_DL_SetConfigurationValue(cardIndex, module, channel, NAI_DL_CONFIGURATION_OUTPUT_MODE, (nai_dl_enabled_disabled_t)atoi((char*)inputBuffer));

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}
static nai_status_t DL_BasicMenu_SetPosition(int32_t paramCount, int32_t* p_params)
{
   p_naiapp_AppParameters_t p_dl_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = p_dl_params->cardIndex;
   int32_t module = p_dl_params->module;
   int32_t channel = p_dl_params->channel;
   bool_t bQuit = FALSE;
   int32_t positionType = 0;
   float64_t value = 0.0;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

   printf("\n Select Position to set (0 for 4-Wire Position, 1 for 2-Wire Position A, 2 for 2-Wire Position B): ");
   bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   if (bQuit == FALSE)
   {
      positionType = atoi((char*)inputBuffer);

      switch (positionType)
      {
         case 0:
         case 1:
            printf("\n Enter Position Value to set: ");
            bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
            value = atof((char*)inputBuffer);
            naibrd_DL_SetPosition(cardIndex, module, channel, DL_SUBCHANNEL_A, value);
         break;
         case 2:
            printf("\n Enter Position Value to set: ");
            bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
            value = atof((char*)inputBuffer);
            naibrd_DL_SetPosition(cardIndex, module, channel, DL_SUBCHANNEL_B, value);
         break;
         default:
            printf("\n Invalid selection entered!\n");
            bQuit = TRUE;
         break;
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}
static nai_status_t DL_BasicMenu_SetConfiguration(int32_t paramCount, int32_t* p_params)
{
   p_naiapp_AppParameters_t p_dl_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = p_dl_params->cardIndex;
   int32_t module = p_dl_params->module;
   int32_t channel = p_dl_params->channel;
   bool_t bQuit = FALSE;
   int32_t configurationType = 0;
   float64_t value = 0;
   int32_t iValue = 0;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

   printf("\n Select Configuration (0 Wire Mode, 1 Output Mode, 2 Exp Ref, 3 Exp VLL, 4 Ref Thresh, 5 VLL Thresh A, 6 VLL Thresh B, 7 Current Thresh A, 8 Current Thresh B, 9 Phase): ");
   bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   if (bQuit == FALSE)
   {
      configurationType = atoi((char*)inputBuffer);

      switch (configurationType)
      {
         case 0:
            printf("\n Enter Wire Mode (1 for 4-Wire Mode, 2 for 2-Wire Mode): ");
            bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
            if (bQuit == FALSE)
            {
               iValue = atoi((char*)inputBuffer);
               naibrd_DL_SetWireMode(cardIndex, module, channel, (nai_dl_wire_mode_type_t)iValue);
            }
         break;
         case 1:
            printf("\n Enter Output Mode (0 for Ratio Mode, 1 for Fixed Mode): ");
            bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
            if (bQuit == FALSE)
            {
               iValue = atoi((char*)inputBuffer);
               naibrd_DL_SetOutputMode(cardIndex, module, channel, (nai_dl_vll_mode_type_t)iValue);
            }
         break;
         case 2:
            printf("\n Enter Value: ");
            bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
            if (bQuit == FALSE)
            {
               value = atof((char*)inputBuffer);
               naibrd_DL_SetConfigurationValue(cardIndex, module, channel, NAI_DL_CONFIGURATION_REF_VOLT, value);
            }
         break;
         case 3:
            printf("\n Enter Value: ");
            bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
            if (bQuit == FALSE)
            {
               value = atof((char*)inputBuffer);
               naibrd_DL_SetConfigurationValue(cardIndex, module, channel, NAI_DL_CONFIGURATION_VLL_VOLT, value);
            }
         break;
         case 4:
            printf("\n Enter Value: ");
            bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
            if (bQuit == FALSE)
            {
               value = atof((char*)inputBuffer);
               naibrd_DL_SetConfigurationValue(cardIndex, module, channel, NAI_DL_CONFIGURATION_THRESHOLD_REF_VOLT, value);
            }
         break;
         case 5:
            printf("\n Enter Value: ");
            bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
            if (bQuit == FALSE)
            {
               value = atof((char*)inputBuffer);
               naibrd_DL_SetConfigurationValue(cardIndex, module, channel, NAI_DL_CONFIGURATION_THRESHOLD_VLL_VOLT, value);
            }
         break;
         case 6:
            printf("\n Enter Value: ");
            bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
            if (bQuit == FALSE)
            {
               value = atof((char*)inputBuffer);
               naibrd_DL_SetConfigurationValue(cardIndex, module, channel, NAI_DL_CONFIGURATION_THRESHOLD_VLL_VOLT_SUBCHANNEL_B, value);
            }
         break;
         case 7:
            printf("\n Enter Value: ");
            bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
            if (bQuit == FALSE)
            {
               value = atof((char*)inputBuffer);
               naibrd_DL_SetConfigurationValue(cardIndex, module, channel, NAI_DL_CONFIGURATION_THRESHOLD_CURRENT_SUBCHANNEL_A, value);
            }
         break;
         case 8:
            printf("\n Enter Value: ");
            bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
            if (bQuit == FALSE)
            {
               value = atof((char*)inputBuffer);
               naibrd_DL_SetConfigurationValue(cardIndex, module, channel, NAI_DL_CONFIGURATION_THRESHOLD_CURRENT_SUBCHANNEL_B, value);
            }
         break;
         case 9:
            printf("\n Enter Value: ");
            bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
            if (bQuit == FALSE)
            {
               value = atof((char*)inputBuffer);
               naibrd_DL_SetConfigurationValue(cardIndex, module, channel, NAI_DL_CONFIGURATION_PHASE_OFFSET, value);
            }
         break;
         default:
            printf("\n Invalid Selection Entered!\n");
            bQuit = TRUE;
         break;
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

Help Bot

X