Python™ Support for MCC DAQ Products

Download from GitHub Technical Support
Python™ Support for MCC DAQ Products
Features
  • The mcculw package contains an API (Application Programming Interface) for interacting with Universal Library in Windows.
  • The uldaq package contains an API for interacting with Universal Library for Linux.
  • Both packages are implemented in Python as a wrapper around the Universal Library C API using the ctypes Python Library. Both were developed and are supported by MCC.
  • Source code and examples are available in the MCC GitHub repository

Python is a powerful object-oriented programming language. Many MCC products – including most USB, Ethernet™, and Bluetooth® hardware – are supported under the open-source MCC Universal Library Python API for Windows. Linux support is available as part of the MCC Universal Library for Linux package.


Additional Resources

Q&A

Linux / Windows API
Hi, Is the API for the linux and windows version identically in python for running the same code on boh windows and RPI?
The API for the Linux and Windows Python support is platform dependent so sharing common code between the two libraries is not possible.
Python WinOS support for DT9837A
Hi, As there is no Python support for DT9837A in Windows, what would you suggest to develop our own Python codes for Windows from scratch?
Creating your own Python wrapper to the Open Layers for Windows DLL calls would be very complex, and we cannot advise you on that. You could switch from Windows to Linux, since the DT9837A model is supported with Python via the UL for Linux. Though note that the UL for Linux API differs greatly from Open Layers, and so there is no way to leverage this Python API back into Windows. To stay with Windows, you could consider switching programming languages, from Python to C/C#/VB.
Using with analog input trigger (USB-1604HS-2AO)
Does this support using analog input trigger (CH1-CH4) with USB-1604HS-2AO?
Yes, Python supports analog input triggering when using the USB-1604HS-2AO.
Python project (mcculw) can't find my board DT9837A
Hello, I recently purchased a DT9837A card and the program named “DaqDevDiscovery01” can't find my card. When I check the device, there are no drivers installed for it. Even the Instacal software can't find the card. No way to find the right driver on your site.
The only Python support offered for the DT9837A/B/C models is under Linux. The Windows API software is called Open Layers, and it can be found on the Data Translation section of our downloads page. Though again, there is no Python support for Open Layers and none is planned.
Is Instacal Required?
Is InstaCal required to detect connected modules, or Device Discovery work without Instacal?
The device discovery functions can be used with Measurement Computing USB, Bluetooth, and Ethernet devices. Other board types such as PCI, ISA, CIO hardware don’t support device discovery functions, and must be installed and configured with InstaCal. When running Python examples with board types that don’t support device discovery functions, set the use_device_detection variable in the example program to False.
Latency for analog outputs
Is there a latency spec (or a rough ballpark of what to expect) for setting analog outputs on a USB-3101FS via Python? By thaThanks in advance!
For a single value write to a single AO channel on a USB-3101FS, the overhead to access the USB/hardware is going be the dominant factor. Ballpark latency is 0.5 to 1 mS.
USB 5203 not supported?
Does this python library support USB 5203/5201? I have these daq cards and am getting an error.
Yes the USB-5200 series is listed as supported with Python on Windows. The USB-5200 models are primarily stand-alone logger. You must first manually configure a logging session in InstaCal (set sensor type, which channels to log, sample rate, etc). The logger cannot log to its memory card when connected to the PC. You disconnect the logger from the PC for all logging to the memory card. Normally folks then use InstaCal (or perhaps TracerDAQ), to quickly/manually convert the binary data files to text/CSV files for further analysis in Excel. There are UL datalogger calls that can be made to convert a data file, though these historically have not been popular. If a USB-5200 model is left connected to the PC 100% of the time, it does not behave like a stand-alone logger, but instead behaves like a USB-TC/TEMP, and data can be samples live via the TIn function. Again no data gets logged to the memory card when connected to the PC, so if you will use the logger always connected to the PC, then just call TIn (no need to call the Datalogger functions, which again, don’t setup or perform the data logging, they just extract data from a binary file).
I am having trouble finding example ULEV02 in the mmculw github respository for Python, although it appears on the Help Manuals
It was decided to not include event support for that release.
PIDs
Hi, I'm trying to run the example codes using a USB-1608FS-PLUS but I don't know which is the PID number for this daq, so I get a 'Could not find a supported device.' message.
If by PID you mean the hardware model’s “Product ID” that can be found using Window’s Device Manager: Locate the USB-1608FS-PLUS under DAS components. But none of our Python examples specifically ask for a PID/device ID. For our Console examples, you do not have to first run our InstaCal utility. You need only have the device attached to USB port of the PC, and then try running one of these examples: a_in.py, a_in_foreground.py, v_in.py If you are running one of our GUI examples, you must first run InstaCal to have the hardware added to its board list. Then try running one of these examples: ULAI01.PY, ULAI03.py, VIn01.py.
I am trying to control USB-DIO24 using Python
I have installed Instacal and using universal Library for help, I am not able to communicate with this module. All I have to do is to make FIRSTPORTA to static High/Low. Do you have any code which works for USB-DIO24?
Our Python support, including examples programs, are available at: https://github.com/mccdaq. Try running the console example program named: digital_out.py
Will this run on Linux?
I'm looking to use your Linux driver and am wondering if the python support works with it
MCC now has Linux support for the USB-DIO24 series, with our recent release of UL for Linux ver 1.1.0. The UL for Linux includes both Python and C/C++ support for MCC’s most popular USB devices.