LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Stopping loop when output = 0

Hi, I was wondering if anyone knew how to stop a loop when the final output is 0.  I'm doing battery life testing with a agilent multimeter and want to loop the reading of the voltage until the output = 0 so that the timer can stop at that point.  How would I get this done?
0 Kudos
Message 1 of 16
(4,133 Views)
that's a simple while loop. What's your problem?
Software developer
www.mcm-electronics.com





PORTUGAL
0 Kudos
Message 2 of 16
(4,128 Views)
As said, that's quite simple using the stop node on the while loop structure, but the battery voltage will likely take the rest of eternity to drain to 0.00000000 volts, so if you're using DBL precision numbers test for the voltage being below some reasonable threshold, not EQUAL to zero.
0 Kudos
Message 3 of 16
(4,124 Views)

so... Put the condition to stop if Voltage < 0.0002 (or another value that you find better)

Software developer
www.mcm-electronics.com





PORTUGAL
Message 4 of 16
(4,113 Views)
It is always a bad idea to compare floating point numbers with EQUAL....

Norbert
Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 5 of 16
(4,102 Views)
I'm new to programming, Norbert. Please explain.
0 Kudos
Message 6 of 16
(4,077 Views)
Well.  Lets say you have a variable 'a' that is a floating point double percision number (that is to say it has a decimal point and is not an integer but is real).  You want some action to occure when a is = '0'.  The problem is that it may never = '0', but instead something that you would consider low enough to be 0 such as 0.0000001 or 0.001.  Depending on the circumstance of where that number is coming from and you are trying to acomplish your threshold may be different.

so what you really want to solve for is:

a < 0.00001

not

a == 0



Message Edited by Nickerbocker on 01-23-2008 05:47 PM
Message 7 of 16
(4,060 Views)
Okay, thanks.
0 Kudos
Message 8 of 16
(4,034 Views)
Ok I've done my labview program and now on to the hardware section which I've got a couple questions on if nobody minds.  So I soldered some wires to the pins of both the battery and the phone.  Phone works perfect with the battery outside the phone.  I've got an Agilent multimeter that will take readings into my LabView program.  Do I just put the leads to the positive (red) wire and common (black) and test the current?  I've tried this once and the phone shut off upon putting the leads on both terminals.  Any help?
0 Kudos
Message 9 of 16
(3,967 Views)
to test current, you have to put the probes in one wire, not across two. 
 
for instance  ---------|<left probe>|     |<right probe>|-----------
 
instead of
 
 
 
---------------|<left probe>|-----------------
 
---------------|<right probe>|---------------
 
 
basically, current measurement has to be in series, not in parallel.
 
 
edit - the reason your phone shut off is because ammeters have very low input resistance to avoid burning any of the current being measured.  so, when you put it across your terminals, you were simply discharging your battery through the meter instead of through the phone.


Message Edited by JeffOverton on 02-01-2008 11:29 AM
0 Kudos
Message 10 of 16
(3,961 Views)