11-09-2018 03:33 PM
Hi all,
Fairly new to Labview.
I'm taking voltage readings from a load cell and trying to use that to measure weights.
I've calibrated the scale to identify my scale's sensitivity (in V/g) to convert the sampled voltage value to output the weight.
The issue I'm having is, my calibration for 0g is hard set to a specific voltage value (0 V). However, when I run LabView, my NI-DAQ doesn't always read a zero load situation as 0 V, it will be offset by a certain amount up or down.
I'm trying to create a LabView VI that responds to a Push Button on the block diagram. What I'd like is that when this PB is pressed, LabView will update my zero loading value to the current reading. This way, I don't have to manually update the zero offset every time I run the program.
I'm fairly well versed with software development, and this normally wouldn't be challenging on a traditional language, but I'm having trouble how to execute this with LabView. I presume I want to set the zero loading value into a variable and the PB should call for a function that updates the variable to the current reading. Can someone point me in the right direction?
Solved! Go to Solution.
11-09-2018 04:06 PM
Without seeing exactly how you program looks, assuming you are "constantly" reading the scale value, all you need to do is, when the button is pressed (latch), store that offset value into a shift register. Your final value should then be the reading less the offset.
11-09-2018 04:06 PM
Well, in most cases when you want something to happen when you press a button, start with an Event structure in a while loop and go from there.
11-09-2018 05:08 PM
Hi! Thanks for replying. Please take it slow, I'm still learning. Can you clarify what you're asking to do? I've updated the original post with screenshots.
11-09-2018 05:16 PM - edited 11-09-2018 05:34 PM
Hi! Thanks for your reply. What you've suggested actually makes a lot of sense.
Here is what I've done.
I created an event structure that responds to the PB being latched. What I want it to do is read the average value into a variable and that's the variable I submit into my formula node as input z.
Currently, the issue is that I've created a test variable that stores the average value when the event is triggered. This test variable is what feeds the z input in the formula node. But, when I set the test variable to write, I'm getting an error that the test variable in an input, not an output. If I set it to read, then it acts as an output, but it gives weird values for my y-output of the formula node.
What gives?
11-09-2018 05:47 PM - edited 11-09-2018 05:47 PM
In this situation, I would actually advice against the Event Structure. You can handle it all with just a single loop.
1. Turn your Set Zero button to an actual button that latches.
2. Store the "zero" offset in a shift register. You can use a Select function to choose between the current value or the stored value. Update the shift register with the selected value.