09-02-2015 09:53 AM - edited 09-02-2015 10:00 AM
Hello again,
Still struggling with DAQmx acquisition. I was playing around with using digital inputs to start and stop the acquisition, as well as flag certain points within it. Non-stop errors around how I am reading/buffering the data. Still need to get my head around exactly what's happening there. It would be great if the function help was more explicit. Anyway…
I’ve whittled it down to what seems very simple. There are two digital inputs: Weld Cycle Start, and Part Contact. I am using the first as a start trigger, and the second as a reference trigger to aquire 4.5s of data after contact, and 0.5s before.
I want to create a new file and log this data directly to it. Don’t care about reading or displaying – we can do that later – just need to capture it on the hard drive.
My specific questions to the group are:
Learning hurts, but giving up is not optional…
Thanks in advance for your help!!! Kudos will go to the solution, I promise!
Solved! Go to Solution.
09-04-2015 07:04 AM
Hmph ... Not much help.
There is very little info available for logging... I'm still waiting for some BNC pigtails so I can connect my triggers and actually test this, but I did run it and it times out on the "wait for task to complete."
I removed that, and the query task complete. Now it just runs and stops. Why doesn't the "start" wait for the trigger? This would make more sense if the trigger had a wire I could connect to the start task vi.
99.999% of DAQmx examples include a read function. What if you don't want to read? Do you even need to start the task?
I'm still lost, but I'll figure it out.
09-04-2015 11:00 AM
Hello greyhorn,
You will need a read function in order to complete this task. There are a few examples that you will want to reference to accomplish this task. First, take a look at "simple queue.vi" to show you how to write every 15 seconds. Another helpful example to look at is "Voltage - Continuous Input.vi." This shows proper formatting for reading and writing data. Between the two examples, you should be able to perform the tasks you are wanting. Hopefully, this gets you going in the right direction.
Regards,
09-04-2015 11:44 AM
Hi John!
I appreciate your response. I'm going to latch on to you like a drowning man here... 🙂
You said I MUST have a read function. Okay, that helps. I was confused about what the "read" actually did. I thought it was for displaying data on the front panel. I was confused by the DAQmx help, "Log data only. For very high-speed acquisitions, logging and reading data can slow performance," and several example block diagrams that did not include the read function...
Can you speak to that?
Looking at the "continuous voltage" example, I assume I would just leave the "data" out terminal unwired since I don't care about displaying, only logging?
Also, in the "finite voltage" example, the read function is not inside a loop. I'm doing a triggered finite measurment, not a continuous measurement -- so I should follow the "finite voltage" example, correct?
And in that case, can you suggest or point to a nice way to run this task again without having to call a sub vi? I think I would need a while loop somewhere, but I'm not sure where (again, referring the the NI example for finite voltage).
I did find the "simple queue" example, but it was way above my head. However your comment "write every 15 seconds" is not precisely what I want to do. The machine has a 15 second cycle time, but I need to trigger the aquisition with the start of the weld cycle, not time. The time varies slightly, there are machine faults, etc. I want to aquire when triggered, log it to a file, then wait for the next trigger -- even if that takes hours or days.
I will keep working, but if you could respond to my questions, that would be a tremendous help!
09-04-2015 11:48 AM
Oh, and one more question regarding the examples:, if you don't mind?
The case structure with "trigger type" has the option of using a start trigger or a reference trigger. IAlthough I can't find it at the moment, I was under the distinct impression that you could not use a reference trigger without a start trigger before it.
Can you please confirm or deny that as well?
09-04-2015 11:56 AM - edited 09-04-2015 11:57 AM
DAQmx read reads the task that you created. If you don't read the task, all you will be doing is creating a task with trigger conditions and then never reading the task to get the data that is there.
The data terminal from DAQmx read needs to be wired to a file I/O vi. Without the data wire connected to anything "DAQmx read" will read the task but the data won't be stored anywhere.
09-04-2015 12:02 PM
Thank you, Sir. I follow that.
I noticed the "configure logging" creates a file -- I would then use "tdms open" to open it, "tdms write" to fill it, and "tdms close" to close it, correct?
What does the "configure logging" actually do for me, then?
09-04-2015 12:09 PM - edited 09-04-2015 12:16 PM
Ah, I missed the configure logging vi in your code. I haven't used this VI before, but I believe you need the DAQmx read before the configure loggingthen it should log the data to the TDMS file that it creates.
Edit: It looks like you do not need a DAQmx read VI unless you need access to the data. I think your problem might be that you have the configure logging VI before you have the Start task VI. Try putting the Start task VI before the logging VI and see what happens. You can also check out the help for the Configure Logging VI for more info.
09-04-2015 12:34 PM
Ah, here's an example right from NI website RE: the new .tdms file format.
No read function. I'm going to try and copy this but use finite measuring and a trigger. We'll see what happens.
RE: the start/reference triggers -- I beleive the example vi's are wrong, at least for my hardware. I remember now trying to use a reference trigger only and it threw an error telling me I had to have a start trigger before...
09-05-2015 08:53 AM - edited 09-05-2015 08:53 AM
This works. Thanks to all who tried to assist -- but no Kudos this time 🙂