Discussion:
DAQ Assistant vs. DAQmx
(too old to reply)
NT_Engineer
2008-07-21 23:40:06 UTC
Permalink
I am working on controlling 13 solenoid valves, one at a time, and a was wanting to know whether it is better to use the DAQ Assistant or use individual DAQmx for each solenoid valve?
 
Also,  what would be your recommendation to log data that corresponds to each valve as shown below?  I am debating using the ActiveX features to write them directly to an Excel spreadsheet or use the Write to a Measurement VI to a text file. Also, if you have links to examples, that would be much appreciated.
 
Valve     %CO2     Time (DD:HH:MM)     1            10%       00:10:30     2            9.5%      00:10:31     3            9.75%    00:10:32     ...            ........      .........
 
 
knapkerd
2008-07-22 02:10:05 UTC
Permalink
How fast are you acquiring the data and for how long?  Will it be a continuous data acquisition?  Also, witht he DAQmx you can make a task (using the Measurement & Automation program), which will allow you to use just one DAQmx with all 13 channels.  I have used the DAQ Assisant and it is easy to use, but for fast continuous acquisitions, you may run into problems.
Writing to a Measurement VI has worked well for me and you can open it in excel afterwards.  Again, if you are aquiring alot of data quickly, a more efficient write to file may be needed.
However, looking at you example of the data, it appears that you ar collecting data slowly (on the order of minutes).  In this case, I would recommend the DAQ Assistant and the Write to Measurement VI for ease of use.  Using other options would give you more choice on how things are done, but would be more complex.
Hope this helps.
--Robert
NT_Engineer
2008-07-22 02:40:04 UTC
Permalink
The test will run for weeks at a time, and it will take about a minute for the CO2 measurement to stabilize.  Creating a Task in Measurement and Automation sounds good, but I have never used it before.  What is the learning curve for the program, and how easy is it to implement it into the main program?
 
 
Dennis Knutson
2008-07-22 02:40:05 UTC
Permalink
What you don't explain is what you are using to control the valves. Is this digital output? If you are using separate DAQ Assistants for this, then each task may be starting and stopping each time. You could combine all channels into a single DAQ Assistant and have comparable performance to the low level DAQmx functions with all channels in a single task. If you wanted separate tasks, then I would recomend using DAQmx and create/start the tasks outside your main loop. Close the tasks when the loop finishes.
p.s. To me, creating a task in MAX is silly. It's just as easy to create the task in the code.Message Edited by Dennis Knutson on 07-21-2008 08:35 PM
NT_Engineer
2008-07-22 17:40:05 UTC
Permalink
They are 24 V solenoid valves.  We are going to use the NI 9472 to control the valves.  However, while we are waiting for this to arrive, we are currently using an old BNC-2120 that has 8 BNC Analog inputs, 2 analog outputs, and a 8 digital I/O port.
I've tried to use the DAQmx to simply send out a LabVIEW generated sine wave, but I receive an error 200288. I've also tried using the DAQ assistant to send out the same sine wave, and I try measuring it on an O-Scope, but all I get is noise.  I can use the DAQ assistant to get data from the BNC-2120 no problem, but cannot send analog or digital outputs correctly.  I've attached the two test VI's I was working on. Maybe I'm completely using these features incorrectly.  LabVIEW 7 was really easy to control individual inputs and outputs with AI Acquire Waveform.Vi and Write to Digital Line.VI, but I cannot find those features on 8.5. 
If I'm using these tools incorrectly, please tell me the proper way to use them.  I've tried using the LabVIEW help  menu, but that is like reading foreign language to me.
 


DAQ Assistant Test.vi:
http://forums.ni.com/attachments/ni/170/343022/1/DAQ Assistant Test.vi


DAQmx test.vi:
http://forums.ni.com/attachments/ni/170/343022/2/DAQmx test.vi


error.txt:
http://forums.ni.com/attachments/ni/170/343022/3/error.txt
Dennis Knutson
2008-07-22 19:10:09 UTC
Permalink
You are probably used to using the high level traditional DAQ functions such as AO Generate Waveform. They actually call a variety of other functions and it is the similar functions in DAQmx that you are not calling. You are not doing any configuration at all. I would suggest you start with the shipping examples to see how to properly configure a task for sample rate, etc. You also use a predefined task in MAX and there is no telling how you have configured that since it is external to the code. There are some basic examples for analog out and digital. I'm not sure what you could have done wrong with the digital since you did not post that code. For the DAQ Assistant code, I'm not sure since I never use the assistant but you could try checking the Use Waveform Timing box. This is next to the Generation Mode selection.
NT_Engineer
2008-07-22 19:40:08 UTC
Permalink
Okay, I've finally get a waveform off of the DAQ board.  I think what happened was I was using a frequency too low for the DAQ board to generate.  However, I am receiving an error 200016 after it runs for a few seconds.  Saying "Onboard Device Memory Underflow."  I'm not sure what that means.  It tells me to increase  the sampling rate and number of samples, but I still get the same error. I've attached the update VI and the error.


DAQ Assistant Test2.vi:
http://forums.ni.com/attachments/ni/170/343073/1/DAQ Assistant Test2.vi


