12-09-2008 11:56 AM
Hello -
I am working on an application which involves an interferometric measurement, phase retrieval, and feedback control. I would like the application to work at 1 kHz. I am taking signals from a FireWire linescan camera and sending a single voltage sample out of a DAQ card (currently a PCI-6036E). Right now, I am being slowed down only by the voltage sample writing. Previously, I used a USB-6251, and I found that writing a single sample took more than 3 ms. It was recommended that I try a PCI DAQ card, and I had the PCI-6036E on hand, so I tried it. Writing a single sample with this card is now at ~1 ms. The rest of my loop takes ~0.5 ms, so I would like to decrease that by half to get the entire application under 1 ms (I can speed up the rest of the loop by writing less data to disk if necessary, but only by 0.2 ms or so).
My question is, if I were to switch to a faster PCI DAQ card (the 6036 has 10 kS/s write speed advertised, whereas others have 1 MS/s capabilities), should I expect the write time to decrease (and if so, would it decrease by a factor of 100 based on the kS/s difference), or am I being limited by latency in the PCI communication? If it is the latter, is there any option other than to switch to FPGA to increase the speed of my application?
Thanks,
- Mike
12-10-2008 09:04 PM
Hi Mike,
I understand you are trying to do a single sample analog output and are trying to speed up the process of updating the voltage value to the DAQ device. To answer your question about switching to a faster DAQ card, this will really only be a solution when performing hardware-timed, buffered output. Because you are just updating a single sample each time, you are going to be limited by operating system and PCI bus limitations, in addition to whatever other processing you are performing within your program. Therefore, you may need to look into the option of using FPGA if it is necessary to increase the speed for this particular type of application, especially if your output will be related to what you are acquiring from the camera. Hope this helps,
12-10-2008 10:22 PM
Thank you for your reply, Daniel. I have very limited knowledge of computer operations, so forgive me if this is a stupid question. According to the PCI Local Bus entry on Wikipedia (again, very limted knowledge), a typical computer's PCI bus operates on a 33.33 MHz clock. This would seem to me to indicate that the slower speed for data writing is almost entirely because of the DAC in the DAQ card. The computer it is running on has 2.8 GHz processor and Windows XP. I can trigger the camera externally, so I don't really care about whether the timing information is accurate, just that the loop completes in 1 ms or less. Is there any data available on the speed of DAQ cards for in-loop single sample writing for different processor speeds? I could also switch to PCI-Express or something if that were to be faster. I would rather not switch to FPGA, I would need to develop another system for monitoring the application, not to mention that the price is prohibitive at this stage.
Thanks,
- Mike
12-11-2008 09:57 AM
Although the PCI bus runs at ~ 33 MHz, that doesn't mean you are transferring valid data in a single PCI clock cycle. It's probably more correct to think of the PCI bus state machine running at 33 MHz rather than the bus itself. For a single register write to the device, there are a number of setup cycles that occur before the data is ever transferred as well as some cycles at the end for relinquishing control of the bus. How many cycles this takes is device and machine dependent but is probably in the range of 7 - 10 clock cycles for a typical machine and device. Also, the number of register writes and reads to and from the device for each data point is driver dependent. It would probably be a mistake to assume there is only one register write for each data point.
With all of that said, a 1 kHz loop rate doesn't sound unreasonable for the hardware platform you described. However, what rates are possible will depend a lot on how you've written your application. I would recommend posting some example code of your software and see if others in the forum have suggestions for optimizing it.
12-12-2008 11:28 AM
Even 7-10 (or hundreds of) clock cycles would be orders of magnitude faster than what I am seeing. I suspect this is due to the DAC switching speed, but I don't want to buy a new card with faster DAC only to find out that I was wrong.
I have posted a few things:
1) "TestVI.jpg" shows an example of how I am writing a voltage to my DAQ card. The only difference between this and the frame in my application is that it is in a stacked sequence structure and a single value is passed from the previous frame in place of the random number generator. If I run this loop as is I find I get ~0.75 ms per loop. If I run my application, I get ~1.6 ms per loop, or ~0.6 ms per loop if I remove the frame in which the voltage writing occurs. I am not sure about this difference - is it because I am passing data from a previous frame?
2) "TestSubVI.jpg" shows the PID control subVI that is in the TestVI.
3) Sample VI of my application. I haven't included the SubVIs, but this way you can see the data flow.
Thanks,
- Mike
12-15-2008 10:34 AM
12-17-2008 04:24 PM
Thanks for your reply. After all these efforts with the DAQ card it turned out to be careless programming on my part.
Thanks again,
- Mike