LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

switch problem

Solved!
Go to solution

Hi,

I want to save file or graph image by pressing buttons but it do not work. I attached the vi.

Egemen
0 Kudos
Message 1 of 8
(2,893 Views)
Solution
Accepted by topic author newbieeng

You need to start with some LabVIEW tutorials, because your current code is completely wrong.

 

LabVIEW does not execute left to right. You have four independent code segments that all execute in parallel as soon as you press the run button. By the time the event occurs, the local variable has been read long ago as false and all code parts to the right have already completed.

 

Enlarge your event structure and place the respective code in the respective events. get rid of the local variables! Keep data in shift registers if needed.

 

Run your current VI in execution highlighting mode for some instructive insights on dataflow. 🙂

 

You code needs to be redesigned from scratch.

Look into state machine architectures.

 

Message 2 of 8
(2,890 Views)

@altenbach wrote:

You need to start with some LabVIEW tutorials, because your current code is completely wrong.

 

LabVIEW does not execute left to right. You have four independent code segments that all execute in parallel as soon as you press the run button. By the time the event occurs, the local variable has been read long ago as false and all code parts to the right have already completed.

 

Enlarge your event structure and place the respective code in the respective events. get rid of the local variables! Keep data in shift registers if needed.

 

Run your current VI in execution highlighting mode for some instructive insights on dataflow. 🙂

 

You code needs to be redesigned from scratch.

Look into state machine architectures.

 


I did as you said but it does not work properly 😞 Where did I do wrong thing?

Egemen
0 Kudos
Message 3 of 8
(2,883 Views)

@newbieeng wrote:
I did as you said but it does not work properly 😞 Where did I do wrong thing?

Then you need to tell us what "properly means". How do you run and operate it? What you expect to happen? Whan happens instead?

0 Kudos
Message 4 of 8
(2,870 Views)

I put recording functions inside the event structure as you said. I just want to save data or graph image when I pressed the save buttons but when the program starts it immediately prompt me where to save. I really do not know how to fix that.

Egemen
0 Kudos
Message 5 of 8
(2,863 Views)

Because you have the timeout also assigned to the same event case and start with a zero timeout.

0 Kudos
Message 6 of 8
(2,858 Views)

What could I do about the timeout? Do I need to cancel timeout event?

Egemen
0 Kudos
Message 7 of 8
(2,854 Views)

I remove timeout event and it works fine now. 🙂

Egemen
0 Kudos
Message 8 of 8
(2,851 Views)