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: 

how to stop until generate a whole cycle waveform when click stop button

Solved!
Go to solution

Dear NI engineer,

 

I generated three AO signals to control my scanner and data aquisition. Two ramp signal is to control galvo scanner (x and y). One TTL signal is to trigger data aquisition. Each time I click stop, the ramp will stop wherever it is when the stop button is clicked, which will cause a voltage jump when start the program again because the ramp will start from the original place (this fast voltage jump may cause damage the galvo scanner ). Could you please give me some suggestion on how to stop only after a whol cycle waveform is finished? Attached is the VI I used. The FLIM control.vi is the main vi which include subvi of Galvo control.vi

 

Thank you so much!!

Download All
0 Kudos
Message 1 of 16
(2,549 Views)
Solution
Accepted by topic author dgql

Hello, dgql!

 

From a purely programming perspective, there are a few ways you could implement this.

 

1) Create a conditional stop:

 

You could add code functionality such that, after you've hit the stop button, the code checks the value of your signal before actually stopping the VI. In pseudo-code: "if signal is >0 and less than a certain value, stop. If not, keep checking signal until value is within this range."

 

2) Reinitialize the ramp signal with each start of your VI. This may or may not work with your application, depending on if you need to have the previous ramp value carry over.

 

Let me know if these are of any help!

 

Will Hilzinger | Switch Product Support Engineer | National Instruments
0 Kudos
Message 2 of 16
(2,521 Views)

@dgql wrote:

Dear NI engineer,

 

I generated three AO signals to control my scanner and data aquisition. Two ramp signal is to control galvo scanner (x and y). One TTL signal is to trigger data aquisition. Each time I click stop, the ramp will stop wherever it is when the stop button is clicked, which will cause a voltage jump when start the program again because the ramp will start from the original place (this fast voltage jump may cause damage the galvo scanner ). Could you please give me some suggestion on how to stop only after a whol cycle waveform is finished? Attached is the VI I used. The FLIM control.vi is the main vi which include subvi of Galvo control.vi

 

Thank you so much!!


The obvious solution is to go to vi properties>>Window apperance>>Customize and UNCHECK "Show abort button."  That abort button is a debugging tool using the abort to stop your vi is like using a tree to stop your car!


"Should be" isn't "Is" -Jay
0 Kudos
Message 3 of 16
(2,519 Views)

Thank you very much for your reply. May I ask how to check the current AO output value when I click the stop button?

0 Kudos
Message 4 of 16
(2,497 Views)

Thank you very much for your reply, Will. May I ask how to check the current AO value when the stop button is clicked?

0 Kudos
Message 5 of 16
(2,493 Views)

Hello, dgql!

 

It looks like your code outputs the analog information to your waveform graph. Are you not able to read the value from there?

 

 

Will Hilzinger | Switch Product Support Engineer | National Instruments
0 Kudos
Message 6 of 16
(2,478 Views)

I am pretty new to Labview. I am not sure which function I should use to read the current value of an AO. Could you please give me some suggestions? Thank you very much!

0 Kudos
Message 7 of 16
(2,472 Views)

Sure thing!

 

In your "FLIM Control" VI that you posted, there is a waveform graph which should display the analog output (AO). So it looks like you've got what you need in place already. Are you looking to output a different signal?

Will Hilzinger | Switch Product Support Engineer | National Instruments
0 Kudos
Message 8 of 16
(2,460 Views)

I guess maybe my expression make you confused 🙂

 

I want to do it as what you say:"You could add code functionality such that, after you've hit the stop button, the code checks the value of your signal before actually stopping the VI. In pseudo-code: "if signal is >0 and less than a certain value, stop. If not, keep checking signal until value is within this range."

 

But I am not sure how to "checks the value of my signal before actually stopping the VI". I should continuously check this value, but I am not sure how to check. Hope this will be better to understand 🙂

 

Thank you very much!!

0 Kudos
Message 9 of 16
(2,454 Views)

Ah, my apologies : )

 

I think I'll actually take a step back on this - I think it will be better for you to just reset your ramp value to zero when you stop your code.

 

The ramp will stay at whatever value it is when the VI is stopped, so if you choose to stop it at (say) 5V, it will continue outputting the 5V, which is (assumedly) not what you want. 

 

The method I thought to use for this does not seem to be working - I will look at it a bit more and let you know. In the mean time, the community may have some answers, too : )

 

 

Will Hilzinger | Switch Product Support Engineer | National Instruments
0 Kudos
Message 10 of 16
(2,443 Views)