18padx08 / pylibnidaqmx

Automatically exported from code.google.com/p/pylibnidaqmx
Other
0 stars 0 forks source link

enhancement-add examples of using pylibnidaqmx #4

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi 
I've been writing small examples of using the library and thought I would
share them to see if they are generally useful. I'll attach a zip file.  
They can BSD licensed or may be used under whatever license pylibnidaqmx
itself uses.

I have a mercurial repository for them.
see http://bitbucket.org/cleemesser/pylibnidaqmx-examples/src/

I'm currently doing most testing on windows xp using DAQmx 8.8 and some
version 9.0.2

Also of note, I have a cython interface file to the raw DAQmx library which
works (at least on windows).  It's possible to use this together with
pylibnidaqmx.

Original issue reported on code.google.com by chris.le...@gmail.com on 17 Feb 2010 at 12:31

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks! I have added a note to the main web page.

Original comment by pearu.peterson on 26 Feb 2010 at 9:35

GoogleCodeExporter commented 9 years ago
Hi,

Your scripts are really useful. I'm also trying to test pylibnidaqmx on windows 
xp with DAQmx 8.8. However I keep running into runtime errors (see below for an 
example). You say that:

"Also of note, I have a cython interface file to the raw DAQmx library which
works (at least on windows).  It's possible to use this together with
pylibnidaqmx."

How did you set this up?

Cheers for any help!

Rob Sewell

Traceback (most recent call last):
  File "C:\Documents and Settings\rsewell\Desktop\pylibnidaq examples\trunk\correlated_ao_dio.py", line 17, in <module>
    atask.write(adata, auto_start=False)
  File "C:\Python26\lib\site-packages\nidaqmx\libnidaqmx.py", line 2695, in write
    float64 (timeout), layout_val, data.ctypes.data, ctypes.byref(samples_written), None)
  File "C:\Python26\lib\site-packages\nidaqmx\libnidaqmx.py", line 187, in CALL
    r = CHK(r, funcname, *new_args)
  File "C:\Python26\lib\site-packages\nidaqmx\libnidaqmx.py", line 168, in CHK
    raise RuntimeError('%s%s:%s' % (funcname,args, text))
RuntimeError: DAQmxWriteAnalogF64(AnalogOutputTask('_unnamedTask<0>'), 
c_long(1000), c_ulong(0L), c_double(10.0), 1, 214652888, <cparam 'P' 
(0CC0ECD8)>, None):
  NI Platform Services:  The specified resource is reserved. The operation could
  not be completed as specified.
  ----------

Original comment by robert.j...@gmail.com on 22 Oct 2010 at 2:04

GoogleCodeExporter commented 9 years ago
@Rob Sewell
Your error looks like something that happens when your board either doesn't 
have a resource or the last task is still active in some way. You might want to 
try it again after reseting the board.

If you'd like to look at the cython implementation, I compile it on windows xp 
with the pythonxy distribution.  My bitbucket repo is 

https://cleemesser@bitbucket.org/cleemesser/cydaqmx

The main advantage I've seen with it is for more complicated acquisitions.  But 
I haven't needed to do those recently.  I haven't compiled it under linux.

Original comment by chris.le...@gmail.com on 22 Oct 2010 at 3:47