mcculw
mcculw copied to clipboard
Invalid Board Number
I get an error when running a simple test:
Environment:
- Model = USB-2533
- Windows 10
- Python version = 3.10.9
- MccDaq.dll version = 3.73
- mcculw version = 1.0.0
from mcculw import ul
value = ul.a_in(0, 6, 1)
print("Raw Value: " + str(value))
Returns the following:
Traceback (most recent call last):
File "C:\Users\mtaylor\Documents\dev\mcc_test2.py", line 3, in <module>
value = ul.a_in(0, 6, 1)
File "C:\Users\mtaylor\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\mcculw\ul.py", line 85, in a_in
_check_err(_cbw.cbAIn(
File "C:\Users\mtaylor\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\mcculw\ul.py", line 6128, in _check_err
raise ULError(errcode)
mcculw.ul.ULError: Error 1: Invalid board number.
It is working in C#:
using MccDaq;
MccDaq.MccBoard DaqBoard = new MccDaq.MccBoard(0);
MccDaq.ErrorInfo ULStat;
System.UInt16 DataValue;
ULStat = DaqBoard.AIn(6, MccDaq.Range.Bip10Volts, out DataValue);
Console.WriteLine("Value=" + DataValue.ToString());
Returns the following:
Value=32766
It also works with C:
#include <stdio.h>
#include "..\cbw.h"
int main(void)
{
int ULStat = NOERRORS;
USHORT DataValue = 0;
ULStat = cbAIn(0, 6, 1, &DataValue);
printf("Value=%d\n", DataValue);
return 0;
}
Value=32764
Here's a lower level test:
from ctypes import *
_cbw = WinDLL("./cbw64.dll")
data_value = c_ushort()
err_val = _cbw.cbAIn(0, 6, 1, byref(data_value))
print(f"Error code={err_val}")
print(f"Value={data_value}")
Which returns the following:
Error code=1
Value=c_ushort(0)
Where cbw64.dll has:
- File Version = 1.93
- Product Version = 6.73
Hello,
did you ever found a solution to this? I'm facing the same issue.
Thank you.
No. I gave up and used C#.
I faced similar situation. Fortunatry, I had two PC which can use mcculw in 6 PC. I think this error occured by Python version.
My test result as show belows,
Environment: Model = USB-1616-HS-BNC Windows 11 InstaCal version = 6.74 mcculw version = 1.0.0
Test results for Python version,
- NG Python 3.8.10 - May 3, 2021
- OK Python 3.10.4 - March 24, 2022
- OK Python 3.10.6 - Aug. 2, 2022
- NG Python 3.10.11 - April 5, 2023
- NG Python 3.11.8 - Feb. 6, 2024
- NG Python 3.12.2 - Feb. 6, 2024
In addition, I try re-install Python 3.10.6 to PC that failed test, all pc can use mcculw.