mcculw icon indicating copy to clipboard operation
mcculw copied to clipboard

Invalid Board Number

Open matt454357 opened this issue 2 years ago • 5 comments

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

matt454357 avatar Jan 06 '23 04:01 matt454357

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

matt454357 avatar Jan 06 '23 19:01 matt454357

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

matt454357 avatar Jan 06 '23 19:01 matt454357

Hello,

did you ever found a solution to this? I'm facing the same issue.

Thank you.

angel6700 avatar Sep 21 '23 06:09 angel6700

No. I gave up and used C#.

matt454357 avatar Sep 21 '23 13:09 matt454357

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.

yusaku-m avatar Mar 05 '24 05:03 yusaku-m