LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Averaging oscilloscope readings

Solved!
Go to solution

I have a four channel virtual oscilloscope. I trigger and get values in a 2D array. I want to average five consequetive results. However, the program I am trying to modify is coded badly, I cannot use shift registers. My only option is storing the oscilloscope values somewhere and after getting five of them dividing by five.

 

I tried with arrays but I don't havw much experience, so I could not get it done. What would be the best approach?

 

Thanks,

Erden

0 Kudos
Message 1 of 5
(3,179 Views)

Hi Erden,

 

1) Why can't you use shift registers? They would be the first approach to store data...

2) When you don't have experience you should always start with the (free) LabVIEW courses offered be NI!

3) When you still have no experience you should continue be studying the examples coming with LabVIEW!

4) After solving points 1 to 3 you should store your data in an array and calc your average by summing an dividing...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 5
(3,168 Views)

Hi GerdW,

Thanks a lot for your post.

 

1) It is a very badly structured code, it seems impossible to use shift registers. When I have time, I will try implement a state machine structure.

2) I recently took Core 1. I developed some other applications, implemanted state machines. So far everything was ok.

3) I also studied the examples. However it seems like I am missing something very basic.

4) Here is the problem:

I have experience with text based programming languages. Here is my logic:

 

Initialize SUM

for i =1 to 5

 SUM=SUM+Acquired value

Next

RESULT = SUM / 5

 

When I run "SUM=SUM+Acquired value", I get zero. I define SUM as a local variable in order to process. 

 

Isn't that the right approach?

 

Thanks a lot,

Erden

0 Kudos
Message 3 of 5
(3,150 Views)
Solution
Accepted by topic author Erden

Hi Erden,

 

a local variable is seldomly the correct approach 🙂 (You know LabVIEW uses a DATAFLOW approach?)

 

Try that instead:

check.png

Two ways, with and without shift register...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 5
(3,147 Views)

Hi GerdW,

 

Yes you are right. I should quit my old habits form text based languages Smiley Happy Instead of trying to modify the bad old code, I will code it from stracth and implement one of the solutions you suggested. That would be a nice practice for me.

 

Thank you very much and have a great day!

Erden

0 Kudos
Message 5 of 5
(3,137 Views)