LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Start/Pause/Resume Data Acquisition with DAQ assistant within a while loop

Solved!
Go to solution

Hi everyone,

 

I'd like to create a VI in which I can start/pause/stop analog data acquisition and data display in a graph indicator with a DAQ assistant in the automatically generated while loop. I have seen that I can use event sructure or case structures. What would you recommend?  Is there an example I can refer to?

 

Thanks

Regards,

 

ES

0 Kudos
Message 1 of 16
(4,870 Views)

Hi ES,

 

I recommend to use a statemachine!

You already mentioned the states "start", "pause", and "stop". I would add the state "play" to the list…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 16
(4,862 Views)

Dear Gerdw

 

Do you have a simple example I can refer to?

Thanks,

 

ES

0 Kudos
Message 3 of 16
(4,840 Views)

Hi ES,

 

LabVIEW comes with a lot of examples, either in the example finder or in the "File" menu -> "New…".

 

So select the "New…" entry of the file menu and choose "VI" -> "from example" -> "frameworks" -> "pattern" -> "statemachine"!

(The mentioned items are rough translations to English as I use a German LabVIEW version, they can have slightly different names.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 16
(4,833 Views)

Hello,

 

there's no state machine example in the English version of Labview. Maybe is it the Control Design?

0 Kudos
Message 5 of 16
(4,794 Views)

@Emanuele_S wrote:

Hello,

 

there's no state machine example in the English version of Labview. Maybe is it the Control Design?


There is. Did you check the example finder?? Another advice, forget the DAQ Assistant, and use proper DAQmx VIs in your state machine!

dfdd.png

 

 

0 Kudos
Message 6 of 16
(4,790 Views)

Actually there is a DAQmx example ready to use for the purpose you described.

Open LabVIEW, and go to "Create...", then "Continuous measurement and logging" project. It just does what you need:

EDIT: sorry, wrong entry, you need the one with DAQmx:

 

ccccc.png

 

 EDIT2:

edit2.png

 

0 Kudos
Message 7 of 16
(4,787 Views)

Hi everyone,

 

thanks for your suggestions.

 

I have built a very simple state machine code, in which I can set three values

0 - pause

1-  acquire

2 - stop

I attach the code. I just would like to know if I can set a three-option button which makes me visually select these three states, instead of setting the numeric values 0,1,2.

 

Thanks again for your help.

Regards,

 

ES

0 Kudos
Message 8 of 16
(4,778 Views)
Solution
Accepted by topic author Emanuele_S

Hi ES,

 

use an enum to name the states. Then use an enum indicator to indicate the current state…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 9 of 16
(4,774 Views)

I did that, it's better than before but I prefer to have three buttons: Pause - Acquire - Stop.

I think it's easy do to this, how can I?

 

ES

 

0 Kudos
Message 10 of 16
(4,769 Views)