12-08-2012 06:30 PM
Hi guys,
I'm new enough to LabVIEW, and indeed this forum, so I hope you can help. I'm guessing it's a simple problem, but I can't figure out how to do it.
I've got a cRIO taking in 4 analog voltages. Each voltage is from a linear potentiometer which is measuring suspension displacment on a Formula Student race car.
I have a simple formula set up to convert input voltage to displacment. I've set up a table of inputs which allows me to set maximum, minimum,(from previous sensor calibration) and "stationary" value of each sensor.
The "stationary" value is what the sensor should be reading when the car is stopped. This is then used as a baseline for either positive or negative displacments.
My problem is that each time a different driver gets in the car, the susspension is adjusted, or fuel is added, the "stationary" value will be different. I then have to manually set the stationary value back to whatever the current value is when the car is stopped, press "make current value default", and save the VI before continuing.
What I would like, is a "calibrate" button which I can press that sets the "stationary" value to whatever the current input voltage is. This way, I wouldn't have to reset 4 values each time the car is modified.
If you have any ideas on how to do this, please let me know.
I'll attach my VI once I get back to the laptop where it is saved!
Thanks,
Kevin Irving
Solved! Go to Solution.
12-08-2012 08:17 PM
Kevin,
As you have discovered you cannot change the default values on a running VI.
The best way to do what you want is to use a configuration file. There is a set of VIs specifically designed for that purpose on the File I/O palette. When the user presses the "calibrate" button, the values are saved to the file. When the program starts it reads the file and sets the controls to the values in the file. You can even keep different sets for each driver, if the data is consistent enough.
Read the detailed help files for the configuration VIs and look at the examples. These will show you how to get started.
Lynn