11-19-2013 09:41 AM
Hello to everybody, I have been searching through the forum but I have not found a certain answer for my problem. I would try to explain my problem as breefly as posible:
I have to send by a BNC2120 two signals and acquire an other one thats comes from a preassure sensor. That part is done by introducing simulating and acquiring DAQmx inside while loops.It is sycronized by my self, proving such diferent values (is not the optimum, but is only the first prototype) and works as I expected. Well, then I want to sample some of the values of these signals, that is done with relays and local variables to get the value in the instant I want to sample. Here begin my problems: I want to extract the sample values out of the while loops without restarting them, I mean: I do not want to stop the while loops because the acquisition and the generation of the signal must be continuous, but I do not know if it is posible to put the while loops in "standby" until I operate with the values I have sampled and then the signal generator and the acquiere continues from when it has stoped before. Particulary I want to obtain the value of the top while loop (inside a case) when the counter arrives at 15.
I have proved to do with local variables, global variables, making a state machine, with event cases, with flat secuences...I have been reading about and proving diferent posible solutions for this week and the whole past week and I have not found the solution.
If any of you know how I can do this thing, I would be loved to listen your opinions. My proyect is above:
Thank you a lot in advance.
Sinceresly,
Miguel.
11-19-2013
10:10 AM
- last edited on
05-12-2025
04:16 PM
by
Content Cleaner
it looks like you have problems with data flow....I do not think that you need multiple loops as this adds to your problems of controlling the information you need. i would try to make it all in 1 while (as you say, "continuous") loop state machine...this will be a very easy implementation to your code as events happen sequentially
if you can explain better in details what exactly you need to happen where and when and at what times, we can better understand what needs to be done in your code
11-19-2013 10:15 AM
Use a producer/consumer architecture. The producer is your measurement loop that runs continuously. Pass data to the consumer loop by means of a QUEUE.
11-19-2013
12:15 PM
- last edited on
05-12-2025
04:16 PM
by
Content Cleaner
It definately sounds like what you really want is a Producer/Consumer. It is an architecture that uses Queues to pass data from a data generation loop (producter, your DAQ loop) and a data processor (consumer).
11-20-2013 04:26 AM
Thank you a lot!!! It was actually the solution: Producer/consumer archytecture!!! It works as I have expected. Thank you a lot!!!
Best regards,
Miguel.