I am working with a single USB2523 connected to a Win10 64bit computer using C++ code. I have everything working as I need and acquiring data correctly with one exception. That is, when I try to do a software reset and then re-initialize the board, the code hangs up. Below is the bare minimum code to reproduce the issue. All I need to do is call Init(), then Reset() and then Init() again. The code will hang on FindAnalogChansOfType(). If I remove this call from my full code, the code hangs when I try to acquire data with cbAIn(). I assume I am not free up some resources but can not find anything in the examples that shows what I am doing wrong. Any help would be greatly appreciated.
int HW_MCCDAQ_DRIVER::Init()
{
int iULStat = NOERRORS;
float RevLevel = (float)CURRENTREVNUM;
DaqDeviceDescriptor inventory[MAXNUMDEVS];
DaqDeviceDescriptor DeviceDescriptor;
m_iNumberOfDevices = MAXNUMDEVS;
DeviceDescriptor = inventory[0];
CString name = CString(DeviceDescriptor.ProductName).GetString();
CString id = CString(DeviceDescriptor.UniqueID).GetString();
int ADResolution = 0;
int Range = BIP10VOLTS;
int LowChan = 0;
int DefaultTrig = 0;
int iNumAIChans = FindAnalogChansOfType(0, ANALOGDAQIN, &ADResolution, &Range, &LowChan, &DefaultTrig);
if (iNumAIChans != 8)
{
return -1;
}
}
int HW_MCCDAQ_DRIVER::Reset()
{
int iULStat = cbReleaseDaqDevice(0);
if (iULStat != NOERRORS)
{
return -1;
}
}
Question
Coy C
I am working with a single USB2523 connected to a Win10 64bit computer using C++ code. I have everything working as I need and acquiring data correctly with one exception. That is, when I try to do a software reset and then re-initialize the board, the code hangs up. Below is the bare minimum code to reproduce the issue. All I need to do is call Init(), then Reset() and then Init() again. The code will hang on FindAnalogChansOfType(). If I remove this call from my full code, the code hangs when I try to acquire data with cbAIn(). I assume I am not free up some resources but can not find anything in the examples that shows what I am doing wrong. Any help would be greatly appreciated.
int HW_MCCDAQ_DRIVER::Init()
{
int iULStat = NOERRORS;
float RevLevel = (float)CURRENTREVNUM;
DaqDeviceDescriptor inventory[MAXNUMDEVS];
DaqDeviceDescriptor DeviceDescriptor;
m_iNumberOfDevices = MAXNUMDEVS;
iULStat = cbDeclareRevision(&RevLevel);
if (iULStat != NOERRORS)
{
return -1;
}
iULStat = cbGetDaqDeviceInventory(ANY_IFC, inventory, &m_iNumberOfDevices);
if (iULStat != NOERRORS)
{
return -1;
}
DeviceDescriptor = inventory[0];
CString name = CString(DeviceDescriptor.ProductName).GetString();
CString id = CString(DeviceDescriptor.UniqueID).GetString();
int ADResolution = 0;
int Range = BIP10VOLTS;
int LowChan = 0;
int DefaultTrig = 0;
int iNumAIChans = FindAnalogChansOfType(0, ANALOGDAQIN, &ADResolution, &Range, &LowChan, &DefaultTrig);
if (iNumAIChans != 8)
{
return -1;
}
}
int HW_MCCDAQ_DRIVER::Reset()
{
int iULStat = cbReleaseDaqDevice(0);
if (iULStat != NOERRORS)
{
return -1;
}
}
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now