LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Newbie Question, One Time Events

Solved!
Go to solution

Hi I'm new to labview and any help would be appriciated.

 

Basically I have one numerical control, which i want to be copied to a shared variable when a button is pressed(one that does not latch), afterwards I want the user to be able to change the value of the numeric control W/O changing the shared variable to the new value. The implementation is a single entry calculator in this case, but the project is just for learning.

 

I tried logic statements as well as case structures and I haven't made it work yet.


My question is there a function or subVI which makes an event only happen once, hypothetically the wire goes away after one cycle?

 

Any Help appriciated.

0 Kudos
Message 1 of 5
(3,010 Views)

I would recommend an "Event Structure"

You can put the code inside the event structure.

For example, all of the arithmatic will be inside the structure.

 

This event will be linked to a mouse clicking the button.
For example, if the mouse clicks " + " then one thing will happen

If the mouse clicks " - " something else happens

.... and so forth.

 

 

I would go that route. I can explain more if you don't understant what I'm talking about. 

Cory K
Message 2 of 5
(2,992 Views)
Solution
Accepted by topic author Ford

Ford wrote:

Basically I have one numerical control, which i want to be copied to a shared variable when a button is pressed(one that does not latch), afterwards I want the user to be able to change the value of the numeric control W/O changing the shared variable to the new value. The implementation is a single entry calculator in this case, but the project is just for learning.


 

I don't think you have the correct definition for a "latch action button", because that's what you actually need. Place the writing to the shared variable inside the true case of a case structure. Whenever you press the  button, it will turn TRUE until it is read once and the resets to false again.

Alternatively, use an event structure triggered by a vlaue change of the button. The best choice depends on the rest of the code.

 

Maybe you should show us some code.

 

Message 3 of 5
(2,983 Views)

Thanks for the help guys, I will try your ideas tonight, and if I cannot make I work I'll post the code,

 

If it does work I'll credit where needed.

 

Thanks again 

0 Kudos
Message 4 of 5
(2,977 Views)

Thanks so much, I was very close the whole time and now it all came together, I just wired the addition fuction and its working, now onto the others.

 

Thanks

 

Much appriciated.  

0 Kudos
Message 5 of 5
(2,970 Views)