03-16-2012 12:12 PM
I am tasked with rewriting NIDAQ code to use NIDAQ-mx and the USB X series devices.
Could someone please refer me to reference materials dealing with this subject, particular in regards to converting analog inputs and outputs from NIDAQ to NIDAQ-mx?
The primary difficulty I have encountered so far is how to convert the concepts used with the NIDAQ AI Read.VI, e.g. scan backlog, number of scans to read - the subject of data buffering, to NIDAQ-mx polymorphic Read.VI.
I assume the newer implementation should be simpler and I have looked at numerous examples VIs of both NIDAQ and NIDAQ-mx. I have programmed VIs for both NIDAQ and NIDAQ-mx. I just need something with an overview of translating the old concepts to the new concepts.
03-16-2012 12:53 PM
I did search the forum using: NIDAQ NIDAQ-mx
and did not find that document, so I am curious about the search terms you used.
I am familiar with the document "Transition from Traditional NI-DAQ to NI-DAQmx in LabVIEW" and used it when I first started programming for NIDAQmx. It is one of the references I hoped to find but not as helpful as I had expected. The word "scan" or "scans" does not even appear in it.
The problem is that it starts off with the advice to start with fresh code and goes from there. As the VI suite that I have inherited was developed over more than a year by a different programmer, a complete rewrite is out of the question, unless I fail miserably at conversion.
So I thank you for help but that document does not deal with the differences as conversions in concept, such as "How does the concept of scan counts translate to DAQ-mx? Is it meaningless, handled automatically, implemented differently?
Surely, I am not the only person who has had this problem.
03-16-2012 01:16 PM
I think you need to first get a good understanding of traditional DAQ. I'm assuming you have that installed as well as DAQmx. There is Windows help file (Traditional NI-DAQ C Function Reference) as well as the LabVIEW help for the functions. For your particular question, a scan is equivalent to a DAQmx sample. So, if a traditional DAQ function is requesting N scans, it would be the same thing as a DAQmx Read ( NSamp ) where you specify Number of Samples per Channel. A scan could be applied to a single or multiple channels just as a DAQmx Read could be used for 1Chan or NChan.
03-16-2012 01:24 PM
Thank you for that specific information. It will get me started.
I know about function help and do consult it frequently but it is very easy to get bogged down in specifics when I'm looking for an overview. It is sort of like trying to translate French to German and getting referred to single-language dictionaries. Knowing things like German putting the verb at the end of the sentence, as opposed to French using the same verb placement as English, is the level of general information I need.
"Scans" has so many meanings in different programming languages, I'm glad you could pin that down for me.
03-16-2012 01:36 PM - edited 03-16-2012 01:37 PM
I used the search terms "convert NI DAQ to DAQmx". I think I got 2 pages' worth of hits, so you might try it and see what you come up with. It find it very odd that you didn't get anything in the way of results. Lousy search engine?
I confess it's been a very long time since I used Traditional DAQ, so I fired up the old computer that has both Traditional DAQ and DAQmx on it, and took a look at the help files for a few of the Traditional DAQ VIs. As nearly as I can tell...
- a "scan" is simply a data point. If the buffer holds 1000 scans, it will hold 1000 data points. That appears to be per channel.
- the "scan backlog" is the data in the buffer that hasn't been read yet.
- the clock frequency (if you're specifically configuring a clock, using AI Clock Config) is the number of scans per second, which also seems to indicate that a scan is just a data point
I'm not sure what else you need to know...do you have more questions?
Ah, Dennis beat me to it!
03-16-2012 02:09 PM
The existing code uses the integer output from the Scan Backlog output of the AI Read.vi as an index for some array operations.
Is there a way to access the equivalent value, i.e. number of samples remaining to be read, in the NI-DAQmx scheme of things?
I have looked at Help - Property and Method Reference - NI-DAQmx Properties - DAQmx Buffer
and find only Input:Buffer Size and Inputnboard Buffer Size (which I think is a hardware-implemented buffer).
03-16-2012 05:14 PM
Since I don't have your code and am not sure exactly what it's trying to accomplish, the best suggestion I can make is that you use a DAQmx Read property node to find out the current read position during your acquisition. I assume you are performing a finite acquisition? If you're performing a continuous acquisition, you wouldn't have any way of knowing the total number of samples to be read during the acquisition.
The DAQmx property nodes are found under "Measurement I/O"..."DAQmx"..."DAQmx Advanced"..."DAQmx Constants and Property Nodes".
Is that at all helpful?
03-16-2012 05:44 PM
I had just independently concluded that "Current Read Position" has to compare to "Number Read" and "Scan Backlog" would have to be "Number of Scans to Read" minus "Number Read". I think "Number Read" will be one greater than "Current Read Position" if position is zero-based.
The trickiest part of finding this through Help is that the available properties for the Read Property Node are hardware-dependent. You can't find just the "generic" properties available on all devices.
You have been most helpful. Confirmation after my search was MUCH more educational than just getting the answer.