LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Queues and event structure

First of all, thank you guys for your help, my friends don't use labview to programming...

I have already put the wait function with 500ms, which is also the period of DAQmx.

If I try to enqueue "Acquire" in the "Timeout event", I think I will have "Acquire" in the queue before I press the button "start", and before the DAQmx being initialize. This can't become a problem?
I want that "Acquire" run only when I'm in state "Acquire", like a while loop.

 

 


@Ravens Fan wrote:

 

Why are you not sending a command enum in the Impulse or Impact event cases?  You need to have an impulse or impact state in your state machine that does whatever it is you want it to do.

 


 

I think you've already suggested something like that before, but my doubt is how can I keep the DAQmx working?

Data sent in "Impact" and "Impulse" is to control the waveform output of DAQmx. "Impulse"indicate the amplitude, frequency and duty cycle of the wave, "Impact" create a square wave (but only a boost) with the values of "Impulse".
Another thing that I've been thinking, is if it's possible to initialize the queue cluster with the values that are initially in that control, because if someone change that values before pressing the start button, the values that will be use, will be that initialize in the stack.

 

Thanks,

Sílvia

 

0 Kudos
Message 11 of 14
(602 Views)

500ms is pretty long but if it works for you then use it.  In the Timeout, use a case structure to call acquire or not.  In the start event, set some boolean to true and leave it there.  Put a case structure in Timeout and put nothing in the false case and put the acquire queue in the true case.  Wire the boolean flag to the case.

- tbob

Inventor of the WORM Global
0 Kudos
Message 12 of 14
(597 Views)

Hi tbob,

With the re-enqueue in the "timeout", the program work a little better. But not all the bugs disappeared.
The problem is related with the period of DAQmx wave, which is 500ms. Because of that I put a big interval in "Wait(ms)", as I already said. If the timeout of the top loop is smaller than this time, the queue increase very fast, if the timeout is equal, I have also problems when I press the buttons. Because I press faster than the bottom loop update.

There are something that I can do to resolve this?

 

Thanks,

Sílvia

0 Kudos
Message 13 of 14
(574 Views)

I gave up the queue, because it was enqueueing faster then dequeueing. And I didn't see solution for that problem.

I try only use a state machine, the program work better, but not perfect.
I still have a problem with the button Impact. Now it work rather yes, rather not, and I don't understand why.

 

 

Thanks for your help,
Sílvia

0 Kudos
Message 14 of 14
(546 Views)