LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Counting up while button is pressed, down when not

Highlighted

The goal of the code I am writing is to ramp up voltage by 100V/s while a button in "on," up to a certain value selected by the user. Then the code will wait (I just have it counting seconds) until the button is turned "off," and it will ramp down the voltage by 1000V/s, back down to 0V. The code should also always be graphing a seperate voltage input, which is the voltage monitor.

 

I tried to make the counting happen outside of the loops that are updating the voltages. I use a flat sequence structure while setting the voltages, so that it must ramp all the way up to the input value, or if the button is turned off before then, it will stop the ramp at the current value.

 

Currently none of the loops are counting as I expected and I can't tell where the program is going wrong. I have commented the code so that it is easier to tell what I am trying to do. Any help would be appreciated.

 

Micah

0 Kudos
Message 1 of 3
(132 Views)

I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
Learn LabVIEW

 

Learn about dataflow.  Your button is only read one time when your VI starts.

Message 2 of 3
(119 Views)

I strongly agree with the comment above. Understanding dataflow is the key!

 

No program doing something that can be described in two sentences requires a screenfull of seven while loops. Code does not get "better" by randomly piling more and more things onto the diagram. All you need is at most two plain while loops running in parallel, one to graph a certain value are reasonable intervals and one as a state machine to act according to the button state.


LabVIEW Champion. It all comes together in GCentral GCentral
0 Kudos
Message 3 of 3
(106 Views)