07-15-2015 09:25 AM
Hi,
I am still very new to labview and I have a timing problem with a while loop.
I am attaching the VI so that it is easier to understand.
Basically, I read X and Y voltages (with a PCI card) that correspond to a position in an image (that I load). I then convert those positions into a pixel positions and extract the pixel values in the image .
I then use those pixel values to write on an analogue output.
My Problem is the following:
The "Get Pixel Value .vi" only works Pixel by Pixel meaning that I can only write 1 value every while loop iteration. This is to slow considering that I need to write at least one sample every one/two microseconds and that the while loop is slower than that (at least I think?...)
How can I transform this vi so that the while loop converts at least 100 position into 100 pixel values so that I can write at least 100 values in one while loop iteration?
Thank you very much for your help,
Best ,
Renaud
07-15-2015 11:05 AM - edited 07-15-2015 11:06 AM
Can you use "IMAQ ImageToArray" to get the 2D array of data and then index the array in a for loop? You can put in the two arrays of row/column locations and index those on the terminal.
07-15-2015 11:11 AM - edited 07-15-2015 11:12 AM
07-15-2015 12:19 PM
Thanks a lot for those quick replies !
Image to array is a good solution but I found a work around with a while loop.
I understand that I won't have microsecond loops without a FPGA but I should be able to read/write around 1000 samples every loop iteration, correct? Otherwise what is the purpose of a DAQ bord type PXI or PCI to have a sampling frequency of 1 to 2 or even 5 MHz??
In the attached code however I can't seem to read more then 10 sample every 1 milisecond meaning a sampling rate of 1 sample every 100 microsecond... How can I improve the code?
Many thanks,
Best,
Renaud
07-15-2015 05:03 PM - edited 07-15-2015 05:12 PM
You probably don't want to have the "wait until next millisecond multiple" function inside your while loop. You should allow the data acquisition vi's to dictate the loop timing. You can set the buffer size with the DAQMX timing vi, then read a fixed number of samples during each itteration of the loop.
There will be some delay between when your samples are acquired, and when your outputs are generated. Is this acceptable?
. The "Build XY Graph" express vi might also slow down your loop. You could remove that and see whether your speed improves.
07-16-2015 10:34 AM
Thanks for this reply,
Delay between acquired samples and generated output are unacceptables in this case...
I do possess and FPGA "NI PXIe-7962R" with the adapter module "NI5751". This adapter module has only analogue inputs and no analogue outputs...
However, can I combine an analogue input with an FPGA and an analogue output from a PXI card? Would this solution be faster?
Thanks,
Best,
Renaud