LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Re: How to run the program for specified time

Solved!
Go to solution

I also have the same problem. I want to generate a continuous digital waveform at a particular time.  I write a program where the generation of such waveform is possible but I cannot control the time part. I have attached the program below. If anyone can help me out then it will be great.

Thanking you

0 Kudos
Message 1 of 9
(1,402 Views)

Sorry here is the file. In the previous msg the file was not uploaded.

0 Kudos
Message 2 of 9
(1,401 Views)
Solution
Accepted by topic author SUJITniser

Get the time in your while loop.  Subtract from it the time you got when it started.  OR the stop button with that time difference greater than equal to your desired run time.

 

0 Kudos
Message 3 of 9
(1,392 Views)

Thank you for your reply. I have tried this but this only helps to run the program for a specific time, such as I want to run the program for 10 sec then i can do this here. But I want to run the program at a specific time lets say I want to run the program at 10:30 am specifically and want to stop the program after 30 sec. How should I do this?

0 Kudos
Message 4 of 9
(1,314 Views)

Then you need a while loop that keeps checking the current time and looks for when it is equal to or greater than 10:30am,  then that loop stops and moves on to the next step of starting the acquisition.

0 Kudos
Message 5 of 9
(1,293 Views)
Solution
Accepted by topic author SUJITniser

Well, it's easy. Add another while loop "on the left" of your Block Diagram. On each iteration, check the current time, let's say every second. When the current time is 10.30 am, exit the loop and measure for the required time span.

Add a button to abort the loop stopping the program without actually measuring.

wait time.png

This snippet is only a readable example. Actually there are better ways to wait a specific time.

For example, on my computer it would never work, since my time format is 24h.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 6 of 9
(1,291 Views)

But the left hand side case selector has three different condition, I only want the time start part on a specific case selector (When the case selector is at 1 I want to start the program at a specific time ) . In another case selector let’s say at 0 I will be able to generate the output by controlling start and stop manually.

0 Kudos
Message 7 of 9
(1,264 Views)

Dear Sir, 

                I am attaching the program here, actually, I need to generate the digital signal at a particular time, and also the generation of the pulse will be for 10 sec or 20 sec let's say. So the first part is done smoothly according to your guidance but for the 2nd part of the programming I have modified it a little bit, you can see. But now the problem is in the 2nd part where I am subtracting the two times this gives a huge number as the string is something like 08:20:30.000 in this format. So if I  want to run the program for 10 sec and if I give it when I compare the subtracted result and the given time (which is 10 sec or whatever I want ) it is not happening correctly. Can you please help me to rectify this problem?

0 Kudos
Message 8 of 9
(1,239 Views)

I have resolved that issue. Thank you.

0 Kudos
Message 9 of 9
(1,216 Views)