04-25-2008 11:29 AM
04-28-2008 03:31 PM
05-03-2008 07:51 PM
05-05-2008 11:55 AM
Hey chicago_joe,
I am glad you got it working and thanks for posting your solution! You would choose between DAQmx and DAQmx Base depending on your distro, hardware, and functionality you want. Certain hardware may only be supported by one driver or the other. You can check this in the readme file for each driver. The DAQmx driver does include much more functionality. You can see a comparison in the first link below. DAQmx Base does have the most recent release, but that does not necessarily make it the best candidate for your use. Again, it all depends on the things I have spoken about above. You can have both installed at the same time and I have attached a link below that describes how to switch between the two.
Data Acquisition (DAQ) Software Comparison
http://www.ni.com/dataacquisition/companion_software.htm
How To Switch Between NI-DAQmx Base and
NI-DAQmx on Linux
http://digital.ni.com/public.nsf/allkb/A3C7200E881696FA862570AD0050E8D0?OpenDocument
NI-DAQmx for Linux
Frequently Asked Questions
http://zone.ni.com/devzone/cda/tut/p/id/3695
Please let me know if you have further questions!
03-09-2009 12:04 PM
Hello Chicago_Joe,
I'm not very fluent in c programming on Linux, actually all focus is going to python/numpy/scipy/matplotlib, that i start to use well.
Now i would like to implement a single NI usb-6008 device for some linux host applications.
I got lsdaq & nidaqmxbase working properly as root on debian lenny official release,
using all the good advise on this board
- alien-ising nikal,nivisa & nidaqmxbase rpms from iso file nidaqmxbase320
- dpkg -i *.deb those deb files
- usr/lib/natinst/bin/FWUpdate to latest firmware
Now I still have 2 problems :
1. how to get lsdaq finding the usb device when i'm not root
2. since i'm not that fluent on c programming & ctypes,
is it possible to get more detailed information about the way
i should import 'nidaq' (just for usb device herebove)
Naturally i also am very eager to hear if you continued on this python approach,
since it looks like you have been creating the only mention of python nidaq up to now.
thank you beforehand for your help
bogitux
03-10-2009 12:13 PM
Hi bogitux,
Considering that you are posting on a relatively old thread, Chicago_Joe may not still be monitoring posts. As such, should you not receive a response, you may consider creating a new thread. Good luck!
Regards,
David
Applications Engineer
National Instruments
03-10-2009 12:54 PM
hey all,
short story is that after all that, i showed my boss how far i had gotten in time i had been working on it and he asked me to focus on other things, so i haven't been back to it too much.
the way i was able to 'import nidaq' as i said was by compiling my wrapper-modules (first a C wrapper to handle the pointers and make calls to NIDAQ, and then a pyrex layer to interface between python and C) and placing them in the python path. if you have a module called nidaq, you can import it! I had written a makefile which should also be in the tarball, so that shows how i was compiling everything.
i can look around and see if i have a more recent version of the code to post, but i think the .tgz earlier in this thread is fairly current. I had only wrapped a bare minimum of the NI functions, and one issue that obviously needed to be dealt with promptly was the buffering - my group has also run into this in pure labview applications, but basically you have to do some internal buffering of your incoming and outgoing data to make sure you don't fall behind the acquisition board, and you have to understand the rates at which your device can acquire.
anyway if you have little or no experience with C programming, looking at my code might help with a template but probably won't be enough. on the other hand if you're capable of writing in C, i think i made a decent start and it would save someone a little time to continue from where i left off rather than start from scratch. but like i said it's not a full wrapper because i was asked to focus my time elsewhere.
03-11-2009 08:40 AM
Hi chicago_joe,
[It appears may still monitor this thread, so I'll take a shot in the dark.] Sounds like the workaround for accessing DAQmx in python was not trivial. I'm afraid I couldn't implement as complicated a wrapper-of-wrappers solution as you came to (plus, I am on Windows). However, you appear to be one of the few people anywhere who have tried to use DAQmx with python and I'm completely stuck (and will ship my NI device back if I can't get this to work): did you ever manage to perform digital output? Or, more generally, did you find a way to set the "reserved" parameters from python to some value they would accept? I have been able to read data from my device (NI USB-6259) with no trouble using the python ctypes wrapper, but I'm completely hung on usingDAQmxWriteDigitalLines(), and related functions, because they require a "NULL" value for the 'reserved' parameter, and I can't find a way to feed that properly from python. Any chance you succeeded in that task before you were pulled away? My non-working code (based on the ) looks like this:
import ctypes
nidaq = ctypes.windll.nicaiu
DAQmx_Val_ChanPerLine = ctypes.c_int(0)
enable = ctypes.c_uint32(3)
sampsPerChanWritten = ctypes.c_int32()
null = ctypes.c_int32(0)
nidaq.DAQmxCreateTask("",ctypes.byref(enable))
nidaq.DAQmxCreateDOChan(enable,"Dev1/port0/line1","", DAQmx_Val_ChanPerLine)
nidaq.DAQmxWriteDigitalLines(enable,
ctypes.c_int32(1), # numSamplsPerChan
ctypes.c_int32(1), # autostart=1
ctypes.c_float64(1), # timeout
DAQmx_Val_GroupByChannel,
ctypes.c_uint8(1), # VALUE TO BE WRITTEN
ctypes.byref(sampsPerChanWritten),
ctypes.byref(null) ) # reserved, supposed to be NULL
This gives me a -200492 error: 'Measurements: Reserved parameter must be NULL.' I've also tried defining null as:
null = ctypes.POINTER(ctypes.c_int)()
null.value = 0
... and replacing the last line in the DAQmxWriteDigitalLines call with "null )", but that fails on "WindowsError: exception: access violation reading 0x00000001". I have yet to come up with a combination of the definition of my 'null' variable and ctypes passing syntax that DAQmx accepts. Any insight you or others might have would be most appreciated.
-best
GaryS
03-11-2009 10:59 AM
the way you set up your null pointer, it's pointing to a value of zero - you need a pointer that IS zero. it's basically a ctypes issue, which... according to ctypes documentation, you should get a null pointer just by calling the constructor with no arguments and then never setting a value, so just the line:
null = ctypes.POINTER(ctypes.c_int)()
all by itself /should/ do it, but if that doesn't work ... best of luck!
03-11-2009 11:46 AM