LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to creat a global variable?

Solved!
Go to solution

I want to creat a start button of global variable to control different programs in the sequence structure. But I do not know how to creat it. Thanks for answering.

0 Kudos
Message 1 of 20
(3,903 Views)

I would not use a global fo that. Tell us what you are trying to do and I think there will be a better answer. Do you have code of what you are trying to accomplish?

Tim
GHSP
0 Kudos
Message 2 of 20
(3,901 Views)

Your question is WAY TOO VAGUE and too confusing. A "start button of global variable" makes no sense. What is this sequence that you're talking about? Is this some sort of test sequence? Please provide more details. We are not mind readers.

 

Do you have code that you've created? If so, post it and tell us what you're trying to do.

0 Kudos
Message 3 of 20
(3,899 Views)

Thanks for answering. I attached the code below.

What I want to do is to combine Get Voc/Isc and GO buttons (shown in the front panal) to one button, and also combine Setup Linear Stair Sweep and start sweep together. I do now find a good way to do that. Thanks so much for your kind help.

0 Kudos
Message 4 of 20
(3,893 Views)

Get rid of your timeout event. Make an event on the Value Change of the stop button, and another event on the value change of the start button. No need to use a mouse down event and a timeout event.

0 Kudos
Message 5 of 20
(3,880 Views)

I do not see the buttons that you had in the last respnce. I would suggest that you use the event structure in the same loop as your state machine. This will eliminate the need for what I think you are trying to do. Then you can set up event to key off of multipule buttons.

Tim
GHSP
0 Kudos
Message 6 of 20
(3,879 Views)

Your top loop is useless.  Delete it.  Put the start button in place of the local variable in the Wait for Start case.  If you make the mechanical action of your start button to Latch When Released, you won't have to write false constants to it, like you are doing with the global start.  In fact, you don't even need the global at all.  Same for stop button,  It is already set to latch type.  You have several choices on how to stop the program.  You could put the stop button inside the Wait for Start case and wire it to the loop stop sign.  Or you could create a stop case and have the stop button send a stop enum to the case selector.  In here you wire a true constant to the stop sign and put whatever clean up code you would have.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 7 of 20
(3,869 Views)

 


@Perry Liu wrote:

Thanks for answering. I attached the code below.

What I want to do is to combine Get Voc/Isc and GO buttons (shown in the front panal) to one button, and also combine Setup Linear Stair Sweep and start sweep together. I do now find a good way to do that. Thanks so much for your kind help.


 

There is no "Get Voc/Isc" or "GO" button anywhere on the front panel, and I have no idea what you mean by "Setup Linear Stair Sweep" and "start sweep". Are you sure you uploaded the correct code?

 

Other VI comments:

  • You are abusing/misusing global variables. 
  • You already have a state machine, so you can actually code this using just the state machine without actually needing the separate event structure loop. Even if you do keep it, that still does not require you to use global variables.
  • Why do you have a loop around the Write to Spreadsheet File? This serves no purpose and actually stops your code in that loop until the Stop global is set. This doesn't make much sense.
  • Since you do not have a path wired to the Write to Spreadheet File VI, you will be asked for a path each time the loop iterates. Use a shift register to hold the value of the path from iteration to iteration.
  • Get rid of the Build XY Graph Express VI and those Convert to Dynamic Data functions. Replace with a single Bundle function.
0 Kudos
Message 8 of 20
(3,868 Views)

I am so sorry that I upload a wrong code, this is the right one. Sorry

0 Kudos
Message 9 of 20
(3,858 Views)

Ok I am looking at your code. How do you want to combine the "setup DCV and Outp ON OFF" as one when they have different code? Which code do you want to accomplish? Which button do you want to keep?

 

Same with the other two buttons?

 

Have you ever worked with an arrrayed state machine?

Tim
GHSP
0 Kudos
Message 10 of 20
(3,824 Views)