LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Controllable Timed loop

The Timed Loop has no inherent  Pause facility.

In a specific application I need to pause a Timed loop programmatically and then start it again on the fly.

The enclosed VI accomplishes that.  Though it seems to do what is expected, I am not sure if  there is any way to have control over timed loops ?

Raghunathan




Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 1 of 4
(3,026 Views)
You are NOT controlling the timed loop, you are actually constantly exiting and restarting the timed loop while counting. This seems quite pointless. Why use a timed loop at all? 😉
 
I don't quite understand why you would need this, but something like in the attached modification seems a bit cleaner.
 
What exaclty are you trying to do? Have you tried a state machine approach instead?
0 Kudos
Message 2 of 4
(3,026 Views)
Dear Altenbach,

That was a fast response, for a Sunday !. Thanks.

Brevity at times can be confusing.

Let me explain as to why I must stop and start a timed loop.

In an application, I have  the  Main.vi  which is a sub panel. In that I have the following  sub-menu buttons for the user to select :

Auto, Manual , Configure, Security, View Report, Print Report.

Out of the above, only the Auto and Manual sub.vis need inputs from the machine hardware and all the rest  can run offline even without the DAQ card in the PC.

However when the user is busy with one of the four off line functions, the connected machine needs to be kept on standby  with some jobs like monitoring safety interlocks, oil temperature and such. This only needs querying of  some 6 digital inputs.  Thus I  have a 50ms  Timed loop in Main.vi and carry out the polling of these safety interlocks and advise the user in case of any problem.

But the moment when either Auto or Manual  VI is loaded, the real full fledged DACS function starts with a huge timed loop that also utilizes the same hardware as used by main. Some 12  AIN, 2 AOT, 25 DI and 11 DOT channels are scanned and machine control effected by a SM.

So what I want to do is this :

1. When the  four VIs that don't need hardware inputs are running, I will run a small timed loop  to poll 6 DIs as part of Main.vi.

2. When either Auto or Manual.vi  starts , I will need to stop  the  Timed loop in Main.vi  as  those  6 DIs are anyway queried in the  built in SM  of Auto or Manual .vi.  And the messaages generated by the Timed Loop in the Main.vi share the same display field as used for the Auto , Manual VI.

3. And when  Auto or Manual is stopped I will re-start the Timed loop in the Main.vi

Hope my need to Stop/Start  a timed loop is clear now ...?

Or  I may have to do this :  Poll all DI s in the Main timed loop and pass the status information via Global variables to the sub.vi s. Now that I don't think is very elegant ?

I await your suggestions to handle this .

Thanks

Raghunathan

Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 3 of 4
(3,021 Views)

I think the bottom line is that your VI (main and sub) are going to have to communicate with each other some way in order to coordinate all of this. You could use global variables to do this as you suggested, but then you'd be polling and there are several event-driven alternatives to that. I would recommend using Notifiers and I have attached a short example to illustrate how you could use them. The zip file includes two files (a main and subVI) and uses your counting scheme to illustrate the "pausing" of the timed loop. I hope it at least give you some ideas!

Kind Regards,

E. Sulzer
Applications Engineer
National Instruments
0 Kudos
Message 4 of 4
(2,996 Views)