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

nai ad utils

nai ad utils

Explanation

Application Overview

This program is a sample application to interact with embedded function modules provided by North Atlantic Industries (NAI). The code primarily deals with Analog-to-Digital (AD) module configuration, user input handling, and data manipulation.

Definitions and Inclusions

  1. Header Files:

    • Standard headers like stdio.h, ctype.h, stdlib.h, string.h, stdint.h for basic C functionalities.

    • NAI-specific headers like naiapp_boardaccess_menu.h, naiapp_boardaccess_query.h, etc., encapsulating board access, querying, accessing, and display utilities.

    • nai_ad_utils.h provides utilities specific to AD modules.

    • nai.h, naibrd.h, naibrd_ad.h handles NAI board and module specifications.

Global Variables

  • Module Ranges: Arrays defining different voltage ranges for various AD modules for potential future use.

Helper Functions for AD

  1. ADModule_getInput:

    • Captures user input and converts it into a uint32_t value if valid. Returns a boolean indicating success.

  2. ADModule_getModuleIDName:

    • Converts module ID to a human-readable module name.

  3. ADModule_validRangeCode:

    • Verifies if the given range code is valid for the specified AD module. Returns true if valid.

  4. ADModule_isGeneration5:

    • Checks if a module ID belongs to generation 5.

  5. ADModule_isGeneration3:

    • Checks if a module ID belongs to generation 3.

  6. ADModule_getSamplesInFifo:

    • Determines the number of samples held in the FIFO buffer for given buffer control settings and word count.

  7. ADModule_getBufferControls:

    • Retrieves the current buffer control settings and assigns them to an array of booleans.

  8. ADModule_printSamplesInFifo:

    • Reads from the FIFO buffer and prints the data to both the screen and a specified file. Handles multiple buffer control configurations.

  9. ADModule_GetHexPolarityRange:

    • Manages user input for setting polarity and range configurations for AD modules. Retrieves and verifies the user’s hex input.

  10. ADUtils_GetPolarityRange:

    • Another utility for handling user input for polarity and range settings. Provides options based on module ID and stored range arrays.

  11. ADModule_printRangeOptions:

    • Displays the range options available for the current module.

  12. ADModule_getRangeOptions:

    • Returns the voltage range options available for a specific module ID. Assigns the pointer to these ranges and sets the number of ranges.

  13. ADModule_printC3RangeOptions:

    • Displays the range options specifically for the C3 module.

  14. ADModule_printKARangeOptions:

    • Displays the range options specifically for the KA module.

Enumerations and Helper Definitions

  • bool_t: Typically a boolean type defined in the included NAI headers.

  • nai_ad_mode_t, nai_ad_range_mode_t: Enumerations defining modes and range modes for AD modules.

  • NAI_MODULE_ID_C1, NAI_MODULE_ID_AD1, etc.: Constants representing module IDs for different NAI modules.

Conclusion

This sample code demonstrates how to handle user inputs, configure AD module settings, validate range codes, handle different generations of modules, and retrieve samples from FIFO buffers. It showcases interaction with hardware through module IDs, buffer controls, and voltage ranges, allowing extensive flexibility and control over AD functionalities. The utility and helper functions provide a comprehensive and interactive way to manage NAI’s embedded function modules effectively.

#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.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"

/* Common AD Sample Program include files */
#include "nai_ad_utils.h"

/* naibrd include files */
#include "nai.h"
#include "naibrd.h"
#include "functions/naibrd_ad.h"

/*Future use*/
/*
static float ca_module_ranges[] = {10.00, 5.00, 2.50, 1.25};
static float cx_module_ranges[] = {10.00, 5.00, 2.50, 1.25};
*/

/*Future use*/
static float64_t ad1_module_ranges[] = { 10.00, 05.00, 02.50, 01.25 };
static float64_t ad2_module_ranges[] = { 100.0, 50.00, 25.00, 12.50 };
static float64_t ad3_module_ranges[] = { 25.00 };
static float64_t ad4_module_ranges[] = { 10.00, 05.00, 02.50, 01.25 };
static float64_t ad4_module_current_ranges[] = { 25.00 };
static float64_t ad5_module_ranges[] = { 50.00, 25.00, 12.50, 06.25 };
static float64_t ad6_module_ranges[] = { 100.0, 50.00, 25.00, 12.50 };
static float64_t ade_module_ranges[] = { 10.00, 05.00, 02.50, 01.25 };
static float64_t adf_module_ranges[] = { 100.0, 50.00, 25.00, 12.50 };
static float64_t adg_module_ranges[] = { 25.00 };

