07-20-2012 04:07 PM
The subVi is responsible for retrieving o2% and Temperature data from a DAQ Assistant. The mainVI is responsible for writing the compiled data from my sensor and data from the subVI (O2%, Temperature etc. ) into a write to measurement file. The problem is, if you look at my .txt file, there is an incredible of unnecessary data that I wish to throw away. I really only want one sample per loop, in other words my O2%, Temperature etc. data needs to match up with my mass data. I'm getting continous sample data, I have tried changing to continous sample (1 sample per loop), 1 sample (on demand). I hope this is clear enough, I would really appreciate the help. Thanks.
Solved! Go to Solution.
07-20-2012 04:17 PM
In your picture your SubVI is set to take 100 samples. Are all the express VI's set to take only one sample in the SubVI?
There are options to not save the header in the write measurement file express VI.
07-20-2012 04:37 PM
Thanks for your help!
Initially I had the VIs set to continuous sampling and 100 samples.
What I am unclear on is if it is possible to trigger a daq assistant from a VISA read. I'm sorry if it was unclear previously. All the DAQ assistant data comes in, and separately I have an 'auto-printing' serial device. I want to get one sample of each, each time step
07-20-2012 06:30 PM
Hi,
You can make a VISA read trigger anything with the appropriate logic to interpret the VISA reply, or lack there of, and a T/F case. I don't think there are any DAQ assistants that have a VISA input and that act on that input.
If you want to read from a serial device and separately DAQ, and you want to print those two sets of data together you would put the two data sets into your file save routine,maybe two file saves in series to the same file (one for each data set). If you DAQ data set is one element or one row there is not a big difference when saving "it"
Still not clear on the big picture, your last sentence did not have a lot of context. Hope this helps
07-23-2012 12:15 PM
Hi,
Thanks again for your help.
I guess what I am struggling with is how to compose the logic for a VISA read trigger. I have no trouble printing all the data to a file, its just that I am getting 10 lines of DAQ readout for every VISA readout in my output file. (Note the attached test_6.txt with the original post where I only have one readout in column two and 100 readouts in all the other columns).
07-23-2012 12:33 PM
You have 100 readings because that is what the DAQ Assistant is set for. You say you have changed the DAQ Assistant for a single sample but neither your image or text file shows that. Change it, rerun, and then post that code with the text file.
If you want the VISA Read to happen after the DAQ Assistant, then use the Error Out of the DAQ Assistant and wire it to the Error In of the VISA Read.
07-23-2012 12:35 PM
With regards to VISA, I'm suggesting that after a VISA read, you can perform some analysis of the response, and then trigger a case to then take a DAQ measurement. That way you could get a one for one set of data, one VISA read and one DAQ read.
What you have in your main code now is one VISA read and then one DAQ read, then loop. So data flow is taking care of any need to trigger the DAQ, it will always follow the VISA read. The question is how is the DAQ set up ( one, ten or a hundred samples?)
It seems your DAQ is the culprit, it is probably set to take ten sets of measurements. I don't use the express VI's myself, but if you want only one set of data each then look at how the DAQ express are set up. Also, you might look at how the assistant saves the data also.
07-23-2012 01:10 PM
Hi,
Thanks for the reply.
Attached are the rerun for 1 sample (on demand) in the DAQ assistant. However when I run my main VI, I get an error. This doesn't happen when I run it continuously. What I want is leave my visa output alone and have only the first outputs from the DAQ come out. In other words only capture that data frame in sync with my visa. test_2.txt looks like what I want, I dont get a bunch of unnecessary data, however i want this to continue until I stop the VI.
Thanks again.
07-23-2012 01:22 PM
According to the first file, you were not correctly getting a serial read there either with a 0.00000 reading in the file. That is a separate issue. The code is inside a while loop so it will acquire until you click the stop button.
Have you ever run the VISA code where you get an actual reading? I would suggest you separate that part out or even doing some debug with a program such as Hyperterminal.
07-23-2012 02:45 PM - edited 07-23-2012 02:47 PM
Hi,
Time to troubleshoot that error from one on demand point. What is the error code, and where does it occur in the code?
I agree with Dennis, separate the VISA and DAQ to test them out and make sure they work. You can use the disable diagram to "turn off" one set or the other in order to test them independently.
I am assuming you can use MAX to get the VISA instrument to properly respond. Sounds like the DAQ works, but not in on demand mode. Knowing where and what the error is will help a lot.
***
Is it possible to have the DAQ assistant only save one "row" of the dynamic data? I imagine it is, but I don't use them to know off the top of my head. This would be a work around, better to resolve the error from the on demand.