01-24-2006 02:00 PM
01-24-2006 04:58 PM
01-25-2006 05:07 PM
01-25-2006 09:41 PM
02-02-2006 03:33 PM
Have wanted to explore M-series DO more before posting back but have been tied up in non-hw parts of the app. I'll intersperse my comments in context:
reddog: for subsystems that don't have their own timing engine (such as correlated digital output), there is no way for the device to know how many samples have been generated. In this case, TotalSampPerChannelGenerated represents the total number of samples that have been written to the device... query the Output.OnbrdBufSize property, you'll see that the digital output FIFO size for the 6259 is indeed 2047 samples deep.
...it's not clear if you're snapshotting the progress while the generation is running...
02-02-2006 03:33 PM
...can you use the Current Read Position from the DI task as your index into the master list instead of the TotalSampPerChannelGenerated property?
Instead of regenerating data, can you disallow regeneration of data and manually track how many points have been written to calculate your index?
is your master list really just a giant buffer that you begin generating data from within at a random position and then automatically increment from there
02-05-2006 11:52 PM
Thanks for the detailed description of your application. There is still one thing I would like to clarify though. If I understand correctly, your buffer will hold one sample of the 100 usec pattern and 49 samples of the 4900 usec pattern. What's still unclear is when and how you plan to change the buffer contents from one set of patterns to the next set of patterns in the sequence of 12. Do you plan to generate the 50 - 15000 samples with the same DO buffer while using the finite AO task as the clock source, rewrite the DO buffer to the next set of data after the AO task completes, restart the AO task, and continue to repeat this process, or do you plan to update the DO buffer throughout the 50 - 15000 sample generation?
If it's the former, I would probably recommend not using change detection and instead use a correlated DI task to track progress. This eliminates the complexity of reading the TSG property on the DO task (which is always a moving target) and then trying to correlate that back to the data acquired through the DI task (which is also a moving target). It is more processing, but you're throughput requirements are fairly small so I don't think it should be that taxing on the system. If you still want to try change detection and are using the ao/SampleClock as the clock source of the DO, you can use the TSG property on the AO task instead. Since the AO task has dedicated counters for its timing engine, the TSG property for AO will reflect the number of points clocked out and not the number of samples written to the device. You'll still have to deal with the "snapshotting" problem, but at least you'll have eliminated the uncertainty of the device FIFO. I would caution you against trying to use the DO TSG property and just always substracting 2047 to compute the actual number of samples generated. The 2047 samples defines a window of uncertainty and not a fixed offset. While the driver will try to write data to the device anytime the device FIFO isn't full, whether it is able to do so or not is determined by the amount of traffic across the PCI bus. This means there can be anywhere from 0 - 2047 samples in the device FIFO at the time you read the property. One last thing to consider when using a continuous DO task with regeneration, if you plan to update the DO buffer while the clock isn't running and then restart the clock, you'll still have old data sitting in the device FIFO unless you first stop the task.
If your plan is to try to do the latter where you're updating the buffer while actively clocking out data, you'll need to consider what latency you're willing to live with when updating data (e.g. upon writing data to the buffer, how long does it take the new data to show up on the output). With your current configuration of buffer regeneration allowed, a 50 sample buffer, and a 2047 sample FIFO, you will need to wait 2096 samples (2047 + 49) or 2096 usec worst case before the new data you wrote is output. If this isn't acceptable, you'll have to make some trade offs. You can either:
1.) Generate a larger buffer by duplicating data and generating at a higher sample rate. The downside here is that it requires additional bus bandwidth and processing power if you use correlated DI instead of change detection.
2.) Change the default data transfer request condition. The default is onboard memory not full. You could change it to Onboard Memory Half Full or Onboard Memory Empty. Changing to empty provides the least amount of latency, but you also achieve poor overall throughput since you have a jitter tolerance of only one sample before an underflow condition. When I've tried using transfer conditions of empty in the past, I usually only see throughput rates around ~10 KS/s so you may be pushing it with this configuration.
3.) Disallow regeneration of data. The downside here is that you have to constantly write new data at a rate that keeps up with the sample clock rate. However, since regeneration is disallowed, you directly control the latency by choosing how much data you write to the buffer at a time. Another advantage of this method is that if you're directly controlling the clock, you can precisely write N samples and clock out N samples without generating underflow conditions or repeated data.
I hope some of this information will help with your application.
02-06-2006 01:24 PM
If I understand correctly, your buffer will hold one sample of the 100 usec pattern and 49 samples of the 4900 usec pattern. What's still unclear is when and how you plan to change the buffer contents from one set of patterns to the next set of patterns in the sequence of 12. Do you plan to generate the 50 - 15000 samples with the same DO buffer while using the finite AO task as the clock source, rewrite the DO buffer to the next set of data after the AO task completes, restart the AO task, and continue to repeat this process, or do you plan to update the DO buffer throughout the 50 - 15000 sample generation?
02-09-2006 10:11 AM
06-13-2006 10:35 AM
Once again, thanks for all the previous detailed help. I've got everything up & working properly so I figured I'd update & close the thread out.
I had to abandon the "change detection" approach for reasons I failed to anticipate -- signal propagation time differences. The 24 input bits I wanted to read were NOT synchronized by our external hardware. The signal propagation times were just different enough that I would sometimes get 2 or even 3 different change-detection events from 1 output pattern change. The 2 or 3 changes were all in response to the same 1 output pattern change, but the transitions weren't quite in sync.
So I decided to try to simply use fixed-rate hw clocking instead. I setup my correlated DIO clock at a 90% duty cycle, generating DO patterns on the leading edge and measuring DI patterns on the trailing edge. I found that I was able to perform the necessary pattern matching at 10 kHz without drastically bogging the system down. I've stuck with constant-rate sampling ever since, with the added benefit of making it much simpler to correlate the output and input patterns to one another.
-Kevin P.