Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx Base on Mac OS X questions

Hello,

I have a few questions about the DAQmx Base C API on Mac OS X, using the USB-6009. The "NI-DAQmx Base 1.x C Reference Help" pages and my search of this forum didn't help to answer them:

1. How do I determine the mapping from device names (e.g., "Dev1") to device serial numbers? (`lsdaq' already does this, but I'd like this functionality inside my own program.)

2. How do I query a device (or task) for the sampling rates it supports?

3. When using multiple devices (tasks), it would be convenient to have the equivalent of POSIX select(). That way, a single thread of execution could block, waiting for samples from any task. What's the recommended way to efficiently obtain samples from multiple devices?

4. Is there an example program that reliably samples from the USB-6009 at 48kS/s? Modifying `contAcquireNChan.c' to use the rate 24000.0 instead of 5000.0 causes a runtime error. My own program, which worked fine on the USB-6008, sporadically returns error -200361 (DAQmxErrorInputFIFOOverflow2) at the higher sampling rates. (Oddly, there is no extended error string available for this code.)

5. Has the DAQmx Base framework been tested on Mac OS X 10.4 "Tiger"? When running the example programs, I see messages such as the following:

CNetPort is born.
NIRPC dll initialized
CNetPort is dying.
CNetPort is dead.
NIRPC dll finished - deletion of pNetPort and critical sections

...these don't appear when running under Panther. I'm concerned that there might be other functional differences that I can't see.

Thanks!
-jd
0 Kudos
Message 1 of 17
(5,800 Views)
Hello Jd. Thank you for contacting National Instruments.

1. There is a new example program on ni.com that shows how to map the device number to the serial number:

http://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=F07E68F53B7B4DF1E0340003BA7CCD71&p_node=201181&p_source=External

2. DAQmx does not currently enable you to check the maximum scan rate of the device.

3. DAQmx Base is not multithreaded, so I don't know how you could have the equivalent of POSIX select().

4. I ran ContAcq&Graph Voltage.vi and didn't get any errors at 48 kHz. Make sure you aren't running any other programs, I had problems with this originally.

Please let me know if you have any questions. Have a great day!

Marni S.
National Instruments
Message 2 of 17
(5,765 Views)
Hi Marni,

I also see this error DAQmxErrorInputFIFOOverflow2 on Win XP while running the USB-6008 at or near 10kHz. Actutally I can reproduce it as low as 2kHz. All my code does is reads the data out of the buffer after DAQmxBaseReadAnalogF64 returns and puts it in a python list. It will run fine for a long time, but as soon as I start resizing another window or doing anything in another window it gets bogged down and eventually returns DAQmxErrorInputFIFOOverflow2. I'd like my program to recover from this automatically even if I miss some samples. Is there anything I can do that would be faster than clearing the task and reinitializing?

Scott
0 Kudos
Message 3 of 17
(5,668 Views)

@Marni wrote:
Hello Jd. Thank you for contacting National Instruments.

1. There is a new example program on ni.com that shows how to map the device number to the serial number:

http://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=F07E68F53B7B4DF1E0340003BA7CCD71&p_node=201181&p_source=External


Marni:

This link points to a Labview vi. Is there a C code way to do this?

Thanks!
John Weeks

WaveMetrics, Inc.
Phone (503) 620-3001
Fax (503) 620-6754
www.wavemetrics.com
0 Kudos
Message 4 of 17
(5,658 Views)
Just as a follow up, I can get this same error DAQmxErrorInputFIFOOverflow2 on my US-6008 after building and running the NI example contAquireNChan.c from C:\Program Files\National Instruments\NI-DAQmx Base\Examples\ai. I built it in Visual Studio 6.0. The only change I made was to continue looping forever rather than stopping after 10 sec. Just run it and then resize a browser window until you get the error.

Scott
0 Kudos
Message 5 of 17
(5,655 Views)
Hello John and Scott,

John, I didn't find any functions to find the serial number in the C commands. However, you can make the LabVIEW program into a DLL and read it in your C code. Take a look at the attached file.

Scott, since you are using a USB connection, your data will be sent through IRQ not DMA channels. IRQ is system dependent, so if you have a lot of things going on at the same time as your program you will get an error. To prevent this cut down on things using a USB connection and decrease the programs running at the same time. If you want to overwrite your the data, use the DAQmx Read Property node to set the property Overwrite to "Overwrite Unread Samples."

Please let me know if you have any questions. Have a great day!

Marni S.
National Instruments
0 Kudos
Message 6 of 17
(5,624 Views)
Hi Marni,

I am trying to use the USB 6008 at the data rate of 10 kSamples/s. My application crashes almost immediately when other programs are running. If run it with no other programs it always does eventually crash. I usually the error DAQmxErrorInputFIFOOverflow2, and occasionally get the error
0 Kudos
Message 7 of 17
(5,588 Views)
Hi Marni,

I am trying to use the USB 6008 at the full data rate of 10 kSamples/s. My application crashes almost immediately when other programs are running, but even with no other programs running it always does eventually crash. I usually see the error DAQmxErrorInputFIFOOverflow2, and occasionally get the error DAQmxErrorSamplesNotYetAvailable. Your post suggests that this is a problem inherent of USB devices. Was the USB 6008 not built for continuous data aquisition at the full data rate? I require at least 10kS/s continuous. What is the simplest (i.e. cheapest) NI device that can do this reliably?

You mentioned in your last post the following:

"If you want to overwrite your the data, use the DAQmx Read Property node to set the property Overwrite to "Overwrite Unread Samples.""

Could you describe this in a little more detail? I'm not familiar with the DAQmx Read Property node. It may be acceptable for me to ignore samples for a few seconds to allow things to catch up, provided it only happened once in a while. At least until I can implement on a more robust platform.

regards,
Scott
0 Kudos
Message 8 of 17
(5,115 Views)
Hello Scott,

Does your computer meet these requirements:

SYSTEM REQUIREMENTS (Minimum System)
Mac OS X v10.3 or later
G3 or better Processor
256 MB Memory
350 MB Disk Space

Even if it does meet the specs, you will probably run into issues doing continuous acquisition at the maximum scan rate. If you need to continuously acquire at 10 kS/s I recommend upgrading to the USB-6009 which has a maximum scan rate of 48 kS/s.

I made a mistake in my last posting. DAQmx has the option of the property nodes, but the DAQmx Base does not have those options. Please let me know if you have any questions. Have a great day!

Marni S.
National Instruments
0 Kudos
Message 9 of 17
(5,558 Views)
Hi Marni,

I'm not on a Mac, that was the other guy. My system is a pentium 2.52 GHz with 512M ram running winXP. I can get my 6008 to crash when sampling at 2kS/s. You mentioned that USB was the source of the problem. The 6009 is still a USB device. Why do you recommend it? Are you sure it won't crash at 10kS/s? Or is it just less likely to crash? I don't see why, if the problem lies in the data transfer to the PC, then why would upgrading to a device that can sample faster but still use the same USB solve my problem?

regards,

Scott
0 Kudos
Message 10 of 17
(5,306 Views)