I have a NIDAQ application that has been working for several years but recently a function inside the program called
SCXI_Get_Chassis_Info
has failed to return with any information regarding the chassis that IS LISTED in M&A, and in my code I get 0 chassis even though one is actually present and can be excersied from NI M&A
This is my code below the chassis listed in M&A is an SCXI1001
This code has worked for years, it simply loops from 1 to 32 looking for any SCXI systems and if it finds any tests the chassis type code.
Have the chassis codes changed?
Is the first chassis in the system always 1?
static const short ci16SCXI_1000 = 0; // From NI Docs
static const short ci16SCXI_1001 = 1; // From NI Docs
static const short ci16MaxChassisID = 32;
typedef struct SUPPORTED_CHASSIS
{
short i16ChassisID;
}
SUPPORTED_CHASSIS, *LPSUPPORTED_CHASSIS;
static SUPPORTED_CHASSIS supportedChassis[] =
{
{ci16SCXI_1000},
{ci16SCXI_1001}
};
static void FindChassis(void)
{
short i16Status;
short i16ChassisType;
short i16ChassisAddress;
short i16CommMode;
short i16CommPath;
short i16NumSlots;
for (short i16ChassisId = 1; i16ChassisId <= ci16MaxChassisID; i16ChassisId++)
{
i16Status = SCXI_Get_Chassis_Info(i16ChassisId, &i16ChassisType, &i16ChassisAddress, &i16CommMode, &i16CommPath, &i16NumSlots);
if ((i16Status == 0) && (IsSupportedChassis(i16ChassisType)))
{
CHASSIS* ptChassis = new CHASSIS;
ptChassis->i16ChassisID = i16ChassisId;
ptChassis->i16ChassisType = i16ChassisType;
ptChassis->i16ChassisAddress = i16ChassisAddress;
ptChassis->i16CommMode = i16CommMode;
ptChassis->i16CommPath = i16CommPath;
ptChassis->i16NumSlots = i16NumSlots;
switch(i16ChassisType)
{
case ci16SCXI_1000:
_stprintf(ptChassis->szChassisName, _T("SCXI-1000"));
break;
case ci16SCXI_1001:
_stprintf(ptChassis->szChassisName, _T("SCXI-1001"));
break;
default:
_stprintf(ptChassis->szChassisName, _T("Unknown chassis"));
break;
};
chassis.Add(ptChassis);
}
}
TCHAR szMsg[256];
_stprintf(szMsg, _T("There are %d chassis in the system"), chassis.Count());
InfoMsg(szMsg);
}
static bool IsSupportedChassis(short i16ChassisType)
{
bool bIsSupported = false;
for (int iChassis = 0; iChassis < ci16NumSupportedChassis; iChassis++)
{
if (supportedChassis[iChassis].i16ChassisID == i16ChassisType)
{
bIsSupported = true;
break;
}
}
return bIsSupported;
}
Any help or advice is appreciated.
What are the scenarios that could occur that cause NIDAQ calls to fail yet M&A still function?
Thank You
Andrew