PXI

cancel
Showing results for 
Search instead for 
Did you mean: 

NI-VISA is not detecting my PXI instrument

hi,
 we are using NI-visa resource find to detect all the instrument connected to our station,
 but it is not detecting the PXI instruments 
 We used NI-MAX to configure the new PXI device and then it was listed in MAX explorer.
 NI-VISA resoursefind is detecting the PXI instrument after doing this.
I want to know how to find PXI device.
 
 
This is my c code:
 
#define NIVISA_PXI /* to include PXI VISA Attributes */

#include <stdio.h>
#include <stdlib.h>

#include "visa.h"

static char instrDescriptor[VI_FIND_BUFLEN];
static ViUInt32 numInstrs;
static ViFindList findList;
static ViSession defaultRM, instr;
static ViStatus status;

int main(void)
{
   /* First we will need to open the default resource manager. */
   status = viOpenDefaultRM (&defaultRM);
   if (status < VI_SUCCESS)
   {
      printf("Could not open a session to the VISA Resource Manager!\n");
      exit (EXIT_FAILURE);
   } 

    /*
     * Find all the VISA resources in our system and store the number of resources
     * in the system in numInstrs.  Notice the different query descriptions a
     * that are available.

        Interface         Expression
    --------------------------------------
        GPIB              "GPIB[0-9]*::?*INSTR"
        VXI               "VXI?*INSTR"
        GPIB-VXI          "GPIB-VXI?*INSTR"
        Any VXI           "?*VXI[0-9]*::?*INSTR"
        Serial            "ASRL[0-9]*::?*INSTR"
        PXI               "PXI?*INSTR"
        All instruments   "?*INSTR"
        All resources     "?*"
    */
   status = viFindRsrc (defaultRM, "?*INSTR", &findList, &numInstrs, instrDescriptor);
   if (status < VI_SUCCESS)
   {
      printf ("An error occurred while finding resources.\nHit enter to continue.");
      fflush(stdin);
      getchar();
      viClose (defaultRM);
      return status;
   }

   printf("%d instruments, serial ports, and other resources found:\n\n",numInstrs);
   printf("%s \n",instrDescriptor);

   /* Now we will open a session to the instrument we just found. */
   status = viOpen (defaultRM, instrDescriptor, VI_NULL, VI_NULL, &instr);
   if (status < VI_SUCCESS)
   {
      printf ("An error occurred opening a session to %s\n",instrDescriptor);
   }
   else
   {
     /* Now close the session we just opened.                            */
     /* In actuality, we would probably use an attribute to determine    */
     /* if this is the instrument we are looking for.                    */
     viClose (instr);
   }
       
   while (--numInstrs)
   {
      /* stay in this loop until we find all instruments */
      status = viFindNext (findList, instrDescriptor);  /* find next desriptor */
      if (status < VI_SUCCESS)
      {   /* did we find the next resource? */
         printf ("An error occurred finding the next resource.\nHit enter to continue.");
         fflush(stdin);
         getchar();
         viClose (defaultRM);
         return status;
      }
      printf("%s \n",instrDescriptor);
   
      /* Now we will open a session to the instrument we just found */
      status = viOpen (defaultRM, instrDescriptor, VI_NULL, VI_NULL, &instr);
      if (status < VI_SUCCESS)
      {
          printf ("An error occurred opening a session to %s\n",instrDescriptor);
      }
      else
      {
         /* Now close the session we just opened.                            */
         /* In actuality, we would probably use an attribute to determine    */
         /* if this is the instrument we are looking for.                    */
         viClose (instr);
      }
   }    /* end while */

   status = viClose(findList);
   status = viClose (defaultRM);
   printf ("\nHit enter to continue.");
   fflush(stdin);
   getchar();

   return 0; 
}

0 Kudos
Message 1 of 1
(3,368 Views)