LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Elapsed Time delay only works once in state machine

Solved!
Go to solution

Ravens,

 

Thanks for answering on such short time...

 

I got your example, but for me it was too complex for what I wanted to do...

Maybe I understood danny's question wrong but, what I needed was a way to reset the elapsed timer every time the routine started...

I created a VI that I called in another VI for 'n' times... The problem was it only worked the first time it was called. I believe the reason for that is what you explained Danny some posts back (the timer's autoreset thing).

 

Anyways, I've cracked my head for a while here and found a very simple solution that worked just fine...

All I needed was a routine that output True in the first time it ran, and then maintained false for the rest of the time...

This is how I got it to work!

 

Thanks for your attention!

0 Kudos
Message 11 of 18
(2,192 Views)

I'm glad you have it working the way you want.  But you have a bit of a Rube Goldberg in there.

 

You don't need the case structure.  If it's true, you don't need a case structure to output true.  Likewise if it's false, you don't need a case structure to output false.  Just wire the green wire directly to the express VI.

0 Kudos
Message 12 of 18
(2,183 Views)

TagHeuer wrote:

Maybe I understood danny's question wrong but, what I needed was a way to reset the elapsed timer every time the routine started...

I created a VI that I called in another VI for 'n' times... The problem was it only worked the first time it was called. I believe the reason for that is what you explained Danny some posts back (the timer's autoreset thing).

 

Anyways, I've cracked my head for a while here and found a very simple solution that worked just fine...

All I needed was a routine that output True in the first time it ran, and then maintained false for the rest of the time...

This is how I got it to work!

 

 


How do you call this VI multiple times, since there is no way to stop it? Is it set to reentrant?

 

Anyway, that shift register and case structure is overkill and totally pointless, why not simply do a "=0" on the iteration count [i] and wire the result to the "reset" input?

 

Your loop also needs a small wait. You don't want to burn all available CPU just to check every nanosecond if the time has elapsed, especially since you seem to run several instances at once, you'll run into problems because without a wait each loop will spin many times before releasing control to something else.

0 Kudos
Message 13 of 18
(2,178 Views)

altenbach wrote:

 

How do you call this VI multiple times, since there is no way to stop it? Is it set to reentrant?

 

Anyway, that shift register and case structure is overkill and totally pointless, why not simply do a "=0" on the iteration count [i] and wire the result to the "reset" input?

 

Your loop also needs a small wait. You don't want to burn all available CPU just to check every nanosecond if the time has elapsed, especially since you seem to run several instances at once, you'll run into problems because without a wait each loop will spin many times before releasing control to something else.


Also remember that this timing method do have resolution around 17 msec. This depends on Labview version and OS type.



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 14 of 18
(2,171 Views)

Hey All,

 

Actually I'v taken only the part I was Issuing about...

The program is more comnplex and it's shown bellow...

 

I Believe I need that structure for it to work...

 

I've attached a Picture and the VI, but to open the second one you need the LEGO Mindstorms Toolkit to open...

 

Thx!

0 Kudos
Message 15 of 18
(2,168 Views)

OK, that's quite different to what you showed above and makes a bit more sense. Still, that T/F case structure is silly, right?

 

It's is difficult to comment furhter without seeing the rest of the cases, etc.

0 Kudos
Message 16 of 18
(2,160 Views)

Hey All,

 

Actually I've only showed the part I was issuing about...

The program is more complex and it's shown bellow...

 

I Believe I need that structure for it to work...

 

I've attached a Picture and the VI, but to open the second one you need the LEGO Mindstorms Toolkit to open...

 

Thx!

 

PS. Sorry for the duplicate but it got sent acidentally before I wanted to. If you guys are moderator you can erase the previous one!!

Download All
0 Kudos
Message 17 of 18
(2,159 Views)

Hey,

 

You guys are right!!

 

I don't need that case structure there!!! It was redundant!!

 

Just for the record I've printed each part of the program...

(I tried to attach 4 pictures, but it appears that 3 is the limit so i'll just tell that in the case structure in pic VI_2a  eithes sents me to "FIM" on TURE or "Programa" on FALSE)

 

Due to the timming problem (delay of ms)... I can live with that... No big deal for my routine!

 

Thanks a lot for the help!!

 

 

Download All
0 Kudos
Message 18 of 18
(2,152 Views)