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

CD Manual and Auto Burn

CD Manual and Auto Burn Sample Application (SSK 2.x)

Overview

The CD Manual and Auto Burn sample application demonstrates how to configure and execute controlled burn operations on cartridge destruct (CD) modules using the NAI Software Support Kit (SSK 2.x). It covers the complete burn workflow: setting resistance thresholds (fault, warning, and open), configuring per-channel energy settings, enabling channels, selecting between manual single-burn and automatic multi-burn modes, initiating the burn, and monitoring resistance status changes through polled status registers. While this sample does not use a traditional ISR callback like the DT or TTL interrupt samples, it uses status-driven monitoring to detect when burn operations complete or when resistance thresholds are crossed — a pattern that can be extended to interrupt-driven operation using the CD module’s status interrupt capabilities.

This sample supports the CD1 module type. It allows the user to select a range of channels, choose manual or auto burn mode, configure energy and threshold parameters, and observe the burn process through real-time and latched status polling. This pattern is new to SSK 2.x and has no SSK 1.x counterpart.

Note
Cartridge destruct operations are irreversible hardware actions. Exercise extreme caution when running this sample with live ordnance. Always verify channel assignments and energy settings before initiating a burn.

Prerequisites

Before running this sample, make sure you have:

  • An NAI board with a CD1 module installed.

  • SSK 2.x installed on your development host.

  • The sample applications built. Refer to the SSK 2.x Software Development Guide for platform-specific build instructions.

  • Appropriate safety procedures in place for any connected ordnance or test loads.

How to Run

Launch the cd_manual_and_auto_burn executable from your build output directory. On startup the application looks for a configuration file (default_CD_Manual_and_Auto_Burn.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. Once connected, you are prompted to select a channel range, then choose between Manual burn (single burn per initiation) or Auto burn (repeated burns up to a configurable count). The application configures resistance thresholds and energy settings, initiates the burn, and monitors status changes.

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 CD.

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

  1. Call naiapp_RunBoardMenu() to load a saved configuration file (if one exists) or present the interactive board menu.

  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_GetModuleName().

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

   if (naiapp_RunBoardMenu(DEF_CONFIG_FILE) == (bool_t)NAI_TRUE)
   {
      while (stop != NAI_TRUE)
      {
         stop = naiapp_query_CardIndex(naiapp_GetBoardCnt(), 0, &cardIndex);
         if (stop != NAI_TRUE)
         {
            check_status(naibrd_GetModuleCount(cardIndex, &moduleCnt));
            stop = naiapp_query_ModuleNumber(moduleCnt, 1, &module);
            if (stop != NAI_TRUE)
            {
               check_status(naibrd_GetModuleName(cardIndex, module, &moduleID));
               if ((moduleID != 0))
               {
                  naiapp_Run_CD_Manual_and_Auto_Burn(cardIndex, module, moduleID);
               }
            }
         }
      }
   }

   naiapp_access_CloseAllOpenCards();
   return 0;
}

Note the SSK 2.x differences from SSK 1.x in this startup sequence:

  • The VxWorks preprocessor guard in this sample uses __VXWORKS__ (most other SSK 2.x samples use NAIBSP_CONFIG_SOFTWARE_OS_VXWORKS).

  • The module identifier is retrieved with naibrd_GetModuleName() (SSK 1.x uses naibrd_GetModuleID()).

  • Boolean constants are NAI_TRUE / NAI_FALSE (SSK 1.x uses TRUE / FALSE).

  • Console output uses naiif_printf() from the platform abstraction layer (SSK 1.x uses printf() directly).

Important

Common connection errors you may encounter at this stage:

  • No board found — verify that the board is powered on and physically connected.

  • Connection timeout — confirm network settings or bus configuration.

  • Invalid card or module index — indices are zero-based for cards and one-based for modules.

  • Module not present at selected slot — the slot you selected does not contain a CD module.

Program Structure

Entry Point

On standard platforms (Petalinux) the entry point is main(). On VxWorks the entry point is naiapp_CD_Manual_and_Auto_Burn().

The startup flow:

  1. Connect to the board and select card and module.

  2. Call naiapp_Run_CD_Manual_and_Auto_Burn() which prompts for a channel range and burn mode.

  3. Call RunAutoOrManualBurn() which configures thresholds, energy, and initiates the burn operation.