/*****************************************************************************/
/***                      AD Helper Functions                              ***/
/*****************************************************************************/
/*****************************************************************************/
/**
<summary>
ADModule_getInput assigns "value" the decimal value the user input.
</summary>
*/
/*****************************************************************************/
bool_t ADModule_getInput(uint32_t *inputValue)
{
   int8_t userInputString[15];

   memset(userInputString, 0x00, sizeof(userInputString));
   fgets((char *)userInputString, sizeof(userInputString), stdin);
   if ('\0' != userInputString[0])
   {
      sscanf((char *)userInputString, "%d", inputValue);
      return TRUE;
   }
   else
      return FALSE;
}
/*****************************************************************************/
/**
<summary>
ADModule_getModuleIDName assigns char* moduleIDName the corresponding string value of
the current module's name.
</summary>
*/
/*****************************************************************************/
void ADModule_getModuleIDName(uint32_t modid, char *moduleIDName)
{
   switch (modid)
   {
   case NAI_MODULE_ID_C1: strcpy(moduleIDName, " C1"); break;
   case NAI_MODULE_ID_C2: strcpy(moduleIDName, " C2"); break;
   case NAI_MODULE_ID_C3: strcpy(moduleIDName, " C3"); break;
   case NAI_MODULE_ID_C4: strcpy(moduleIDName, " C4"); break;
   case NAI_MODULE_ID_CA: strcpy(moduleIDName, " CA"); break;
   case NAI_MODULE_ID_CX: strcpy(moduleIDName, " CX"); break;
   case NAI_MODULE_ID_KA: strcpy(moduleIDName, " KA"); break;
   case NAI_MODULE_ID_AD1: strcpy(moduleIDName, "AD1"); break;
   case NAI_MODULE_ID_AD2: strcpy(moduleIDName, "AD2"); break;
   case NAI_MODULE_ID_AD3: strcpy(moduleIDName, "AD3"); break;
   case NAI_MODULE_ID_AD4: strcpy(moduleIDName, "AD4"); break;
   case NAI_MODULE_ID_AD5: strcpy(moduleIDName, "AD5"); break;
   case NAI_MODULE_ID_AD6: strcpy(moduleIDName, "AD6"); break;
   case NAI_MODULE_ID_ADE: strcpy(moduleIDName, "ADE"); break;
   case NAI_MODULE_ID_ADF: strcpy(moduleIDName, "ADF"); break;
   case NAI_MODULE_ID_ADG: strcpy(moduleIDName, "ADG"); break;
   default: strcpy(moduleIDName, "???"); break;
   }
}
/*****************************************************************************/
/**
<summary>
ADModule_validRangeCode checks if the user input is equal to one of the AD Module's
raw range data codes. Returns true if a valid raw data code was entered.
</summary>
*/
/*****************************************************************************/
bool_t ADModule_validRangeCode(uint32_t modid, uint32_t Range)
{
   bool_t validRange = FALSE;
   switch (modid)
   {
   case NAI_MODULE_ID_C1:
   case NAI_MODULE_ID_AD1:
   case NAI_MODULE_ID_AD2:
   case NAI_MODULE_ID_AD3:
   case NAI_MODULE_ID_AD4:
   case NAI_MODULE_ID_AD5:
   case NAI_MODULE_ID_AD6:
   case NAI_MODULE_ID_ADE:
   case NAI_MODULE_ID_ADF:
   case NAI_MODULE_ID_ADG:
      if ((Range >= 0x00 && Range <= 0x03) || (Range >= 0x10 && Range <= 0x13))
      {
         validRange = TRUE;
      }
   case NAI_MODULE_ID_CA:
      if (Range >= 0x02 && Range <= 0x08)
      {
         validRange = TRUE;
      }
      break;
   case NAI_MODULE_ID_KA:
      if (Range == 0x10 || Range == 0x11)
      {
         validRange = TRUE;
      }
      break;
   default:
      if (Range == 0x00 || Range == 0x01 || Range == 0x09 || Range == 0x0A ||
         Range == 0x10 || Range == 0x11 || Range == 0x19 || Range == 0x1A)
      {
         validRange = TRUE;
      }
   }
   return validRange;
}
/*****************************************************************************/
/**
<summary>
ADModule_isGeneration5 checks if the passed modid is a generation 5 AD module.
</summary>
*/
/*****************************************************************************/
bool_t ADModule_isGeneration5(uint32_t modid)
{
   switch (modid)
   {
   case NAI_MODULE_ID_AD1:
   case NAI_MODULE_ID_AD2:
   case NAI_MODULE_ID_AD3:
   case NAI_MODULE_ID_AD4:
   case NAI_MODULE_ID_AD5:
   case NAI_MODULE_ID_AD6:
   case NAI_MODULE_ID_ADE:
   case NAI_MODULE_ID_ADF:
   case NAI_MODULE_ID_ADG:
      return TRUE;
      break;
   default:
      return FALSE;
      break;
   }
}
/*****************************************************************************/
/**
<summary>
ADModule_isGeneration3 checks if the passed modid is a generation 3 AD module.
</summary>
*/
/*****************************************************************************/
bool_t ADModule_isGeneration3(uint32_t modid)
{
   switch (modid)
   {
   case NAI_MODULE_ID_C1:
   case NAI_MODULE_ID_C2:
   case NAI_MODULE_ID_C3:
   case NAI_MODULE_ID_C4:
   case NAI_MODULE_ID_CA:
   case NAI_MODULE_ID_CX:
   case NAI_MODULE_ID_KA:
      return TRUE;
      break;
   default:
      return FALSE;
      break;
   }
}
/*****************************************************************************/
/***             Handle User Input for Reading FIFO Buffer                 ***/
/*****************************************************************************/
/*****************************************************************************/
/**
<summary>
ADModule_getSamplesInFifo using the Buffer Control setting and FIFO word count
determines the number of samples held in the FIFO buffer.
</summary>
*/
/*****************************************************************************/
void ADModule_getSamplesInFifo(int32_t cardIndex, int32_t module, int32_t channel, uint32_t count, uint32_t *samplesInFifo)
{
   uint32_t wordsPerSample = 0, bufferCtrl;
   naibrd_AD_GetFIFOCtrl(cardIndex, module, channel, &bufferCtrl);

   if ((bufferCtrl & NAI_AD_FIFO_CTRL_TIMESTAMP) == NAI_AD_FIFO_CTRL_TIMESTAMP)
      wordsPerSample++;
   if ((bufferCtrl & NAI_AD_FIFO_CTRL_8BIT) == NAI_AD_FIFO_CTRL_8BIT)
      wordsPerSample++;
   if ((bufferCtrl & NAI_AD_FIFO_CTRL_16BIT) == NAI_AD_FIFO_CTRL_16BIT)
      wordsPerSample++;
   *samplesInFifo = count / wordsPerSample;
}
/*****************************************************************************/
/**
<summary>
ADModule_getBufferControls assigns to the passed boolean array BufferControls
the current buffer control settings. The enumerated buffer control options
should be used to index and access BufferControls.
</summary>
*/
/*****************************************************************************/
void ADModule_getBufferControls(int32_t cardIndex, int32_t module, int32_t channel, bool_t BufferControls[])
{
   uint32_t bufferCtrl;
   naibrd_AD_GetFIFOCtrl(cardIndex, module, channel, &bufferCtrl);

   if ((bufferCtrl & NAI_AD_FIFO_CTRL_TIMESTAMP) == NAI_AD_FIFO_CTRL_TIMESTAMP)
      BufferControls[TIME_STAMP] = TRUE;
   if ((bufferCtrl & NAI_AD_FIFO_CTRL_8BIT) == NAI_AD_FIFO_CTRL_8BIT)
      BufferControls[DATA_8BIT] = TRUE;
   if ((bufferCtrl & NAI_AD_FIFO_CTRL_16BIT) == NAI_AD_FIFO_CTRL_16BIT)
      BufferControls[DATA_16BIT] = TRUE;
}
/*****************************************************************************/
/**
<summary>
ADModule_printSamplesInFifo reads from the specified channel's FIFO buffer
"samplesToRead" number of samples, which it writes to the passed file.
Also prints to stdout the data read from the FIFO buffer.
</summary>
*/
/*****************************************************************************/
void ADModule_printSamplesInFifo(int32_t cardIndex, int32_t module, int32_t channel, uint32_t samplesToRead, bool_t Buffer_Controls[], const int8_t *fileName)
{
   uint32_t modid, modver, modrev, special;
   float64_t range;
   nai_ad_range_mode_t mode;
   nai_ad_range_t RawRange;
   FILE* fp;
   fp = fopen((const char *)fileName, "a+");
   if (fp == NULL)
   {
      fprintf(fp, "Failed to open \"%s\" file. Exiting.", fileName);
      exit(1);
   }

   naibrd_GetModuleInfo(cardIndex, module, &modid, &modver, &modrev, &special);
   naibrd_AD_GetRange(cardIndex, module, channel, &mode, &range);
   naibrd_AD_ConvertToVoltageRangeRaw(modid, mode, range, &RawRange);
   fprintf(fp, "DATA\t\tVOLTAGE\t\t");
   if (Buffer_Controls[TIME_STAMP])
      fprintf(fp, "TIME_STAMP");
   fprintf(fp, "\n");
   do
   {
      float64_t Voltage = 0;
      uint32_t Data16Hi = 0, Data8Lo = 0;
      uint32_t read, Data = 0;

      if (Buffer_Controls[DATA_16BIT] && Buffer_Controls[DATA_8BIT])
      {
         naibrd_AD_ReadFIFORaw32(cardIndex, module, channel, 1, &Data16Hi, &read);
         naibrd_AD_ReadFIFORaw32(cardIndex, module, channel, 1, &Data8Lo, &read);
         Data = (Data16Hi << 16) | Data8Lo;
         naibrd_AD_ConvertToVoltage(modid, RawRange, Data, &Voltage);   /* TEMP_DA does this function work for 24 bit nums??? */
      }
      else if (Buffer_Controls[DATA_16BIT])
      {
         naibrd_AD_ReadFIFORaw32(cardIndex, module, channel, 1, &Data16Hi, &read);
         Data = Data16Hi;
         naibrd_AD_ConvertToVoltage(modid, RawRange, Data, &Voltage);
      }
      fprintf(fp, "0x%08X\t%+7.6f\t", Data, Voltage);
      if (Buffer_Controls[TIME_STAMP])
      {
         naibrd_AD_ReadFIFORaw32(cardIndex, module, channel, 1, &Data16Hi, &read);
         fprintf(fp, " %d ", Data16Hi);
      }
      fprintf(fp, "\n");
      samplesToRead--;
   } while (samplesToRead > 0);

   if (fclose(fp) != 0)
      printf("Error closing the file \"%s\".", fileName);
}
/*****************************************************************************/
/***           Handle User Input for Range Selection Functions             ***/
/*****************************************************************************/
/**
<summary>
AD_GetPolarityRange displays the polarity and range settings available for
the ADModule_GetPolarityRange and handles the user input.
</summary>
*/
/*****************************************************************************/
void ADModule_GetHexPolarityRange(uint32_t cardIndex, int32_t module, nai_ad_mode_t *mode, float64_t *range)
{
   uint32_t rawrange = 0;
   bool_t receivedInput = FALSE;
   uint32_t modid, modver, modrev, special;
   char moduleIDName[] = "???";
   int8_t userInput[15];

   naibrd_GetModuleInfo(cardIndex, module, &modid, &modver, &modrev, &special);

   ADModule_getModuleIDName(modid, moduleIDName);

   printf("\nPlease select the range an polarity for this channel. Refer to the table\n");
   printf("  below for valid values \n\n");
   printf(" MODULE %s     Hex Code               Bit Registers      \n", moduleIDName);
   printf(" Range     |  Bipolar/Unipolar       |D4 | D3 | D2 | D1 | D0 |\n");
   switch (modid)
   {
   case NAI_MODULE_ID_C3: ADModule_printC3RangeOptions(); break;
   case NAI_MODULE_ID_KA: ADModule_printKARangeOptions(); break;
   default: ADModule_printRangeOptions(modid, *mode); break;
   }
   do {
      printf("\n\n * For bipolar/unipolar selection, program D4 as '0' for unipolar and '1' for\n     bipolar\n\n");
      printf("Please enter corresponding hex code for desired range: \n>>");
      memset(userInput, 0x00, sizeof(userInput));
      fgets((char*)userInput, sizeof(userInput), stdin);
      if ('\0' == userInput[0])
      {
         receivedInput = FALSE;
      }
      else
      {
         rawrange = naiapp_utils_HexStrToDecInt32(userInput);
         receivedInput = TRUE;
      }
   } while (!(receivedInput) || !(ADModule_validRangeCode(modid, rawrange)));
   naibrd_AD_ConvertToVoltageRange(modid, rawrange, mode, range);
}

