07-27-2009 10:12 AM
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!
07-27-2009 11:18 AM
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.
07-27-2009 11:51 AM
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.
07-27-2009 12:06 PM
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.

07-27-2009 12:09 PM
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!

07-27-2009 12:14 PM
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.
07-27-2009 12:16 PM
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!!
07-27-2009 12:29 PM
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!!