03-30-2011 10:12 AM
Hi everyone,
after posting an initial question on how to trigger the AI with an external TTL pulse I think after a lot of digging around this forum I have a better understanding what the PCIe 6259 card can/cannot do for my problem. Here I want to present two different ways of how to retrigger an AI acquisition. Usually, this is done my making use of counters as some examples shipped with Labview show. However, I do not have any counters free on my board so I need some work-around on how to retrigger AI measurements. The M-Series does not support native AI retriggering (the X series boards so).
My specific problem why I need to retrigger AI measurements:
The application is a 2D raster scan in xy. I have a controller which drives a scanning stage. I can tell the controller to start the scan. When it is scanning, I need some way of registering/synchronization where the stage is. The 2D scan is a uni-directional scan, which means, that a line is scanned from left to right. The following line is again scanned from left to right. Each time, the controller is putting out the next line it gives a TTL pulse. Off of this pulse I want to trigger an AI measurement (which records the voltage of a light detector).
Let's imaging the following: I want to scan an area of 100x100 pixels. The pixel dwell time is 100 µs (=0.1 ms). So, when starting the scan, the controller puts out a TTL pulse telling me it started the first/new line. I now want to trigger an AI measurement which records basically 100 samples with the sample time of 10000 Hz. This 10000 Hz is the same as what the controller does (100µs = 10000 Hz). After this AI acquisition I want to wait for the next trigger to arrive, signalling the beginning of the next line in the scan. I then want to measure AI again and so forth until all lines have been scanned properly. All this is assembled in a 2D array which can be visualized by an intensity graph showing the image.
I attached two ways of how I think one can implement this without the use of a counter in case of acquring an image/2D scan of 100x100 pixels:
1) The first VI has a while loop, starting and stopping the AI every time a digital edge is recorded at a digital input. Note that I do not record 100 samples per line as that would give the program no time to wait for the next trigger. In this example I only record 90 samples, the rest (10 samples/pixels) is waiting time for the next trigger.
2) The second VI makes use of the change detection event on rising edges on a digital line, firing an event everytime a TTL pulse arrives. Note that I do not record 100 samples per line as that would give the program no time to wait for the next trigger. In this example I only record 90 samples, the rest (10 samples/pixels) is waiting time for the next trigger.
Now the questions:
1) Which of the two VI is better programming practise/uses less resources? Which is better and why?
2) Which version shows the least trigger delay/variation/jitter?
3) Which version can be used best for fast arriving triggers? In my application, trigger pulses will arrive a 10 Hz at most? Doable this way without counters?
4) The image array which gets filled in the while loop can be quite large, in my case 3000x3000 pixels. Is the way which I use in these VIs generally a good way or are there better/faster ways?
5) Are there others ways of implementing a retriggerable AI measurement without the use of counters?
Any input is very welcome. Also, if you have ideas of how to improve the whole performance of acquiring detector signals in a scanning microscope application 🙂
I am using LV 2009 on an XP quad-core PC.
Thanks a whole lot! Hope this thread will also help people other than me...
Christian
03-31-2011 11:40 AM
Here's a thought that veers off in a totally different direction. I'm not near hw to be able to test it out, so buyer beware & all that.
Your card multiplexes by using both a sample clock and a "convert" clock. If you were acquiring multiple channels,
you'd produce one convert clock edge per channel for each sample clock edge. So here's the trick. Fake your task out by making a channel list that has, say, 100 entries of the same physical AI channel.
Configure the task to use the "start of line" ttl pulse as the sample clock, and set the convert clock rate to be 10 kHZ. If this sort of trickery is allowed, it should perform the function you were seeking with retriggerable AI.
(I know that a physical channel can be entered into a channel list more than once; I *don't* know if there's a limit where perhaps total # channels in list must be <= # of physical AI channels on device.)
-Kevin P
04-01-2011 04:52 PM
Hi Kevin,
That's a great idea. Repeating channels is definitely supported by M Series, because it is the basis of how SCXI multiplexed mode works.
M Series hardware has enough channel FIFO entries to scan up to 4095 channels. For channel orderings where adjacent channels can be combined into groups of N, it is possible to exceed this limit. Scanning Dev1/ai0 10000 times would fall into this case, assuming that you use the same terminal config and input range on each instance of ai0.
Brad