error 200016.rtf:
http://forums.ni.com/attachments/ni/170/343073/2/error 200016.rtf
Ravens Fan
2008-07-22 19:40:08 UTC
Permalink
Please don't attach a 322 kB attachment of an .rtf file that is nothing but a small screenshot as a bitmap.  Just post the screenshot itself as a .png file.
NT_Engineer
2008-07-22 20:10:06 UTC
Permalink
Sorry about that, I did that in a hurry. 

So, do you know what that error 200016 means, and how to correct it?  I receive the same error whenever I tried to run the example "Cont Gen Voltage Wfm-Int Clk.vi" that comes with 8.5.
Dennis Knutson
2008-07-22 20:10:08 UTC
Permalink
What is your actual DAQ board? The BNC-2120 is just a terminal block.
NT_Engineer
2008-07-22 20:40:06 UTC
Permalink
I'm not totally sure which one it is, the PCI-6251 or the 6024E.  I have put a screenshot of the Hardware detected from MAX, but it indicates that we have two devices.  Whenever we would use "Write to Digital Line.Vi" in 7.1, we would assign the VI to Device 1.  However, it appears Device 1 is empty.  I've put the screenshot for the 6024E as well.


MAX.PNG:
Loading Image...


MAX2.PNG:
Loading Image...
NT_Engineer
2008-07-22 20:40:08 UTC
Permalink
I should've noted this on the post before. The final system will use the Chassis system with the NI 9472 to control the 24 volt solenoid valves.  That equipment was just ordered, and so I am trying to design portions of the system on our current hardware, which I indicated in the previous post, while I am waiting for the new equipment to get here.
Dennis Knutson
2008-07-22 23:10:14 UTC
Permalink
I have no idea what would cause the N/A to appear unless the board is not fully seated and it cannot read the info from it. I would not try to use it until that was fixed. Try removing the board and inserting it again. You might want to try it in a different slot.
NT_Engineer
2008-07-22 23:10:18 UTC
Permalink
It is showing up as Device 1 under Traditional NI-DAQ Legacy tree.  For some reason it is identified as Device 2 under NI-DAQmx Device's tree.
Dennis Knutson
2008-07-22 23:10:18 UTC
Permalink
I can believe that for the E series board but the 6251 is an M series and should not be detected by traditional DAQ at all. Whatever devices you have listed under traditional DAQ, you want to reset them so that the DAQmx driver is active.
NT_Engineer
2008-07-23 20:40:07 UTC
Permalink
Okay...I found a good video on NI about using DAQmx for inputs and outputs, and I've gotten both examples to work.  I am now editing those programs to read in a K-type thermocouple one sample a second, and the duration of the program is entered in by a user prompt and is controlled by the Elasped Time VI.  The program is operational.  However, the program starts logging data even before the user enters in the length of the test.  So, if I press the start button and enter in 30 seconds for the length of the test,  the program will execute.  However, when I open the text file where the results are stored,the file includes samples taken before I entered in the 30 seconds.  How do you synchronize the logger not to start until the user enters in the test length information?
I've attached the VI for the program, and a .txt file of data logged.
 
 


Thermocouple Input with Prompt1.vi:
http://forums.ni.com/attachments/ni/170/343470/1/Thermocouple Input with Prompt1.vi


thermo 9 txt.txt:
http://forums.ni.com/attachments/ni/170/343470/2/thermo 9 txt.txt
Dennis Knutson
2008-07-23 21:10:05 UTC
Permalink
The read and logging is not starting before the test time is entered. What in the data file makes you think it is?
NT_Engineer
2008-07-23 21:40:05 UTC
Permalink
I set the time of the test for 30 seconds. However, it is logging samples before I press the ok button on the User Prompt.  I deliberetly waited about 10 seconds before pressing okay, and if you look on the .txt file it logs data from 0 to 39 seconds instead of 0 to 30 seconds, 9 samples too many. I do not want the program to log data until I press the ok button. 
Dennis Knutson
2008-07-24 00:40:04 UTC
Permalink
I don't think the number of samples that are written is necessarily going to be 30 when you run the loop for 30 seconds. I's going to be the number of samples that the DAQmx Read returns. You are telling the DAQmx Read to return however many samples it has available and you are not sampling once a second.
Edit - I just ran your VI and I keep getting an error. That's probably because you have it set to continuous. With the Write to Measurement File inside the loop, it takes too much time to write to a file each time. Try setting it to finite samples and requesting a fixed number of samples.Message Edited by Dennis Knutson on 07-23-2008 06:29 PM
NT_Engineer
2008-07-24 00:40:04 UTC
Permalink
Well, I am telling DAQmx to take 1 sample a second, and according to the .txt file it is taking 1 sample a second.  So, If I tell the program to run for 30 seconds, I should theoretically receive 30 samples.  I've deliberately waited for fixed intervals before clicking the okay button to see how many extra samples I receive, and every time I've done that I receive x amount of extra samples which equals the amount of time I waited.  I've tried with waiting 3, 5, 10 seconds. 
Dennis Knutson
2008-07-24 01:40:07 UTC
Permalink
Are we talking about the same VI? The one you posted has a sample rate of 1000/sec and you tell it to return however many samples are available.
In any case, I think I see a dataflow issue. Wire the error out of the dialog to the error in of the Start Task. That will make the Start Task occur after the dialog.
 

Loading...