void ADUtils_GetPolarityRange(uint32_t cardIndex, int32_t module, nai_ad_mode_t mode, nai_ad_range_mode_t* p_polarity, float64_t *p_range)
{
   float64_t *p_rangeOptions = NULL;
   int32_t numRanges = 0;
   int32_t rangeIndex = 0;
   int8_t userInput[15];
   bool_t done = FALSE;
   uint32_t modId;

   modId = naibrd_GetModuleID(cardIndex, module);
   ADModule_getRangeOptions(modId, mode, &p_rangeOptions, &numRanges);

   if (numRanges > 0)
   {
      do
      {
         printf("\nPlease select a range: ");
         for (rangeIndex = 0; rangeIndex < (numRanges - 1); rangeIndex++)
         {
            printf("%3.3lfV, ", p_rangeOptions[rangeIndex]);
         }
         printf("%3.3lfV.\n", p_rangeOptions[rangeIndex]);
         printf("Enter range:");
         memset(userInput, 0x00, sizeof(userInput));
         naiapp_fgets_stdin(userInput, sizeof(userInput));

         sscanf((const char*)userInput, "%lf", p_range);

         done = FALSE;
         for (rangeIndex = 0; (rangeIndex < numRanges) && (!done); rangeIndex++)
         {
            if (*p_range == p_rangeOptions[rangeIndex])
            {
               done = TRUE;
            }
         }
      } while (!done);

      /* AD4 Current mode only supports BiPolar, so don't prompt user to change the polarity */
      if ((modId != NAI_MODULE_ID_AD4)
         || ((modId == NAI_MODULE_ID_AD4) && (mode == NAI_AD_MODE_VOLTAGE)))
      {
         do
         {
            printf("\nEnter Polarity [B=Bipolar, U=Unipolar]:");
            memset(userInput, 0x00, sizeof(userInput));
            naiapp_fgets_stdin(userInput, sizeof(userInput));
            if (toupper(userInput[0]) == 'B')
            {
               *p_polarity = NAI_AD_RANGE_MODE_BIPOLAR;
               done = TRUE;
            }
            else if (toupper(userInput[0]) == 'U')
            {
               *p_polarity = NAI_AD_RANGE_MODE_UNIPOLAR;
               done = TRUE;
            }
            else
            {
               done = FALSE;
            }
         } while (!done);
      }
      else
      {
         *p_polarity = NAI_AD_GEN5_D0_RANGE_MODE_BIPOLAR;
      }
   }
   else
   {
      printf("\nNo ranges found, returning to menu..\n");
   }
   return;
}

