LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data Aquisition & Processing Basic Program Structure

I have an application that utilizes 4 Quadrature Linear Encoders, 3 Load Cells using Analog Inputs as well as Digital I/O using a PCIe-6320 X-Series DAQ Card.  I am using the Producer/Consumer model for the data acq and processing for the encoders and while loops for the rest.  The problem I have is as soon as I start adding the Digital I/O monitoring, I loose the performance I need from the while loops.  I have changed the Producer loop where I read the DAQ channels for the encoders to a Timed Loop which helps, but still adding the Digital I/O slows it down.

 

I guess my question is more of a basic structure question.  So far I have been doing what I would term "modular" programming.  When I want to add a new functionality, I create a stand alone program to test out my code, then once I get that working, I incorporate it into the main program.  When looking for examples, most of them are similar in that they are stand alone examples.  Is there a resource that is more general that can give me an idea of how to organize my program to be more streamlined?

 

For instance, should I have all the DAQ together in one loop - encoders, analog & digital or keep them separate?  Like most applications, there are some tasks that are highly time sensitive (Data Acq and Data logging) and others that are not.  Would that be a good place to use Timed Loops instead of While Loops?  How do I know when to use one or the other?

 

I realize that without specifics, it may be difficult to answer, but any help and/or examples would be appreciated. 

0 Kudos
Message 1 of 2
(2,092 Views)

Hi,

 

There are a lot of broad questions here that, like you mentioned, are hard to answer.  With regard to putting daq together in one loop, my answer is it depends.  It depends on how your tasks are set up and what you are doing in each loop.  The timing for each task may be causing some delays, but without knowing exactly what you are doing, putting my finger on exactly what is going on may be difficult.

 

Timed loops are typically used when using a real time target, like a cRIO.  If your program is running on Windows, using regular while loops along with "wait" or "wait until next ms multiple" vis.

 

If you have any more specific questions or if you can provide some code I will be glad to help you further!

 

Ryan

Applications Engineer
National Instruments
0 Kudos
Message 2 of 2
(2,057 Views)