03-03-2011 02:55 AM
Hi,
I'm trying to use the counter output of a NI USB-6259 device (under LabVIEW 8.0) to provide pulses with a fixed high time, and adjusted low time. I'm using a the DAQmx Write VI inside a While loop. Before writing, i read the current low time from a file. I need to do the pulse generation with an average frequency of ~500Hz (i.e. low times at about 0,002 s), with some of the samples being quite short (down to 10e-6 seconds). Despite of this, i can only generate at about 30-50 samples per second. As i have previously tested the speed of the read from file function in another VI, i'm sure that the reason for being so slow is the slowness of the DAQmx Write. If i could load an array of my desired low times to a Counter Output buffer, i think i could reach the speed i want. I'm afraid there is no possiblity of doing this at all. Am i right? If not, how can i do this?
Regards,
Peter
P.S.: I have found quite a similar question, this one, i only dare to ask this because the other topic is 5+ years old. I hope something changed since then.
P.P.S.: i don't have the the proper DAQmx driver installed on the computer i'm writing from, so i'm unable to open the VI, or take any pictures yet. I can do that in a few hours, if necessary.
03-03-2011 08:21 AM
1. You *might* be able to get satisfactory results with your M-series board using software-timed on-the-fly updates to the pulse parameters. It depends whether you need to generate every individual pulse at a precise time, or whether you just need to update the pulse specs pretty regularly at approximately 500 Hz. To take a shot at this, you should avoid reading from a file inside your loop.
2. The newer X-series multifunction boards now support variable-timing buffered pulse trains. Your M-series board still does not, though you could consider making this a buffered digital output task with a (large) predefined buffer to define the pulse train.
-Kevin P
03-04-2011 06:31 AM
Thank you for the ideas, Kevin. I need to generate every pulse at a precise time. Since your reply I made a version in which I read all the data from the file before passing them to the DAQmx Write. Now i get Error -200301, with the following possible reason: "Cannot update the Pulse Generation property. The pulse generation with previous property settings must complete a full cycle before the property can be updated." I also tried to use a Wait (ms) VI to solve this, that didn't help me, either. Now it seems the new data arrive at the input of the DAQmy write before the generation of the previous data ends. Is there any solution for this? I've been also thinking about the buffered digital output task, but it would be ridiculous to place ~500 data to an array with a size at about ~10e6 (if i use microsecond resolution).
03-04-2011 06:33 AM
Sorry, i forgot to attach my recent programme:
03-07-2011 10:40 AM
1. I don't know what's in your file, but you are reading floating point values which you immediately convert to integer
in the array you are building. You later compare them to the min low time of 1e-5, so I've gotta figure the file
holds floating point values and you should accumulate them in a floating point array.
2. With software updates to the pulse specs, I think it is *not* going to be possible to precisely define each and every
pulse interval. If you wait long enough to avoid the error you've already seen, you'll end up generating 2 or more cycles
at the previous pulse specs before the new ones you write take effect.
Even though it seems "wasteful" (and I agree 100% by the way), your best option with the M-series board you
have is to predefine a huge buffer of digital states just to define the few precise edge times you really need. The
X-series boards allow buffered counter output tasks, which provide a much more efficient way to accomplish this
kind of app.
-Kevin P