User Interaction

naiapp_Run_CD_Manual_and_Auto_Burn() queries the user for:

  1. Channel range — minimum and maximum channel numbers via naiapp_query_ForChannelRange().

  2. Burn mode — 'M' for Manual or 'A' for Auto burn.

naiapp_query_ForChannelRange(&outMinChannel, &outMaxChannel,
   minChannel, maxChannel);

naiif_printf("Please press 'M' for Manual burn or 'A' for Auto Burn or 'q' to quit\r\n");

Resistance Threshold Configuration

Before initiating a burn, the sample configures three resistance thresholds for each channel:

/* Fault Resistance Threshold: below this value, a burn is needed */
status = naibrd_CD_SetChanFaultResistanceThreshold(cardIndex, module,
   channel, FAULT_RESISTANCE_THRESHOLD);

/* Warning Resistance Threshold */
status = naibrd_CD_SetChanWarningResistanceThreshold(cardIndex, module,
   channel, WARNING_RESISTANCE_THRESHOLD);

/* Open Resistance Threshold */
status = naibrd_CD_SetChanOpenResistanceThreshold(cardIndex, module,
   channel, OPEN_RESISTANCE_THRESHOLD);

The default threshold values are:

  • Fault — 150 ohms. If measured resistance drops below this value, the channel is in a fault condition.

  • Warning — 1000 ohms. Resistance below this value indicates the channel is approaching fault.

  • Open — 13000 ohms. Resistance above this value indicates an open circuit (no load connected).

Energy Configuration

Each channel’s burn energy is set before initiating:

status = naibrd_CD_SetChanEnergySetting(cardIndex, module, channel,
   BURN_ENERGY_SETTING);

The default energy setting is 1.25 (in module-specific units). This controls how much energy is delivered during each burn pulse.

Channel Enable and Status Enable

All channels in the selected range are enabled for operation, and per-channel status monitoring is enabled:

/* Enable all channels (using module-specific mask) */
if (modid == NAIBRD_MODULE_ID_CD1)
{
   status = naibrd_CD_SetEnabledChannels(cardIndex, module,
      NAIBRD_CD1_ALL_CHANNELS_MASK);
}

/* Enable status monitoring per channel */
status = naibrd_CD_SetChanStatusEnable(cardIndex, module, channel, NAI_TRUE);

Manual Burn Mode

In manual mode, the sample constructs a channel bitmask from the selected range and initiates a single burn:

uint32_t channelMask = 0;
for (channel = userMinChannel; channel <= userMaxChannel; channel++)
{
   channelMask |= (1 << (channel - 1));
}

status = naibrd_CD_InitiateManualBurnChannels(cardIndex, module, channelMask);

After initiation, naibrd_CD_GetManualBurnChannels() confirms which channels are actively burning. The user can press any key to burn again or 'Q' to quit.

Auto Burn Mode

In auto burn mode, the sample initiates automatic burns on all channels and sets a maximum burn count:

/* Initiate auto burn on all channels */
status = naibrd_CD_InitiateAutoBurnChannels(cardIndex, module,
   NAIBRD_CD1_ALL_CHANNELS_MASK);

/* Set maximum auto burn count per channel */
naibrd_CD_SetAutoBurnMaxCount(cardIndex, module, channel, AUTO_BURN_COUNT);

The default AUTO_BURN_COUNT is 3, meaning the module will automatically perform up to 3 burn attempts per channel.

Status Monitoring Loop

In auto burn mode, the sample enters an infinite polling loop that monitors resistance status changes:

