08-16-2010 09:38 PM - edited 08-16-2010 09:40 PM
System:
WinXP, LabVIEW 2009, DAQmx, Mseries 6259
Here's what I want to do, but kind of stuck on what DAQmx functions to call, or even if this is possible without keeping track of the update (err, Sample) clock myself.
I'm continuously outputting the contents of the onboard FIFO.
At some undetermined time, I would like to stop that generation, but have it terminate at the last sample of the period. Even better would be any random point in the FIFO of my choosing, but the end of the FIFO will do.
Poking around in the help and online doesn't seem to give any obvious conditions for stopping the clock, and the task, based on a condition of that sort. If the answer is 'no can do' I imagine keeping track of the clock count, DIVing by FIFO size, something along this lines.Seems like too much fiddling around for a very basic behaviour - can't help but think I'm missing something obvious. Or go to using a buffer - so wasteful for a periodic waveform though.
Thanks!
Solved! Go to Solution.
08-18-2010 12:07 PM
Howdy FTI!
I've discussed your question with several other engineers and we have not been able to come up with a simple solution to do what you want. The "undetermined time" part makes this a tricky problem!
What is the sample rate you are outputting? I assume it's probably fairly fast, but if it's less than 100Hz then we could consider using software timing.
What is the signal that tells the system to stop generation? Is it a software control or a hardware signal coming in on a PFI line?
I've been trying to think of a way to accomplish your task in hardware (even considering external circuitry and connections), but unfortunately have not thought of a solution yet.
Regards,
08-18-2010 12:19 PM
No, it's fast. 5-10kS/s depending.
The signal is a user input. Because the waveform is periodic, I know the value at any point in the FIFO.
If the user says "I want to stop generation and hold the voltage at .5V", I would like to be able to let the FIFO run until it gets to the sample that holds .5V then stop.
In a more limited case, and one I thought was possible, I would have like the user to be able to stop generation at any time, and have the FIFO stop at the end with a fixed value of 0V. I know I can do this with a subsequent write, but I didn't want the discontinuity. (I'm controlling motor torque and don't want step changes).
Barring something that lets you sto pthe clock at a particular location, the next idea I have in mind falls into two camps:
1) retriggerable finite generation, and the user basically stops the retrigger
2) using a counter as the update clock and gating it to end on the sample I want.
I haven't tried either yet. I was hoping I wouldn't have to resort to it.
08-19-2010 05:24 PM
I discussed your question with JohnP and we came up with a solution. Check out this example I made for the NI Developer's Community. Let me know if you have any questions about it.
I hope it works for your application!
Regards,
08-19-2010 05:33 PM
That's what I was afraid it would resort to.
Unfortunately, I am using those counters to measure input and output shaft speed!
Oh well. It's a workable solution, and I appreciate your efforts! Thanks!
08-19-2010 06:19 PM
An alternative would be to use non-regeneration so you could control in software which sample is the last one you write to the board.
Best Regards,