I agree with you on all points, especially on the "if it works" part.
As a summary to the original poster. Try using the fore mentioned
state machine. This is probably the best (only?) solution for
a "selectable sequence". The value used to select the next state (for
the next iteration of your loop) may be passed by either a local
variable or a shift register.
eric
In article <39935F80.6A9D879B@usa.alcatel.com>,
"Kevin B. Kent" wrote:
> OK, I must apologize a bit here and say I may be a bit touchy on this
> subject as well.
> I should preface all this by saying that my intention was to point
out that
> this
> is one of the FEW times that a local is handy, and less dangerous.
> I implemented
> my code this way and liked it. I should have been more clear in the
original
> reply.
>
> ej wrote:
>
> > Kevin,
> >
> > Maybe it doesn't matter so much now that memory is cheap, but when I
> > started LabVIEW anything that you could do to save the amount of
wasted
> > memory the better, especially in large applications.
> >
>
> Indeed the shift will use less memory (2 identical vis the local is
16k,
> shift is 13k)
>
> >
> > Here is why I still think that using shift regs are better that
using
> > locals:
> >
> > To avoid having those broken wires from a case statement that would
> > generally go out to a shift register, you would have to create a new
> > local for every case.
>
> This is a bit confusing, If I DONT use shift at all, I won't have any
wires
> out of the case.
> I dont really have to create a local for every case (though that
could be a
> "Bad Thing")
> Never tried this but it might be interesting.
>
> > Also if you don't need to have a control or
> > indicator on the front panel, you must create a control or indicator
> > just to be able to use your locals. You still wouldn't have much
>
> I'll agree with this .
>
> >
> > control over operation of the state machine without putting in
special
> > cases to eliminate race conditions.
>
> Not so sure about this, granted there can be race conditions, but if
I set a
> local
> inside a case there won't be a problem, since no one will read it
till the
> case
> exits.
>
> >
> > I also can't see how creating several local variables is neater than
> > creating one complete wire path to a shift register which does the
same
> > thing (especially since you need more comments to help others to
follow
> > your data flow).
>
> Well, maybe it is just preference for me. When I print and / or
document the
>
> VIs it is much easier to have a local in each case, especially if
there is
> more
> than one case structure. I can look at the disembodied cases and see
that
> all locals named "StateM_1" go together. Much easier than a wire to
nowhere.
>
> > For me it is less taxing to follow one complete wire
> > path to a shift register than to try to find out where all of the
read
> > locals and write locals are located.
> >
>
> Yep again just preferences.
>
> >
> > Wow! This seems to be a touchy subject for me. 🙂 I suppose I'm
just
> > in favor of optimization, no matter how much memory you have to
spare.
> >
> > ej
>
> Yes I typically try to get the smallest, fastest, bestest I can but
there
> are other
> considerations. Since I work with several different coders, and have
strict
> documentation
> guidelines, I have to pick what is best overall.
> This is like any other kind of programming. There are many ways to
skin the
> cat.
> My general philosophy is : If it works, is bug free, and you (or I)
can
> figure it out in 6 months,
> then it is perfectly fine with me.
> Kevin Kent
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.