LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Obtaining zero values to use for data calculation

Solved!
Go to solution

Hey guys, I'm looking to "capture" a zero reading before I start my data measurement. I have 4 analog channels that are running continuously through a producer/consumer architecture. I want to push the "start" button and hold the most recent value for these 4 channels in order to compute some conditions later on in my code. Is there a way to do this without using local variables?

0 Kudos
Message 1 of 13
(3,576 Views)

Hi glskinner,

 

usually you use ShiftRegisters to "hold" values. No need for locals...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 13
(3,572 Views)

Hi Gerd, How do I hold these values if I'm taking continuous data? I want to store them once an event happens.

0 Kudos
Message 3 of 13
(3,568 Views)

Hi glskinner,

 

the standard pseudo-code would look like this:

IF event THEN
  store new value in shift register
ELSE
  keep old value in shift register
ENDIF

 A simple Select function can help here...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 13
(3,564 Views)

so, something...(big something) like this?

0 Kudos
Message 5 of 13
(3,557 Views)

Hi glskinner,

 

no, you did not follow my pseudo code. You always keep the old value in the shift register...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 13
(3,554 Views)

Old values are coming from the right side of the shift register..correct? And the most recent are on the left?

0 Kudos
Message 7 of 13
(3,537 Views)
Solution
Accepted by glskinner

Hi glskinner,

 

when you're unsure about usage of shift register you should take the online courses available at NI.com!

 

See this:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 13
(3,531 Views)

My data is coming from a continuous 1d array. Could I index it into a for loop and use the method you described above? I see that the true selector is a constant/control. I want to read my analog channel (indicator)...and get the most current value passed from the array.

0 Kudos
Message 9 of 13
(3,518 Views)

Hi glskinner,

 

what is a "continuous array"?

What means "pass a value from an array"?

 

Yes, you can index values from an array using IndexArray. (Did I mention online training courses before?)

Yes, you can "read your analog channel". What's the problem here?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 13
(3,514 Views)