LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to make a global array by shift register

how to read and write, thanks
0 Kudos
Message 1 of 27
(6,818 Views)

Could you explain in a few more words what you are actually looking for? What are you trying to do?

(Maybe an action engine)???

Message 2 of 27
(6,812 Views)
I need to use a global array, instead a normal way, I want to implement by a vi with shift register, is there any sample, thanks.
0 Kudos
Message 3 of 27
(6,774 Views)
Assuming your shift register is wired as (for example) a 2D array, and your global is also 2D, just wire the RHS output of the shift register to the 2D global variable.
0 Kudos
Message 4 of 27
(6,767 Views)

See the attached example of functional global for Read & Write 2D -Array.Modify this as ur need.

 

-Kumar B

0 Kudos
Message 5 of 27
(6,761 Views)
Its really not clear to me what you are trying to achieve. However, if you take the vi I've modified and replace the "Global Array" with a genuine global array, it may do what you want.  Notice I've also added an array constant to the LHS of the shift register to initialise it.
0 Kudos
Message 6 of 27
(6,757 Views)

I hear there are 2 ways to create global in labview, one is using shift register.

I am not sure how to run the read-write vi, will it keep running all the time?

0 Kudos
Message 7 of 27
(6,746 Views)
Firstly, about Globals. You create a global (the first one for a project, anyway, by clicking the Structures button of your Functions palette. You'll find GLOB on the bottom line. Drag it to your block diagram. Now double-click it to see the actual Global panel. (There's no block diagram for a Global Front Panel, so really its just a Global panel). On this panel you can create any kind of Front Panel control you wish. Then go back to the block diagram where the Global Variable is waiting. Right-click it. Choose "Select Item" from the list, and select one of the globals you created on the Global FP.  You can clone a Global Variable, then right-click it, and "link" it to a different Globl control.
0 Kudos
Message 8 of 27
(6,738 Views)
To make the vi run continuously, the functional parts need to be placed inside a loop. See the example. You'll see the "Conditional Terminal" (red) is wired permanently false. This keeps the while loop running. Normally, you'd wire this to a switch or button on the front panel to enable you to decide when to exit the loop, or to some boolean condition that arose (something going True after some time).
0 Kudos
Message 9 of 27
(6,709 Views)
Johnboy,
 
Your example is a horrible hack and not at all in the spirit of an action engine.
  • An action engine stores the data in a "uninitialized shift register", eliminating the need for local variables
  • Your shift register serves no purpose at all, because you initialize it at each call and instead use the disconnected object "global array" for data storage. You might as well get rid if the shift register completely! Why use a shift register if you initialize it at each call?
  • You are creating unecessary copies of your data for no reason.
  • Why would you want to run this continously without any wait, simply consuming 100% CPU? An AE is meant to be used a subVI that returns immediately.
  • The while loop in your last example makes no sense. It serves no purpose because it has no shift register.
  • Kumar's example is just fine, why mutilate it by making it much more complicated???

For those who use LabVIEW 8.5, feedback nodes no longer need a "one iteration loop" but can stand alone. Here no longer even need a loop (see image).



Message Edited by altenbach on 12-10-2007 12:11 PM
0 Kudos
Message 10 of 27
(6,698 Views)