LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

count signed iterations

Solved!
Go to solution

I'm trying to count the iterations above and below 0 applied volts (Vapp).  This is used as a SubVI inside a For Loop.  One of these (the positive, I think) seems to work, reinitializing at zero for each run.  The other seems to add to the previous run each time.

For instance, 6 intervals each below and above zero returns 6 and 6 the first run, and 6 and 12 the second time.  I know it's a hack, but I didn't know how to do this better. 

0 Kudos
Message 1 of 8
(3,760 Views)

I am still trying to figure out what your question is?

 

 

Can you elaborate more what exactly you want and what problem you are facing?

Somil Gautam
Think Weird
0 Kudos
Message 2 of 8
(3,755 Views)

Maybe you should attach your toplevel VI too. It is not clear how the inputs are supposed to be wired.

 

What is purpose of the "interval counter" input?

What is your definition of an "interval"?

Shouldn't your counters be blue?

 

 

0 Kudos
Message 3 of 8
(3,749 Views)
Solution
Accepted by topic author Emm
Try maybe something like this. Reset if [i]=0, for example.
Message 4 of 8
(3,745 Views)

Picture 1.png I found *a* fix, I think, somewhere else, eventually.  If I add this to my SubVI, it should work, right?   

I don't know why the polymorphic numeric data controls and indicators are not all blue, except that some of the inputs, like voltage, are orange to begin with. 

I didn't add my top-level VI because it's big, and has many other SubVIs.  (I've added it here.)  Interval Counter is used in the bottom, left-hand corner of the For Loop. 

Download All
0 Kudos
Message 5 of 8
(3,716 Views)

(Voltage) "Interval" == "Iteration", as in "number of 2V intervals between -minV and 0V" and "number of (same size) intervals between 0V and maxV", where min and max voltage, as well as the total number of intervals are set by the user.

Interval Counter is a check against the calculated, intended number of intervals.

I couldn't figure out the "Reset if [i]=0", and *just* saw the attachment, but I need it to reset automatically every time it's called by the main VI, not be manually done by the user.

Thanks. 

0 Kudos
Message 6 of 8
(3,712 Views)

Emm wrote:

 but I need it to reset automatically every time it's called by the main VI, not be manually done by the user.


If you reset it every time you call the subVI it, it will never be able to count anything. Right?

 

If you only want to reset it at the first iteration of the main loop of the toplevel VI, you would wire a "=0" to the iteration terminal and the output of it to the reset therminal of my subVI. Try it.

Message 7 of 8
(3,707 Views)

Okay, I think I've got it.  I kept the formerly mis-named "Interval Counter" (Iteration) control link instead of the Numeric Constant, but it looks like it should work.  Can't test it at home.  😞

Thanks! 

0 Kudos
Message 8 of 8
(3,677 Views)