/*****************************************************************************/
/**
<summary>
ADModule_printRangeOptions prints the range options for the current module.
</summary>
*/
/*****************************************************************************/
void ADModule_printRangeOptions(uint32_t modid, nai_ad_mode_t mode)
{
   float64_t *p_rangeOptions = NULL;
   int32_t numRanges = 0;
   ADModule_getRangeOptions(modid, mode, &p_rangeOptions, &numRanges);
   switch (modid)
   {
   case NAI_MODULE_ID_C2:
   case NAI_MODULE_ID_C4:
   case NAI_MODULE_ID_CA:
   case NAI_MODULE_ID_CX:
      printf("-----------------------------------------------------------------------------\n");
      printf(" %6.2fV   |    0x1A /  0x0A         | * |  1 |  0 |  1 | 0  |\n", p_rangeOptions[0]);
      printf(" %6.2fV   |    0x19 /  0x09         | * |  1 |  0 |  0 | 1  |\n", p_rangeOptions[1]);
      printf(" %6.2fV   |    0x10 /  0x00         | * |  0 |  0 |  0 | 0  |\n", p_rangeOptions[2]);
      printf(" %6.2fV   |    0x11 /  0x01         | * |  0 |  0 |  0 | 1  |\n", p_rangeOptions[3]);
      printf("-----------------------------------------------------------------------------\n");
      break;
   default:
      printf("-----------------------------------------------------------------------------\n");
      printf("  %6.2fV  |    0x10 /  0x00         | * |  0 |  0 |  0 | 0  |\n", p_rangeOptions[0]);
      printf("  %6.2fV  |    0x11 /  0x01         | * |  0 |  0 |  0 | 1  |\n", p_rangeOptions[1]);
      printf("  %6.2fV  |    0x12 /  0x02         | * |  0 |  0 |  1 | 0  |\n", p_rangeOptions[2]);
      printf("  %6.2fV  |    0x13 /  0x03         | * |  0 |  0 |  1 | 1  |\n", p_rangeOptions[3]);
      printf("-----------------------------------------------------------------------------\n");
      break;
   }
}
/*****************************************************************************/
/**
 * <summary>
 * ADUtils_getRangeOptions returns a pointer to an array of [4] containing
 * the current module's range options.
 * </summary>
 */
 /*****************************************************************************/
