07-30-2007 05:55 PM
07-30-2007 07:42 PM
07-30-2007 09:09 PM
07-30-2007 10:25 PM - edited 07-30-2007 10:25 PM
It looks like the DWDT signal generator is creating a 2 signal by 1 sample array. However, the resulting waveform goes into a 1 channel N sample digital write. Perhaps you want to set the controls to be 1 signal, 2 samples? Or set the digital write to be N channels N samples?
Put an indicator on the output of the property node that feeds into the #of samples of that signal generator. I simulated a DAQ card in order to get the VI to run. Perhaps rather than using the property node, just set the value to 2 with a constant. Of course that will make the 2nd sample to be random as well and you said you want it to be false. So instead append an array of false values to the array that comes out signal generator array.
Also, you say that you want to generate random values at each iteration, but in the structure of your code, you generate the random values only once at the vary beginning of your code. Then those same values are output continuously until the code ends by hitting the stop button.
Message Edited by Ravens Fan on 07-30-2007 11:35 PM
07-31-2007 09:24 AM
07-31-2007 09:41 AM
07-31-2007 11:28 AM
07-31-2007 03:56 PM - edited 07-31-2007 03:56 PM
Message Edited by Ravens Fan on 07-31-2007 04:57 PM
08-01-2007 08:20 AM
I'm not near a LV PC and can't look at code. You're getting great help from Ravens Fan, I just wanted to add a thought or two. I'm thinking maybe your app doesn't demand as much complexity as you're approaching it with.
- How critical is the 50 msec timing? Does it have to be hardware-timed for high precision? Or could you consider software timing that will usually be within 1-2 msec, but may occasionally be much longer? The app would be simpler to program with direct software-timed digital output, but the timing precision would suffer.
- Any DAQ output task where you write to the data acq buffer (with DAQmx Write) immediately before that data is due to be generated as hardware signals will be prone to errors such as the one you're seeing. It's really the same issue as above -- the software timing isn't reliable enough to exactly keep pace with the hardware. The typical solution is to write to the buffer farther in advance of when the data needs to be generated as hardware signals, like maybe a second or two.
- You said you need to re-randomize every 100 msec. If truly random, then it doesn't correlate to anything happening during program run-time. Thus, all the random patterns could be pre-computed and you can pre-write much or all of it to the data acq buffer before starting the task.
Am I understanding you right? It doesn't matter *when* you calculate the random pattern, only that those different random patterns start every 100 msec with a 50 msec duration? If so, you could probably make this a simple finite acquisition operating at 20 Hz (probably using one of the counters as the sample clock). Even for 10 minutes of pattern generation, that's only a buffer of 12000 samples. That'd be no problem for DAQmx to handle as a finite output task. You could go hours if needed.
(P.S. Note also that with 12 valves, only 2**12 == 4096 patterns are possible. There are fairly easy ways to pre-define a pseudo-random sequence of those 4096 possible patterns that hits them all exactly 1 time. You could perform a continuous acquisition and only write those 4096 patterns one time then let them be regenerated in hardware for as long as you want.)
-Kevin P.
08-01-2007 08:58 AM