04-23-2008 12:19 AM - edited 04-23-2008 12:22 AM
DAQmxRead.RelativeTo=MostRecentSampleI have utilised the method and code documented/suggested by NI here :Application Case 6 - Hardware-Timed Simultaneously Updated I/O Using the Timed Loop
DAQmxRead.OverwriteMode=OverwiteUnreadSamples
04-24-2008 02:36 AM
04-24-2008 12:20 PM
Hello Peter_B,
I've looked over your VI, and I'm not sure that hardware timed single point acquisition is best for your application. The reason you see error -200010 is because you aren't reading the hardware timed point before the next point is acquired. This is a helpful error for this type of acquisition because it lets you know if you're missing samples. However, in your case you've said that you don't care if you miss points, so then I would suggest using either software timed single point acquisition or a buffered acquisition where you throw out all of the data you acquire except for the most recent point. Either of these methods would have a similar software timing delay to what you're currently doing, but would avoid buffer overflow issues. Another option would be to continually run the DAQmx Read and then use your button to control what you do with the data you receive--discard it or use it otherwise. Then you would be able to avoid the error by continually reading and still ignore points in software.
If there is another reason you're trying to use hardware timed single point acquisition then it would be helpful to know more about your application (maybe you're using a real-time operating system). However, from what you've mentioned thus far I would take one of the approaches I mentioned above. My guess is that you may have chosen "Hardware timed single point" acquisition because hardware timed indicates that the data may be more accurate or consistent. While it’s true that your samples will be consistently taken on each sample clock edge, since you’re deciding which samples to read by using a front panel button you inherently introduce software timing/delay into your system. If this is an unintentional decision then it would be helpful if you can describe what you mean by "it doesn't matter if I miss samples" and more about the sampling needs of your system.
I hope this helps, and have a great day!
04-24-2008 06:23 PM - edited 04-24-2008 06:31 PM
04-25-2008 04:24 PM
Hello Peter,
I cannot run your code directly b/c I don't have hardware configured like you do. I've made an example VI that just does the acquisition using a buffered acquisition at 100Hz that only continually reads, but only updates the graph with the points that you specify. You can compare the points you're reading with all of the data by comparing the graph inside and outside of the case structure. This should yield a nearly identical sampling timing and avoid the time out errors you're receiving.
If this VI doesn't do what you're looking for it would be helpful if you could post a simplified VI that includes the controls you want and only needs a single board to execute, that way I can try out your code to see how you want your update to work.
I hope this helps, and have a great weekend!
04-25-2008 11:58 PM
04-28-2008 04:45 PM
Hello Peter,
That sounds like a fantastic way to spend the weekend! I'm a dog lover as well, and I've been considering getting a dog of my own. I reall enjoy going to the off-leash dog parks around here with friends (and their dogs).
Down to business... I should have looked at your VI closer to begin with and realized it was just a single device. I've since gotten it to successfully run on both my PCI-6251 and PCI-6220. I've spent the last 30 minutes or so running your VI, and I haven't been able to reproduce either of the errors you've described--they work great!
That being said, my concern would be with the VI is stressing your computer's processor which could cause the loop to run late. We can test this theory by reducing the timed loop rate--if it works for you with a slower loop rate then this is likely the problem. If it still throwing these errors with very slow rates then I would look at the computers CPU usage with the Windows Process Manager (ctrl+alt+del and then choose task manager and look at the system performance tab).
I was able to make the VI exit because of the "loop has run late more than 200 times" condition by opening about a dozen web browsers during the VI's execution, but anything short of that and I couldn't get more than one or 2 late iterations in half an hour. When I did cause the loop to run late by stressing the CPU I still didn't observe the error message you've seen.
Do you have another (possibly faster) machine you can test your VI on? Also, if you have a lot of processor intensive programs running on your computer you should try chosing those and then running the VI. If we find that the issue is that your computer can't handle these rates then I think that the buffered acquisition may provide an acceptable solution, however I understand your reasoning for wanting to use hardware timed single-point so we can cross that bridge if it comes to that.
Cheers,
04-28-2008 06:25 PM
04-29-2008 06:23 PM
08-05-2008 10:38 PM