void ADModule_getRangeOptions(uint32_t modid, nai_ad_mode_t mode, float64_t** pp_ranges, int32_t* p_numRanges)

{
   switch (modid)
   {
#if defined (GEN2_3_SUPPORT)
   case NAI_MODULE_ID_C1: return c1_module_ranges; break;
   case NAI_MODULE_ID_C2: return c2_module_ranges; break;
   case NAI_MODULE_ID_C4:
   case NAI_MODULE_ID_CA:
   case NAI_MODULE_ID_CX: return c4_module_ranges; break;
#endif
   case NAI_MODULE_ID_AD1:
      *pp_ranges = ad1_module_ranges;
      *p_numRanges = 4;
      break;
   case NAI_MODULE_ID_AD2:
      *pp_ranges = ad2_module_ranges;
      *p_numRanges = 4;
      break;
   case NAI_MODULE_ID_AD3:
      *pp_ranges = ad3_module_ranges;
      *p_numRanges = 1;
      break;
   case NAI_MODULE_ID_AD4:
      if (mode == NAI_AD_MODE_VOLTAGE)
      {
         *pp_ranges = ad4_module_ranges;
         *p_numRanges = 4;
      }
      else if (mode == NAI_AD_MODE_CURRENT)
      {
         *pp_ranges = ad4_module_current_ranges;
         *p_numRanges = 1;
      }
      else
      {
         *pp_ranges = NULL;
         *p_numRanges = 0;
      }
      break;
   case NAI_MODULE_ID_AD5:
      *pp_ranges = ad5_module_ranges;
      *p_numRanges = 4;
      break;
   case NAI_MODULE_ID_AD6:
      *pp_ranges = ad6_module_ranges;
      *p_numRanges = 4;
      break;
   case NAI_MODULE_ID_ADE:
      *pp_ranges = ade_module_ranges;
      *p_numRanges = 4;
      break;
   case NAI_MODULE_ID_ADF:
      *pp_ranges = adf_module_ranges;
      *p_numRanges = 4;
      break;
   case NAI_MODULE_ID_ADG:
      *pp_ranges = adg_module_ranges;
      *p_numRanges = 4;
      break;
   default:
      *pp_ranges = (float64_t*)NULL;
      *p_numRanges = 0;
      break;
}

   return;
}

