From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using queue's with DAQ cards and general programing???

Hello all !!!!!!!!Smiley Very Happy

This question deals more with Queues than DAQ cards so I think it is in the right place.  I am using lv 7.1, 3.4 Ghz, XP professional.  I am building this imaging instrument and need to acquire, calculate, and display information.  I decided to do this by setting up 3 while loops for each section of the process (acquire, calculate, and display).  I also used queues (newbie at queues) to link the while loops together to try and acquire, calculate, and display at the same time.  For some reason this isn't working as I think it should.  It doesn't seem like the queues are working as each loop seems to be waiting for data from the previous while loop, even though there should be data in the pipeline as I am attempting to acquire continuous data sets.  I do not know if there is a problem with how I set up my DAQ card or if the problem lies with the queues.  I have attached my code (it is farily complicated as I included everthing), but I believe the problem at hand lies in the top level of the vi.  Some things too note are that when I turn of the calculation part the DAQ card goes at the expected full speed, but as soon as I turn on the calc. part is slows down....a lot.  Any help would be greatly appreciated and I will answer all questions as fast as possible and general coding comments are welcome with other parts of the code as I believe you experts can most definetly show me a thing or two. The main vi is entitled OCT II Queue all stop.vi

Thanks a lot,

Azazal

Message Edited by Azazel on 12-05-2005 05:15 PM

Azazel

Pentium 4, 3.6GHz, 2 GB Ram, Labview 8.5, Windows XP, PXI-5122, PCI-6259, PCI-6115
0 Kudos
Message 1 of 4
(2,401 Views)
Forgot to mention I am using the PCI-6115 DAQ card and that I benchmarked my code with some known data and loaded the data in the place of the data acquisition while loop and the vi seemed to work pretty good.

Thanks,

Azazel

Azazel

Pentium 4, 3.6GHz, 2 GB Ram, Labview 8.5, Windows XP, PXI-5122, PCI-6259, PCI-6115
0 Kudos
Message 2 of 4
(2,393 Views)

A) Do not create or acquire repeatedly. Do it once before the loop starts and just insert new elements in the queue.

B) Similar to what I said for A. Destroy the task when you leave the loop.

C) Add a wait timer in all loops so they do not run too fast and goble up all of the CPU.

D) Send data two places. Your existing queue sends data to second loop which does logging only (in my revised scheme). Move all of your number crunching from loop two to the display loop at the bottom. Feed the bottom from a second queue you will be feeding as you are doing with your existing "data" queue in the top loop.This will eliminate three queues and prevent your number crunching from gettin the way of your data logging. The user interface should be the only loop that can be hurt number crunching and dispaly updates.


Have fun,

Ben

Message Edited by Ben on 12-05-2005 07:19 PM

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 3 of 4
(2,392 Views)
Thanks for the quick response Ben.

Most of your suggestions worked beautifully.  I do have some follow up questions.  You said to destroy the task when you leave the loop...what does this mean?  I also had some trouble with trying to take the set-up section of my data acquisition code out of the while loop as you circled in B.  When I took this code out of the while loop my triggers were not working properly.  I am using an external clock with an analogue trigger.  Is it possible to accomplish the acquisition loop with the part of the code in B taken out of the for loop?  When I did take it out, although my data was not triggered and my images were all crazy, it did run at almost real time...which was very exciting.  There was also another problem with taking that part of the code out of the for loop as my memory allocation increase lineraly until my comp crashed.  Should this data be buffered or something so that doesn't happen.  I have attached a simple version of what I am trying to accomplish with respect to the data acquisition so it is easier to read.  Soooooooooo any suggestions for these issues?

Thanks,

Azazel
Azazel

Pentium 4, 3.6GHz, 2 GB Ram, Labview 8.5, Windows XP, PXI-5122, PCI-6259, PCI-6115
0 Kudos
Message 4 of 4
(2,369 Views)