LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Decrementing an integer through a .vi

Greetings,
 
I am creating a .vi that simulates 2 processes running side by side (Proc #1 & Proc #2) up to a variable limit. The processes each increase via a random number generator per some multiple. The multiple for each starts at 10.
 
After the .vi execution is complete, the process that reaches the limit first, will decrement the multiple by 1 through the .vi to prepare to run again or have the choice of stopping the .vi. through the two button user input.
 
The process will be started again by selecting a "go" button from the front panel. After the limit is reached the process can be stopped or decremented again...and so on. (The 'go' button is not shown on the front panel).
 
I am stumped on how to decrement the variable... Attached is what I have so far. Any help is greatly appreciated
0 Kudos
Message 1 of 7
(3,140 Views)
Is there a reason for it to step back down? If you simply restart the code you have right now it will start at the beginning (0) again.

But to get it to step back down, you could create another shift register that contains a boolean value. Put case structures around the addition operators and wire the boolean value to the selection node of the case structures. Make sure the addition is in the false case, and put a subtraction operator in the true case. Now, starting with the value initialized to false, you count up until one of the processes reach the limit. But instead of stopping, the boolean value is set to true and you start counting back down. Stop the loop when either of the process values are less than or equal to zero AND the boolean value is true.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 7
(3,137 Views)
oops - duplicate...

Mike...


Message Edited by mikeporter on 11-07-2007 11:40 PM

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 3 of 7
(3,137 Views)
Thanks for your reply, but you lost me at "But to get it to step back down, you could create another shift register that contains a boolean value. Put case structures around the addition operators and wire the boolean value to the selection node of the case structures"
 
Where do I create another shift register and what is the selection node of the case structure? I apologize for the "novice" questions because I am a novice!!!
 
I appreciate the help and patients for us beginners trying to learn the ropes!
 
Newbie 2
 
0 Kudos
Message 4 of 7
(3,129 Views)
The first thing to do is go through the "getting started" materials that ship with LV or take a LV Basics course. That will teach you about shift registers and case structures - and a bunch of other stuff besides. Where are you located?.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 5 of 7
(3,125 Views)
I am located in upstate NY.
 
I will look through LV materials and your instructions to get through this.
 
Thanks!
0 Kudos
Message 6 of 7
(3,102 Views)
You can also contact your local NI rep to look into class availability, or call my company (DSA @ 724-942-6330) and we can also talk to about getting hooked-up with LV training.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 7 of 7
(3,088 Views)