From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
03-29-2017 11:07 PM
Hi,
I am trying to use python so I can automate NI 9229 using NI cDAQ-9174. However, I am not able to find example codes that can walk me through it. I tried downloading pyDAQmx and used the following example from https://pythonhosted.org/PyDAQmx/examples/multi_channel_analog_input.html and replaced "cDAQ1Mod1_ai0" with
"Dev1/ai2","Dev1/ai1"]
It gives me the following error:
Traceback (most recent call last):
File "C:\Projects\Programming\NI\test1.py", line 57, in <module>
multipleAI.configure()
File "C:\Projects\Programming\NI\test1.py", line 38, in configure
DAQmx_Val_Volts,None)
File "<string>", line 2, in function
File "C:\Python27\lib\site-packages\PyDAQmx\DAQmxFunctions.py", line 29, in mafunction
raise DAQError(error,errBuff.value.decode("utf-8"), f.__name__)
PyDAQmx.DAQmxFunctions.DAQError: Device identifier is invalid.
Device Specified: empty string
Suggested Device(s): cDAQ1, cDAQ1Mod1, cDAQ1Mod3
Task Name: _unnamedTask<0>
Status Code: -200220
in function DAQmxCreateAIVoltageChan
Can someone help me?
03-30-2017 10:34 AM
Try using NI's internally-created, open-source, hot-off-the-press, just-released Python API and let us know what you think!
https://pypi.python.org/pypi/nidaqmx
http://nidaqmx-python.readthedocs.io/en/latest/ (documentation/examples)
(for completeness here is our GitHub Page)
03-30-2017 07:29 PM
I am receiving an error -201087 stating that "Task contains physical channels on one or more devices that require you to specify the Sample Clock rate. Use the Sample Clock Timing function/VI to specify a Sample Clock rate. You cannot specify a Sample Clock rate if Mode is set to On Demand."
I have NI 9229 and NI 9227 connected to NI cDAQ-9174 where NI 9229 is cDAQ1Mod1 in NI MAX. I have attached the code that I am trying to use.
03-31-2017 01:16 PM
You'll need to call http://nidaqmx-python.readthedocs.io/en/latest/timing.html#nidaqmx._task_modules.timing.Timing.cfg_s...
before you call read
04-04-2017 10:02 PM - edited 04-04-2017 10:03 PM
I called the timing module and it worked. I have 2 DAQs (NI 9229) which I would like to use it at the same time. I am using NI cDAQ-9174 to put them together. Do I need to generate a clock using cDAQ1 i.e. cDAQ-9174? If so, how do I proceed forward?
04-07-2017 11:00 AM
04-07-2017 06:56 PM
Hi @Davidvilla87,
I am trying the example from https://github.com/ni/nidaqmx-python/blob/master/nidaqmx_examples/ai_multi_task_pxie_ref_clk.py and want to use cDAQ clock for 2 NI 9229 DAQs. However, I am unsure on how to use it.
04-11-2017 01:46 PM
Hi Priyank,
It is unclear how you would like the 9229 acquisitions timed. Would you like them to simply trigger off a timebase of the 9174, a counter of the 9174, or something else? If you would just like them to start acquiring at the same time, you can just select the same ref_clk_src for both channels. You could use a time base off the chassis, or you could use the AI sample clock of one of the 9219 channels. If you use that example, you would make one of the 9229's a master and the other one a slave. You would then select the same ref_clk_src for both the master and slave and they should be relatively synchronized, if that's what you are trying to achieve.
04-21-2017 01:17 PM
Hi all,
I am facing another issue. I installed nidaqmx in my another computer. I did pip install nidaqmx for python 2.7. I am unable to run the command nidaqmx.Task(). I see the following error.
TypeError: LoadLibrary() argument 1 must be string, not unicode
Exception AttributeError: "'Task' object has no attribute '_handle'" in <object
repr() failed> ignored
Detailed error:
File "C:\NI_DAQ\NiDaqRun.py", line 50, in main
with nidaqmx.Task() as task:
File "C:\Python27\lib\site-packages\nidaqmx\task.py", line 84, in __init__
self._handle = lib_importer.task_handle(0)
File "C:\Python27\lib\site-packages\nidaqmx\_lib.py", line 173, in task_handle
self._parse_typedefs()
File "C:\Python27\lib\site-packages\nidaqmx\_lib.py", line 225, in _parse_type
defs
version = system.driver_version
File "C:\Python27\lib\site-packages\nidaqmx\system\system.py", line 73, in dri
ver_version
return DriverVersion(self._major_version, self._minor_version,
File "C:\Python27\lib\site-packages\nidaqmx\system\system.py", line 108, in _m
ajor_version
cfunc = lib_importer.windll.DAQmxGetSysNIDAQMajorVersion
File "C:\Python27\lib\site-packages\nidaqmx\_lib.py", line 161, in windll
self._import_lib()
File "C:\Python27\lib\site-packages\nidaqmx\_lib.py", line 198, in _import_lib
windll = ctypes.windll.LoadLibrary(lib_name)
File "C:\Python27\lib\ctypes\__init__.py", line 440, in LoadLibrary
return self._dlltype(name)
File "C:\Python27\lib\ctypes\__init__.py", line 362, in __init__
self._handle = _dlopen(self._name, mode)
TypeError: LoadLibrary() argument 1 must be string, not unicode
Exception AttributeError: "'Task' object has no attribute '_handle'" in <object
repr() failed> ignored
04-21-2017 01:19 PM