LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What approach i use for this...its some what like interrupt

Hi...

 

I have an application that requests data from 8 different stations...It may take a few minutes the complete the reply.

 

Meanwhile if i want to do some other thing in the application,currently i have to wait until the current request completes its reply.

 

I would like to know is there any way that i can do other function(higher priority one) inbetween the request completion by pausing that request and continue the request after i complete the other function.

 

Thanks in advance for any help

0 Kudos
Message 1 of 6
(2,654 Views)

user_1 wrote:

I would like to know is there any way that i can do other function(higher priority one) inbetween the request completion by pausing that request and continue the request after i complete the other function.


One of the great things in LabVIEW is the fact that you can easily program for parallel execution. Simply run your queries in a parallel loop (e.g. linked via a queue) and your main code will continue to be able to service other functions at the same time. There is no need to pause anything.

Message 2 of 6
(2,648 Views)

Thank you for the reply.Am not thinking of parallel execution as the system is not much fast now.I dont want to make it slower by emposing parallel execution...And also,some way i have to pause the current process and go to the higher priority process and once it finish go bak to the original procee.

 

Any way for this?

0 Kudos
Message 3 of 6
(2,643 Views)

user_1 wrote:

I dont want to make it slower by emposing parallel execution...And also,some way i have to pause the current process and go to the higher priority process and once it finish go bak to the original procee.


Why would imposing parallel execution make things slower?? LabVIEW does all the scheduling required automatically. If a background process does not require much CPU (e.g. you could run it in a slow loop just waiting for a reply), the main process can use as much CPU as it wants most of the time.

 

I guess you have some strange misconceptions about dataflow and parallelism. Typically you don't have to worry about details like that If the code is reasonable. Of course if you would do the polling in a loop without wait, it will spin the loop as fast as the CPU allows, starving other processes. So don't do that!

Message 4 of 6
(2,619 Views)

user_1 wrote:

...,some way i have to pause the current process and go to the higher priority process and once it finish go bak to the original procee.

 

Any way for this?


Yes Christian's suggestion about parallel processing it the way to go.

 

The trick is putting a "0ms wait" (a wait timer with a zero wired to it). Waiting " 0 ms" takes little or no time but what it does do is interupt that thread so the scheduler can decide if something else shoudl run. So the "0ms wait" is a way of telling LV "Run this loop fast but stop and check every iteration to let other processes use the CPU if they require."

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 5 of 6
(2,607 Views)
Since it takes minutes for the reply (see first post), polling every 100ms or slower should be OK.
Message 6 of 6
(2,587 Views)