LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Adding Shift Register to Stacked Case structure

Solved!
Go to solution

According the the Help, you can add Shift Registers to Structures.  The Stacked Sequence is a Structure, but I don't see the option to add a Shift Register when I right click on the left side of the Structure.  Am I missing something?  I want to run my Error In and Error Out lines through the Shift Registers in a Stacked Sequence so as not to have to do it using a Feedback Loop, as that would get messy.

Message 1 of 28
(11,353 Views)

 


 

According the the Help, you can add Shift Registers to Structures.  The Stacked Sequence is a Structure, but I don't see the option to add a Shift Register when I right click on the left side of the Structure.  Am I missing something?  I want to run my Error In and Error Out lines through the Shift Registers in a Stacked Sequence so as not to have to do it using a Feedback Loop, as that would get messy.

 


 

Hi,

 

"According the the Help" ? Where did you see that ? Shift registers are only available with loops.

 

You can only add sequence locals to stacked structure which will allow you to transfer data between each case. But please, don't use stacked structure...This is hideous...

 

Regards,

Da Helmut
Voir le profil de Maxime M. sur LinkedIn - View Maxime M.'s profile on LinkedIn
Message 2 of 28
(11,336 Views)

Are you perhaps getting confused with stacked shift registers? These allow you to access the values from iterations earlier than the previous one.

 

But you still can't put them on sequence frames. Smiley Wink

Message 3 of 28
(11,320 Views)

Agreed you can't put SRs on SS, but what you CAN do is...

 

A stacked sequence is just an inflexible straight line State Diagram (search on State Diagram, there are plenty of examples and KB articles). State Diagrams are implemented using a While Loop where SRs are available.

 

SO convert to State Machine and continue as you had envisioned.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 4 of 28
(11,312 Views)

I guess my issue is grasping the concept of State Machines.I do stand corrected, on the fact that you can only add them to Loops.  I quickly saw "structures" and skipped past the fine details. 

 

As I like to use the Error In/Out lines to control program flow, I still can not conceptualize how I do this through a Stacked Sequence.  The reason I'm not using Flat Sequences structures, as this would elimnate the issue of "feeding back" in to the next Error In (coming from an Error Out - as I'm using these to see if an instrument command errors) in the sequence frame I'm sending or rceieving another set of commands to the instrument.

0 Kudos
Message 5 of 28
(11,279 Views)

I think what you want is the "Add Sequence Local" function which allows you to pass data from one frame to the next.  It's an ugly, confusing choice when you have much better options though. 

 

It sounds to me like you just need to create some subVIs to better compartmentalize your code.

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 6 of 28
(11,264 Views)

@NIquist wrote:

I think what you want is the "Add Sequence Local" function which allows you to pass data from one frame to the next.  It's an ugly, confusing choice when you have much better options though. 

 

It sounds to me like you just need to create some subVIs to better compartmentalize your code.


I do understand your comment about compartmentalizing, but if I did that I'd have a VI for every few event sequences.  The only reason I'm putting them in a stacked sequence, is to allow whom every might want to understand the flow, not to have scroll across.  If I was working in a coding language, this would be a simple series of commands, in maybe 10 lines of code.  But that's where I'm struggling to see some of the advantages of LV.  I simply want to have errors flow forward, and send a series of commands to the same instrument with some delay in some cases.

0 Kudos
Message 7 of 28
(11,239 Views)

As been mentioned by other posters, you should use a state machine for this.  You can still get the same functionality, but with well named state frames it is easy to click on the selector label and go directly to the desired frame.  With a stacked sequence you have to know which number the desired frame is.  This is only one of the MANY advantages of the SM over the SS.

Jim

LV 2020
0 Kudos
Message 8 of 28
(11,221 Views)

 


@Newenglandguy_LV wrote:

@NIquist wrote:

I think what you want is the "Add Sequence Local" function which allows you to pass data from one frame to the next.  It's an ugly, confusing choice when you have much better options though. 

 

It sounds to me like you just need to create some subVIs to better compartmentalize your code.


I do understand your comment about compartmentalizing, but if I did that I'd have a VI for every few event sequences.  The only reason I'm putting them in a stacked sequence, is to allow whom every might want to understand the flow, not to have scroll across.  If I was working in a coding language, this would be a simple series of commands, in maybe 10 lines of code.  But that's where I'm struggling to see some of the advantages of LV.  I simply want to have errors flow forward, and send a series of commands to the same instrument with some delay in some cases.


Perhaps it would be easier to help you understand if you posted the code you have so far. Are you using the sequence frame because you are using the Wait function, which has no error in/out terminals? If so, you can easily whip up a wrapper VI for that function.

 

0 Kudos
Message 9 of 28
(11,216 Views)

@smercurio_fc wrote:

 


Perhaps it would be easier to help you understand if you posted the code you have so far. Are you using the sequence frame because you are using the Wait function, which has no error in/out terminals? If so, you can easily whip up a wrapper VI for that function.

 


Smiley Very Happy I have never understood why NI hasn't done that.  I'll bet 99% of experienced developers have that VI stashed for quick access.  Not to mention OpenG. Smiley Wink

Jim

LV 2020
0 Kudos
Message 10 of 28
(11,201 Views)