LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

using current output from for loop

Highlighted

Hi,

 

I have a program written to take a torque reading from a transducer. the transducer has an offfset error when starting, ie it thinks it is at -2, when it should be zero.

 

to solve this the program currently takes the initial reading, and uses this as an offset for the rest of the readings, which are acquired in a for loop.

 

I need to develop a way of doing this manually, ie the user can press a button, and whatever value has just been read is the used as the zero point offset.

 

I have tried to do this using a simple case structure within the loop, where the initial value is used, until the button is pressed and the current value is used. however this does not work, as it keep using the updated value of the output array.

 

I have next tried to index the array so it is at the point the button is clicked, however the index is also counting up so the offset follows the output value still.

 

Any thoughts on how to solve this?

 

Thanks,

 

JM

0 Kudos
Message 1 of 4
(918 Views)
Highlighted

Hi Jon

 

My Name is Jonathan & I work with NI UK in the Applications Engineering Department. 

 

Im not 100% with what you need to achieve, however I have created an example of using Event Structures and property nodes to reset an input value to 0 which may give you some inspiration to adapt to your application,

 

Please find it attached to this post as well as a screenshot, if you need this VI adapting to a different version of labVIEW other than 2013 then please let me know and i'd be happy to convert it for you.

 

I hope this gives you something to go on.

 

Cheers

 

J

Reset Offset.PNG

J Hobson
Certified LabVIEW Architect
Certified Professional Instructor
0 Kudos
Message 2 of 4
(908 Views)
Highlighted

I dont need to reset the value to 0, i need to reset it to whatever value the for loop holds at that time.

 

I have now solved this problem with a shift register built into the case structure. thanks for you help anyway

0 Kudos
Message 3 of 4
(899 Views)
Highlighted
Jon is on the right track, but it sounds like he may have missed your point.

You do want an event-driven program, so first are you familiar with event structures and how to use them? If not, learn.

Second, I would create an event structure with a timeout event and a value change event for the button that triggers the zeroing. Set the timeout value for the desired sample interval.

Also you need to create two shift registers on the while loop surrounding the event structure and initialize both to zero.

Put the DAQ read VI in the timeout and subtract the contents of the bottom SR from what you read and put the result in the top SR. The the value change event for the button take the contents of the top SR and wire it to the bottom SR.

The bottom SR will carry the offset, and the top SR the zero'd value.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 4 of 4
(861 Views)