for(;;)
{
   /* Read fault resistance status (real-time and latched) */
   status = naibrd_CD_GetChanMappedStatusRaw(cardIndex, module,
      NAIBRD_CD_STATUS_FAULT_RES_REALTIME, &outFaultResStatusRawRealTime);
   status = naibrd_CD_GetChanMappedStatusRaw(cardIndex, module,
      NAIBRD_CD_STATUS_FAULT_RES_LATCHED, &outFaultResStatusRawLatched);

   /* Read warning resistance status */
   status = naibrd_CD_GetChanMappedStatusRaw(cardIndex, module,
      NAIBRD_CD_STATUS_WARN_RES_REALTIME, &outWarnResStatusRawRealTime);
   status = naibrd_CD_GetChanMappedStatusRaw(cardIndex, module,
      NAIBRD_CD_STATUS_WARN_RES_LATCHED, &outWarnResStatusRawLatched);

   /* Read open resistance status */
   status = naibrd_CD_GetChanMappedStatusRaw(cardIndex, module,
      NAIBRD_CD_STATUS_OPEN_RES_REALTIME, &outOpenResStatusRawRealTime);
   status = naibrd_CD_GetChanMappedStatusRaw(cardIndex, module,
      NAIBRD_CD_STATUS_OPEN_RES_LATCHED, &outOpenResStatusRawLatched);

   /* Read auto burn count per channel */
   for (channel = userMinChannel; channel <= userMaxChannel; channel++)
   {
      status = naibrd_CD_GetAutoBurnCount(cardIndex, module, channel,
         &outAutoBurnCount[chanIndex]);
   }

   naiif_msDelay(250);
}

The loop only prints status when values change from the previous iteration, avoiding console flooding. It monitors:

  • Fault resistance — real-time and latched status indicating channels below the fault threshold.

  • Warning resistance — real-time and latched status indicating channels below the warning threshold.

  • Open resistance — real-time and latched status indicating channels above the open threshold.

  • Auto burn count — the number of burns completed per channel.

Troubleshooting Reference

This table summarizes common errors and symptoms. Consult the CD1 Manual for hardware-specific diagnostic procedures.

Error / Symptom Possible Causes Suggested Resolution

No board found or connection timeout

Board not powered, incorrect configuration file, network issue

Verify hardware is powered and connected. Check that default_CD_Manual_and_Auto_Burn.txt has correct settings.

Module not detected at selected slot

No module installed at the specified slot

Verify the slot contains a CD1 module

naibrd_CD_SetChanEnergySetting returns error

Invalid channel number or energy value out of range

Verify the channel is within the module’s valid range and the energy setting is within spec

All channels show open resistance status

No load connected to the channels

Connect appropriate test loads or ordnance to the selected channels

Auto burn count stays at zero

Burn not initiated, channels not enabled, or fault threshold already met

Verify naibrd_CD_InitiateAutoBurnChannels() was called and channels are enabled. Check that resistance is below the fault threshold to trigger a burn.

Manual burn does not fire

Channel mask incorrect or channels not enabled

Verify the channel mask includes the correct bits (1-based, bit 0 = channel 1)

Status monitoring shows no changes

No load change occurring, or thresholds set incorrectly

Verify threshold values are appropriate for the connected load resistance

Burn energy insufficient

Energy setting too low for the load

Increase the BURN_ENERGY_SETTING value and consult the CD1 Manual for recommended energy levels

Important

Safety Warning: Cartridge destruct operations deliver energy to connected loads. Always follow your organization’s ordnance safety procedures. Never run this sample with live ordnance connected unless all safety protocols are in place and the system has been verified with test loads.

Full Source

The complete source for this sample is provided below for reference. The sections above explain each part in detail.

Full Source — cd_manual_and_auto_burn.c (SSK 2.x)
#if defined (LINUX)
#include <pthread.h>
#endif

#if defined (__VXWORKS__)
#include <taskLib.h>
#endif
/* nailib include files */
#include "nai_libs/nailib/include/naitypes.h"
#include "nai_libs/nailib/include/nailib.h"
#include "nai_libs/nailib/include/nailib_utils.h"

/* naibrd include files */
#include "nai_libs/naibrd/include/naibrd.h"
#include "nai_libs/naibrd/include/functions/naibrd_cd.h"

/* naiif include files */
#include "nai_libs/naiif/include/naiif_stdio.h"

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

static const int8_t *DEF_CONFIG_FILE = (const int8_t*)"default_CD_Manual_and_Auto_Burn.txt";

/********************************/
/* Internal Function Prototypes */
/********************************/
static bool_t naiapp_Run_CD_Manual_and_Auto_Burn(int32_t cardIndex, int32_t module, uint32_t modid);
static bool_t RunAutoOrManualBurn(int32_t cardIndex, int32_t module, uint32_t modid, int32_t userMinChannel, int32_t userMaxChannel, bool_t bAutoBurn);

