LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Continue execute program while a specific sequence only should be executed every second

Solved!
Go to solution

Hi everyone

 

How can I make a sequence executing every 1s while continue executing other code in the meanwhile.

 

e.g.: A ligth should blink with a frequency of 1s. This should be done independently from other code running the same time.

 

I really was trying it out a plenty of time unsuccessfully. "wait" does not work, "wait until" not either nor does event struct or anything else work out for that... well I thought "simple" issue.

 

Could anyone give me a hint or even a example code? Please note that in my issue I don't only want to execute only a blinking LED. Lets say I want to receive updates from a board via rs232, but only every 10 seconds. Meanwhile I want to execute other code.

 

Thanks for help!!

 

 

Background inforamtion:

Since 2 month I am programming a GUI with LabView that gives me the ability to control instruments via the rs232 interface. Until now I figured out a lot of LabView by my self but here I got stuck 😕 

0 Kudos
Message 1 of 7
(2,714 Views)

Use a parallel loop with a wait XXXXX ms timer. If the two loops are essentially independent but need to be connected (i.e., to stop the program when one loop is finished), there are several ways to do it - master/slave, producer/consumer, actor network, or even just a plain old local variable from one to the other working as a stop loop boolean.

 

Cameron

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
0 Kudos
Message 2 of 7
(2,704 Views)
Solution
Accepted by topic author rotn

"wait(ms)" or "wait until..." should never be used for application timing, they are used for loop iteration and synchronize loop processes. Use the other timing functions like elapsed timer or tick count....

 

CLD....

b. Timing functions

1. Use the Wait function to control the loop execution rate and allow the processor to respond to external events and system tasks

2. Use the Wait Until Next ms Multiple function to control the loop execution rate and to synchronize multiple loops

3. Avoid using any of the Wait functions to time a software operation 

4. Use the Tick Count function and the Get Date/Time in Seconds function to time software operations

 

0 Kudos
Message 3 of 7
(2,696 Views)

@apok wrote:

"wait(ms)" or "wait until..." should never be used for application timing, they are used for loop iteration and synchronize loop processes. Use the other timing functions like elapsed timer or tick count....

 

CLD....

b. Timing functions

1. Use the Wait function to control the loop execution rate and allow the processor to respond to external events and system tasks

2. Use the Wait Until Next ms Multiple function to control the loop execution rate and to synchronize multiple loops

3. Avoid using any of the Wait functions to time a software operation

 


Well, I was just focusing on the blinky, and didn't figure it to be a time-critical operation (I figured the same thing for the data acq every 10 sec, but this may not fit his requirementsSmiley Embarassed). What I do when I just want to make a blinky is to set up a loop which switches the LED between off and on. That way I can change the period, otherwise, I would just use the "blink" property node (1 sec period, IIRC).

 

But, as you say, in time-critical operations, you do want to use the time functions which do depend on the absolute value of the system clock. In a parallel loop.

 

Cameron

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
0 Kudos
Message 4 of 7
(2,681 Views)

no problem....we've seen this before many times when someone sets his application to a certain "wait" time frame and wonders why the front panel controls/indicators does not respond?  Smiley Frustrated

0 Kudos
Message 5 of 7
(2,677 Views)

Thanx a lot for help. Let me get through this and see if I get along with your inputs. Smiley LOL

 

0 Kudos
Message 6 of 7
(2,661 Views)

"elapsed time" was the solution for my issue. Thx again for your support! 

0 Kudos
Message 7 of 7
(2,627 Views)