Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Continuously adjusting Counter Output High/Low times?

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.

0 Kudos
Message 1 of 5
(6,203 Views)

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

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 2 of 5
(6,201 Views)

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).

0 Kudos
Message 3 of 5
(6,177 Views)

Sorry, i forgot to attach my recent programme:

0 Kudos
Message 4 of 5
(6,176 Views)

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

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 5 of 5
(6,137 Views)