#define BURN_ENERGY_SETTING   1.25f
#define AUTO_BURN_COUNT        3
#define FAULT_RESISTANCE_THRESHOLD 150
#define WARNING_RESISTANCE_THRESHOLD 1000
#define OPEN_RESISTANCE_THRESHOLD 13000

#define CD_MAX_CHANNELS 6

/**************************************************************************************************************/
/**
* <summary>
* The purpose of the naiapp_Run_CD_Manual_and_Auto_Burn is to illustrate the methods to call in the naibrd library
* to configure the CD module and perform a Manual or Auto Burn.
* </summary>
*/
/**************************************************************************************************************/
#if defined (__VXWORKS__)
int32_t naiapp_CD_Manual_and_Auto_Burn(void)
#else
int32_t main(void)
#endif
{
   int32_t cardIndex;
   int32_t moduleCnt;
   int32_t module;
   bool_t  stop = NAI_FALSE;
   uint32_t moduleID = 0;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

   if (naiapp_RunBoardMenu(DEF_CONFIG_FILE) == (bool_t)NAI_TRUE)
   {
      while (stop != NAI_TRUE)
      {
         /* Select Card Index */
         stop = naiapp_query_CardIndex(naiapp_GetBoardCnt(), 0, &cardIndex);
         if (stop != NAI_TRUE)
         {
            check_status(naibrd_GetModuleCount(cardIndex, &moduleCnt));

            /* Select Module */
            stop = naiapp_query_ModuleNumber(moduleCnt, 1, &module);
            if (stop != NAI_TRUE)
            {
               check_status(naibrd_GetModuleName(cardIndex, module, &moduleID));
               if ((moduleID != 0))
               {
                  naiapp_Run_CD_Manual_and_Auto_Burn(cardIndex, module, moduleID);
               }
            }
         }

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

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

   naiapp_access_CloseAllOpenCards();

   return 0;
}

/**************************************************************************************************************/
/**
* <summary>
* naiapp_Run_CD_Manual_and_Auto_Burn
* This routine demonstrates the following API functions in the CD naibrd library to configure the CD module and perform
* a Manual or Auto Burn:
*
* naibrd_CD_SetEnabledChannels
* naibrd_CD_SetChanEnergySetting
* naibrd_CD_GetChanResistance
* naibrd_CD_SetChanFaultResistanceThreshold
* naibrd_CD_SetAutoBurnMaxCount
* naibrd_CD_InitiateAutoBurnChannels
* naibrd_CD_GetAutoBurnCount
* naibrd_CD_InitiateManualBurnChannels
* naibrd_CD_GetManualBurnChannels
* naibrd_CD_SetChanFaultResistanceThreshold
* naibrd_CD_SetChanWarningResistanceThreshold
* naibrd_CD_SetChanOpenResistanceThreshold
* naibrd_CD_SetChanStatusEnable
* naibrd_CD_GetChanMappedStatus
* </summary>
*/
/**************************************************************************************************************/
static bool_t naiapp_Run_CD_Manual_and_Auto_Burn(int32_t cardIndex, int32_t module, uint32_t modid)
{
   bool_t bQuit = NAI_FALSE, bAutoBurn = NAI_FALSE;
   int32_t minChannel = 1, outMinChannel, outMaxChannel;
   int32_t maxChannel = naibrd_CD_GetChannelCount(modid);
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

   naiapp_query_ForChannelRange(&outMinChannel, &outMaxChannel, minChannel, maxChannel);
   if (!bQuit)
   {
      /* Query user for Manual or Auto burn */
      do
      {
         naiif_printf("Please press 'M' for Manual burn or 'A' for Auto Burn or 'q' to quit\r\n");
         bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
         if ((!bQuit) && ((toupper(inputBuffer[0]) == 'A') || (toupper(inputBuffer[0]) == 'M')))
         {
            if (toupper(inputBuffer[0]) == 'A')
            {
               bAutoBurn = NAI_TRUE;
            }
            else if (toupper(inputBuffer[0]) == 'M')
            {
               bAutoBurn = NAI_FALSE;
            }

            bQuit = RunAutoOrManualBurn(cardIndex, module, modid, outMinChannel, outMaxChannel, bAutoBurn);
         }
      }while ((!bQuit) && (toupper(inputBuffer[0]) != 'A') && (toupper(inputBuffer[0]) != 'M'));
   }

   return bQuit;
}

static bool_t RunAutoOrManualBurn(int32_t cardIndex, int32_t module, uint32_t modid, int32_t userMinChannel, int32_t userMaxChannel, bool_t bAutoBurn)
{
   nai_status_t status;
   bool_t bQuit = NAI_FALSE, bContinue = NAI_TRUE;
   int32_t channel, minChannel = 1;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

   int32_t maxChannel = naibrd_CD_GetChannelCount(modid);

   uint32_t outAutoBurnCount[CD_MAX_CHANNELS], outTempAutoBurnCount[CD_MAX_CHANNELS];

   uint32_t outFaultResStatusRawRealTime = 0, outFaultResStatusRawLatched = 0, outWarnResStatusRawRealTime = 0,
      outWarnResStatusRawLatched = 0, outOpenResStatusRawRealTime = 0, outOpenResStatusRawLatched = 0;
   uint32_t outTempFaultResStatusRawRealTime = 0, outTempFaultResStatusRawLatched = 0, outTempWarnResStatusRawRealTime = 0,
      outTempWarnResStatusRawLatched = 0, outTempOpenResStatusRawRealTime = 0, outTempOpenResStatusRawLatched = 0;
   uint32_t outAutoBurnChannels;

   memset(outAutoBurnCount, 0, sizeof(outAutoBurnCount));
   memset(outTempAutoBurnCount, 0, sizeof(outTempAutoBurnCount));

   /* Configure all channels */
   for (channel = minChannel; channel <= maxChannel; channel++)
   {
      /*Specifies the given channel's Fault Resistance Threshold. If measured resistance drops below this value,
      a burn is needed */
      status = naibrd_CD_SetChanFaultResistanceThreshold(cardIndex, module, channel, FAULT_RESISTANCE_THRESHOLD);
      if (status != NAI_SUCCESS)
      {
         naiif_printf("Error: naibrd_CD_SetChanFaultResistanceThreshold Ch %d, status = %d", channel, status);
         return NAI_TRUE;
      }

      status = naibrd_CD_SetChanWarningResistanceThreshold(cardIndex, module, channel, WARNING_RESISTANCE_THRESHOLD);
      if (status != NAI_SUCCESS)
      {
         naiif_printf("Error: naibrd_CD_SetChanWarningResistanceThreshold Ch %d, status = %d", channel, status);
         return NAI_TRUE;
      }

      status = naibrd_CD_SetChanOpenResistanceThreshold(cardIndex, module, channel, OPEN_RESISTANCE_THRESHOLD);
      if (status != NAI_SUCCESS)
      {
         naiif_printf("Error: naibrd_CD_SetChanOpenResistanceThreshold Ch %d, status = %d", channel, status);
         return NAI_TRUE;
      }

      /* Specify energy settings for Burn */
      status = naibrd_CD_SetChanEnergySetting(cardIndex, module, channel, BURN_ENERGY_SETTING);
      if (status != NAI_SUCCESS)
      {
         naiif_printf("Error: naibrd_CD_SetChanEnergySetting Ch %d, status = %d", channel, status);
         return NAI_TRUE;
      }

      if (bAutoBurn)
      {
         if (channel == 1) /* execute once */
         {
            /* Initiate Auto Burn */
            if (modid == NAIBRD_MODULE_ID_CD1)
            {
               status = naibrd_CD_InitiateAutoBurnChannels(cardIndex, module, NAIBRD_CD1_ALL_CHANNELS_MASK);
            }
            else
            {
               if (modid == NAIBRD_MODULE_ID_CD2)
               {
                  status = naibrd_CD_InitiateAutoBurnChannels(cardIndex, module, NAIBRD_CD2_ALL_CHANNELS_MASK);
               }
            }
            if (status != NAI_SUCCESS)
            {
               naiif_printf("Error: naibrd_CD_InitiateManualBurnChannels, status = %d", status);
               return NAI_TRUE;
            }
            else
            {
               status = naibrd_CD_GetAutoBurnChannels(cardIndex, module, &outAutoBurnChannels);
               if (status != NAI_SUCCESS)
               {
                  naiif_printf("Error: naibrd_CD_GetAutoBurnChannels, status = %d", status);
                  return NAI_TRUE;
               }
               else
               {
                  naiif_printf("Auto Burn enabled channels: 0x%02X\r\n\r\n", outAutoBurnChannels);
               }
            }
         }

         /* Specifies the given channel's Auto Burn Max Count. Once Auto burn is initiated, it will burn up to the specified count*/
         naibrd_CD_SetAutoBurnMaxCount(cardIndex, module, channel, AUTO_BURN_COUNT);
         if (status != NAI_SUCCESS)
         {
            naiif_printf("Error: naibrd_CD_SetAutoBurnMaxCount Ch %d, status = %d", channel, status);
            return NAI_TRUE;
         }
      }
   }

   for (channel = userMinChannel; channel <= userMaxChannel; channel++)
   {
      if (channel == userMinChannel) /* call only once */
      {
         if (modid == NAIBRD_MODULE_ID_CD1)
         {
            status = naibrd_CD_SetEnabledChannels(cardIndex, module, NAIBRD_CD1_ALL_CHANNELS_MASK);
         }
         else
         {
            if (modid == NAIBRD_MODULE_ID_CD2)
            {
               status = naibrd_CD_SetEnabledChannels(cardIndex, module, NAIBRD_CD2_ALL_CHANNELS_MASK);
            }
         }
         if (status != NAI_SUCCESS)
         {
            naiif_printf("Error: naibrd_CD_SetEnabledChannels Ch %d, status = %d", channel, status);
            return NAI_TRUE;
         }
      }

      status = naibrd_CD_SetChanStatusEnable(cardIndex, module, channel, NAI_TRUE);
      if (status != NAI_SUCCESS)
      {
         naiif_printf("Error: naibrd_CD_SetChanStatusEnable Ch %d, status = %d", channel, status);
         return NAI_TRUE;
      }
   }

   do
   {
      if (bAutoBurn)
      {
         int32_t chanIndex = 0;

         for(;;)
         {
            outTempFaultResStatusRawRealTime = outFaultResStatusRawRealTime;
            outTempFaultResStatusRawLatched = outFaultResStatusRawLatched;

            outTempWarnResStatusRawRealTime = outWarnResStatusRawRealTime;
            outTempWarnResStatusRawLatched = outWarnResStatusRawLatched;

            outTempOpenResStatusRawRealTime = outOpenResStatusRawRealTime;
            outTempOpenResStatusRawLatched = outOpenResStatusRawLatched;

            status = naibrd_CD_GetChanMappedStatusRaw(cardIndex, module, NAIBRD_CD_STATUS_FAULT_RES_REALTIME, &outFaultResStatusRawRealTime);
            if (status != NAI_SUCCESS)
            {
               naiif_printf("Error: naibrd_CD_GetChanMappedStatusRaw, status = %d", status);
               return NAI_TRUE;
            }
            status = naibrd_CD_GetChanMappedStatusRaw(cardIndex, module, NAIBRD_CD_STATUS_FAULT_RES_LATCHED, &outFaultResStatusRawLatched);
            if (status != NAI_SUCCESS)
            {
               naiif_printf("Error: naibrd_CD_GetChanMappedStatusRaw, status = %d", status);
               return NAI_TRUE;
            }
            if ((outTempFaultResStatusRawRealTime != outFaultResStatusRawRealTime) || (outTempFaultResStatusRawLatched != outFaultResStatusRawLatched))
            {
               naiif_printf("Fault Resistance: Real Time Status: 0x%02X Latched Status: 0x%02X\r\n\r\n", outFaultResStatusRawRealTime, outFaultResStatusRawLatched);
            }

            status = naibrd_CD_GetChanMappedStatusRaw(cardIndex, module, NAIBRD_CD_STATUS_WARN_RES_REALTIME, &outWarnResStatusRawRealTime);
            if (status != NAI_SUCCESS)
            {
               naiif_printf("Error: naibrd_CD_GetChanMappedStatusRaw, status = %d", status);
               return NAI_TRUE;
            }

            status = naibrd_CD_GetChanMappedStatusRaw(cardIndex, module, NAIBRD_CD_STATUS_WARN_RES_LATCHED, &outWarnResStatusRawLatched);
            if (status != NAI_SUCCESS)
            {
               naiif_printf("Error: naibrd_CD_GetChanMappedStatusRaw, status = %d", status);
               return NAI_TRUE;
            }
            if ((outTempWarnResStatusRawRealTime != outWarnResStatusRawRealTime) || (outTempWarnResStatusRawLatched != outWarnResStatusRawLatched))
            {
               naiif_printf("Warning Resistance: Real Time Status: 0x%02X Latched Status: 0x%02X\r\n\r\n", outWarnResStatusRawRealTime, outWarnResStatusRawLatched);
            }

            status = naibrd_CD_GetChanMappedStatusRaw(cardIndex, module, NAIBRD_CD_STATUS_OPEN_RES_REALTIME, &outOpenResStatusRawRealTime);
            if (status != NAI_SUCCESS)
            {
               naiif_printf("Error: naibrd_CD_GetChanMappedStatusRaw, status = %d", status);
               return NAI_TRUE;
            }
            status = naibrd_CD_GetChanMappedStatusRaw(cardIndex, module, NAIBRD_CD_STATUS_OPEN_RES_LATCHED, &outOpenResStatusRawLatched);
            if (status != NAI_SUCCESS)
            {
               naiif_printf("Error: naibrd_CD_GetChanMappedStatusRaw, status = %d", status);
               return NAI_TRUE;
            }
            if ((outTempOpenResStatusRawRealTime != outOpenResStatusRawRealTime) || (outTempOpenResStatusRawLatched != outOpenResStatusRawLatched))
            {
               naiif_printf("Open Resistance: Real Time Status: 0x%02X Latched Status: 0x%02X\r\n\r\n", outOpenResStatusRawRealTime, outOpenResStatusRawLatched);
            }

            chanIndex = 0;

            for (channel = userMinChannel; channel <= userMaxChannel; channel++)
            {
               status = naibrd_CD_GetAutoBurnCount(cardIndex, module, channel, &outAutoBurnCount[chanIndex]);
               if (status != NAI_SUCCESS)
               {
                  naiif_printf("Error: Ch: %d naibrd_CD_GetAutoBurnCount, status = %d", channel, status);
                  return NAI_TRUE;
               }
               else
               {
                  if (outTempAutoBurnCount[chanIndex] != outAutoBurnCount[chanIndex])
                  {
                     naiif_printf("\r\nCh: %d Auto burn count: %d\r\n\r\n", channel, outAutoBurnCount[chanIndex]);
                  }
               }

               outTempAutoBurnCount[chanIndex] = outAutoBurnCount[chanIndex];

               chanIndex++;
            }

            naiif_msDelay(250);
         }
      }
      else
      {
         uint32_t channelMask = 0, outManualBurnMask = 0;

         for (channel = userMinChannel; channel <= userMaxChannel; channel++)
         {
            channelMask |= (1 << (channel - 1));
         }

         /* Initiate Manual Burn */
         status = naibrd_CD_InitiateManualBurnChannels(cardIndex, module, channelMask);
         if (status != NAI_SUCCESS)
         {
            naiif_printf("Error: naibrd_CD_InitiateManualBurnChannels, status = %d", status);
            return NAI_TRUE;
         }
         else
         {
            status = naibrd_CD_GetManualBurnChannels(cardIndex, module, &outManualBurnMask);
            if (status != NAI_SUCCESS)
            {
               naiif_printf("Error: naibrd_CD_GetManualBurnChannels, status = %d", status);
               return NAI_TRUE;
            }
            else
            {
               naiif_printf("Manual Burn initiated channels: 0x%02X\r\n\r\n", outManualBurnMask);
            }
         }
      }

      naiif_printf("\r\nPress any key to Burn again or Q to quit.");
      bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
      if (bQuit)
      {
         bContinue = NAI_FALSE;
      }

   } while ((bContinue) && (!bQuit));

   return bQuit;
}

Help Bot

X