LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to detect PCI card is available

HI,
 
My Requirement is when I start my program first of all it has to check PCI-6723 is Available or not in PCI Slot if the card is not available I have to popup a respective msg
 
How to check a card(xxxx) is available or not in PCI Slots.
 
Please send me one example ASAP
 
Waiting for reply
 
Regards
krishna 
0 Kudos
Message 1 of 3
(3,114 Views)

I suggest you use at program start Ini_DA_Boards function to initialize your board: it the return code from this function is negative the board may be either not present or faulty, in both cases your application cannot start.

As usual, error value has a meaning that can obtained in a string using GetNIDAQErrorString function, so you can prompt your user with the exact description of the error.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 3
(3,106 Views)

Hello,

I am not sure how I got this code below. Probably I adapted a sample from the CVI distribution.

The code is made with (traditional) NI-DAQ. It consist of a function that returns a device type number for a NI-DAQ board. And I found a list of device type numbers in the help file for Traditional NI-DAQ C Function Reference Help with the description of Init_DA_Brds

Source:

#define BoardTypePci6110 241
#define BoardTypePci6111 244
static int previousBOLEstate; /* break on library errors */

And anywhere in your application:

    DeviceType = Log611xSearchBoard(BoardType);
    if (DeviceType >= 0)
    {
        Log611xDevice = DeviceType;
        Init_DA_Brds(Log611xDevice, &BoardType);
        Timeout_Config(Log611xDevice, 60);
        switch (BoardType)
        {
         case BoardTypePci6110:
            Log611xNumberChannels = 4;
            break;
         case BoardTypePci6111:
            Log611xNumberChannels = 2;
            break;
         default:
            Log611xNumberChannels = 0;
            break;
     }
... ... ...

And the search function itself:

short Log611xSearchBoard(int type)
{
    unsigned short i=0;
    unsigned short status;
    unsigned long DT;
    short ReturnValue = -1;
    int Found = 0;

    previousBOLEstate = GetBreakOnLibraryErrors ();
    if (previousBOLEstate) DisableBreakOnLibraryErrors();

    while ((i<8) && (Found == 0))
    {
        i += 1;
        status = Get_DAQ_Device_Info (i, ND_DEVICE_TYPE_CODE, &DT);
        if ((status == 0) && (DT == (unsigned long)type))
        {
            Found = 1;
            ReturnValue = (short)i;
        }
    }

    if (previousBOLEstate)EnableBreakOnLibraryErrors();
    return(ReturnValue);
}

 

 

0 Kudos
Message 3 of 3
(3,104 Views)