You are here

Stacked Sequence

26 July, 2019 - 09:47
Available under Creative Commons-ShareAlike 4.0 International License. Download for free at http://cnx.org/contents/5b6e61df-b830-48cb-9764-94696cb47c80@1.3

A Stacked Sequence provides a more compact representation of program sequences. It is programmatically identical to the Flat Sequence with the exception that a Sequence Local enables data to flow to subsequent frames. Additionally, as frames are added, a Sequence Selector provides access to the desired frame (see Stacked Sequence).

media/image52.png
Figure 5.51 Stacked Sequence 

For this timing example, start with a Stacked Sequence and add 3 more frames. The sequence frames are labeled 0, 1, 2 and 3 and will execute in that order.

media/image53.png
Figure 5.52 Four Frame Stacked Sequence  

Go to the first frame (frame 0) and add a Tick Count (ms) function. Right click on the sequence structure and select Add Sequence Local from the pop-up menu.

media/image54.png
Figure 5.53 Adding Sequence Locals  
media/image55.png
Figure 5.54 Adding Sequence Locals  

The Sequence Local is shown as an undefined tunnel. Wire the Tick Count (ms) function to the Sequence Local to define the tunnel data type and data flow. Data can now flow from frame 0 to the other frames as needed.

media/image56.png
Figure 5.55 Sequence Local 
media/image57.png
Figure 5.56 Sequence Local 

Go to the next frame sequence (frame 1) and enter the program to be timed.

media/image58.png
Figure 5.57 Frame to Time 

Go to the third frame of the sequence (frame 2), add a Tick Count (ms) function, add another Sequence Local and wire the Tick Count (ms) to the new Sequence Local. The wired sequence frame is shown in Stop Time Stamp.

media/image59.png
Figure 5.58 Stop Time Stamp  

Go to the last frame (frame 3) and add aSubtract function. Wire the Sequence Locals from frame 2 and frame 0 to the Subtract function as shown in Stacked Timing G Program. To complete the diagram, wire the output of the Subtract function to the unsigned integer 32 output.

media/image60.png
Figure 5.59 Stacked Timing G Program  

It is important to note that the programs in Timing G Program and Stacked Timing G Program are programmatically identical.