/*****************************************************************************/
/**
<summary>
ADModule_printC3RangeOptions() prints to stdout the various range options
available for the C3 module.
Can have its range set up to 2.5V for 25mA full scale, unipolar only.
</summary>
*/
/*****************************************************************************/
void ADModule_printC3RangeOptions()
{
   printf("-----------------------------------------------------------------------------\n");
   printf(" 2.50V     |    N/A  /  0x02         | X |  0 |  0 |  1 | 0  |\n");
   printf(" 1.25V     |    N/A  /  0x03         | X |  0 |  0 |  1 | 1  |\n");
   printf(" 0.625V    |    N/A  /  0x04         | X |  0 |  1 |  0 | 0  |\n");
   printf(" 0.312V    |    N/A  /  0x05         | X |  0 |  1 |  0 | 1  |\n");
   printf(" 0.156V    |    N/A  /  0x06         | X |  0 |  1 |  1 | 0  |\n");
   printf(" 0.078V    |    N/A  /  0x07         | X |  0 |  1 |  1 | 1  |\n");
   printf(" 0.039V    |    N/A  /  0x08         | X |  1 |  0 |  0 | 1  |\n");
   printf("-----------------------------------------------------------------------------\n");
}
/*****************************************************************************/
/**
<summary>
ADModule_printKARangeOptions() prints to stdout the various range options
available for the KA module.
</summary>
*/
/*****************************************************************************/
void ADModule_printKARangeOptions()
{
   printf("-----------------------------------------------------------------------------\n");
   printf(" 10.00V   |    0x10 /  0x00         | X |  0 |  0 |  0 | 0  |\n");
   printf("  5.00V   |    0x11 /  0x01         | X |  0 |  0 |  0 | 1  |\n");
   printf("-----------------------------------------------------------------------------\n");

}

Help Bot

X