I am currently facing challenges in setting up the USB-201 device using the Universal Library. Despite successfully installing the driver (I am unsure if it is 32-bit or 64-bit), I have encountered issues with initializing the device in my 64-bit application.
Development Environment:
Visual Studio 2022 C++
Library Linking: Linked against cbw64.lib
Headers: Included cbw.h
DLLs: Copied all necessary DLLs (cbw64.dll, DaqLib64.dll, DaqDevInfo64.dll, MccDaq.dll, MccSkts.exe, HIDRegUpdater.exe) to the execution folder.
My C++ routine,
#include "../Measurement Computing/DAQ/C/cbw.h"
bool USE201::InitReceiver() {
int ULStat = NOERRORS;
float RevLevel = (float)CURRENTREVNUM;
int boardNum = 0; // Assuming USB-201 is board number 0
ULStat = cbDeclareRevision(&RevLevel);
if (ULStat != NOERRORS) return false;
ULStat = cbErrHandling(DONTPRINT, STOPALL);
if (ULStat != NOERRORS) return false;
ULStat = cbIgnoreInstaCal();
if (ULStat != NOERRORS) return false;
Question
USB-201 User
I am currently facing challenges in setting up the USB-201 device using the Universal Library. Despite successfully installing the driver (I am unsure if it is 32-bit or 64-bit), I have encountered issues with initializing the device in my 64-bit application.
Development Environment:
Visual Studio 2022 C++
Library Linking: Linked against cbw64.lib
Headers: Included cbw.h
DLLs: Copied all necessary DLLs (cbw64.dll, DaqLib64.dll, DaqDevInfo64.dll, MccDaq.dll, MccSkts.exe, HIDRegUpdater.exe) to the execution folder.
My C++ routine,
#include "../Measurement Computing/DAQ/C/cbw.h"
bool USE201::InitReceiver() {
int ULStat = NOERRORS;
float RevLevel = (float)CURRENTREVNUM;
int boardNum = 0; // Assuming USB-201 is board number 0
ULStat = cbDeclareRevision(&RevLevel);
if (ULStat != NOERRORS) return false;
ULStat = cbErrHandling(DONTPRINT, STOPALL);
if (ULStat != NOERRORS) return false;
ULStat = cbIgnoreInstaCal();
if (ULStat != NOERRORS) return false;
int ConfigVal = 0;
ULStat = cbGetConfig(BOARDINFO, boardNum, 0, BIADCHANTYPE, &ConfigVal);
if (ULStat != NOERRORS) {
char errMsg[ERRSTRLEN];
cbGetErrMsg(ULStat, errMsg);
std::cerr << "Error in cbGetConfig: " << errMsg << std::endl;
return false;
}
char BoardName[64] = {0};
ULStat = cbGetBoardName(boardNum, BoardName);
if (ULStat != NOERRORS) {
char errMsg[ERRSTRLEN];
cbGetErrMsg(ULStat, errMsg);
std::cerr << "Error in cbGetBoardName: " << errMsg << std::endl;
return false;
}
unsigned short dataValue = 0;
ULStat = cbAIn(boardNum, 0, BIP5VOLTS, &dataValue);
if (ULStat != NOERRORS) {
char errMsg[ERRSTRLEN];
cbGetErrMsg(ULStat, errMsg);
std::cerr << "Error in cbAIn: " << errMsg << std::endl;
return false;
}
ULStat = cbDIn(boardNum, FIRSTPORTA, &dataValue);
if (ULStat != NOERRORS) {
char errMsg[ERRSTRLEN];
cbGetErrMsg(ULStat, errMsg);
std::cerr << "Error in cbDIn: " << errMsg << std::endl;
return false;
}
return true;
}
Issue Description:
Functions such as cbDeclareRevision, cbErrHandling, and cbIgnoreInstaCal execute without errors.
Subsequent calls, cbGetConfig, cbGetBoardName, cbAIn, and cbDIn, fail with the error "Invalid board number".
The boardNum parameter is set to 0, which matches the board number shown in InstaCal.
I have attached a screenshot demonstrating that the driver is installed and the device is detected by InstaCal.
Could you please assist in resolving this issue or provide guidance on what might be going wrong?
Link to comment
Share on other sites
4 answers 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