LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I hold a value of voltage, which can be used as a numeric value

Hi, I'm trying to read in a voltage value and then hold it when i press a button. This value should then be able to be used as a numerical value, e.g. I can divide it or add constants etc. I realise this is probably a totaly remedial question, but it's for my dissertation at uni and my tutor thought it would be a great idea to program part of it in Labview, which NOONE in the uni knows how to use, and we've never been taught it.
 
Any help would be awesome,
 
Grant
0 Kudos
Message 1 of 8
(3,389 Views)
Read in a voltage with what and what type of button? Do you have some sort of hardware available to physically measure a voltage? If so, what type of hardware? Is the button a physical button or a button on a computer screen?
0 Kudos
Message 2 of 8
(3,383 Views)

Sorry for the lack of expansion on the problem.

I'm using a Labjack U12 to take the voltage input, and can have this as an input on a VI. I can use the value of the voltage in real time, dividing it and displaying its value on numeric indicators etc, but I need to use an onscreen button to capture the value of the voltage at the time of pressing. I then need to be able to use the value, like it was a constant, from that time on.

Thanks for the reply.

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

Hi Grant,

This is relatively simple to implement.  However, I need more info as to how the data is obtained and what happens when you press the button.

Here are some questions:

1. Although I suspect that you read the voltage using a voltmeter / multimeter, either through GPIB or some other communication port such as serial or USB.  How often do you read the voltage?

2.  What occurs while you press the button?  Does it continue to read voltage samples?  Are things put on hold?  Does it simply display the value?  Does it also calculate?

3.  What does the program do when you release the button?

4.  How does the program stop (stop button?)?

5. What should appear on the interface?  And how does the operator interface with the program?

The above affect how the solution is implemented.  Sorry to answer your question with 5 questions..  But it will get you there.

Cheers,

RayR

🙂

0 Kudos
Message 4 of 8
(3,374 Views)
That's a little better. Smiley Very Happy I haven't used the Labjack but I believe that there are LabVIEW drivers for it. You should search for forum for Labjack or go to their web site. After you get the hardware drivers installed, then it's a pretty basic program to monitor a front panel Boolean in LabVIEW for a click. The best way is with an event structure. When the hardware driver is called from LabVIEW, it will return some numeric value. Depending on how you set up the Labjack, this might be a single value or an array (i.e. multiple measurements over time that would represent a waveform). You might want to start at http://zone.ni.com/devzone/cda/tut/p/id/5054 for a quick introduction to LabVIEW. There are a lot of on-line resources as well.
0 Kudos
Message 5 of 8
(3,367 Views)
Check out the attached example.  It simply uses a while loop to wait for the button click.  When the button is clicked, the TRUE case structure is executed which calls the simple LabJack U12 EAnalogIn function.
0 Kudos
Message 6 of 8
(3,365 Views)
Thanks JoeLabView, but maybe I should start by describing the purpose of the program.
 
I'm reading the voltage going into a DC motor (max 200V) so i'm using a 10:1 voltage divider to reduce the voltage seen by my labjack since it can only measure up to 20V. I read the voltage seen at the voltage divider, e.g.  20V at 200V and then, in labview, multiply this by a multiplying factor to get it back to 'actual' voltage. e.g. 20*10 = 200. But since resistors aren't made perfect, (especially not 5A ones) my divider actually works out at something like 9.8756:1. Therefore I have to set the voltage to the motor to something known (e.g. 100V), then tell labview that value, it reads the voltage input to it through the labjack, and MultFactor = UserInputVoltage/LabjackVoltage.
 
Using the multiplying factor, I can then display the 'Actual' voltage over the motor.
 
The motor is also being controlled by LabView, but this is simply using a slider, attached to an analogue_out VI for the LabJack, so shouldn't be too consequential.
 
Now to answer your questions.
 
1) The LabJack is a USB device which 'instantaneously' reads the voltage, so as the voltage input to it changes, so does the value output by its VI in LabView. It changes in real time.
 
2) I will need to continue to use the input from the LabJack once I have generated the mulitplying factor, multiplying the LabJack input by the multiplying factor in real time, so I can plot a graph of the change in voltage with 'real' values.
 
3) Do you mean what does my program do just now when i release the button, or what i want it to do?
 
4) I don't know how to structure the program, but hopefully what i've said above should help.
 
5) The interface will include;
Numeric Control to set the 'actual' input voltage
A button to tell the program when to generate the mulitplying factor
A waveform chart displaying the 'actual' voltage (0-200V)
A slider that I can use to control the motor. (this part i can do myself, it's a reference for a PWM circuit connected to a buck converter)
 
Thanks again man, hope this is what you need.
0 Kudos
Message 7 of 8
(3,361 Views)
Perhaps another thing to look at is one or our standard LabJack U12 examples called "simple eanalogin loop with chart.vi" (attached).  You could just a call to EAnalogOut to control your output.  This example runs all the time, which might be fine for you, but if you prefer to have it only communicate on a button click you could put everything in a case structure like in the previous example we posted.
0 Kudos
Message 8 of 8
(3,353 Views)