09-28-2013 01:30 AM
Hey,
This ia a very basic issue I have been facing for quite some time and am unable to figure out a solution for this.
I have an indicator display that has to update the value it shows only whenever a boolean is ON. The indicator displays the average of ten samples, and has to update only after ten samples have been acquired. The boolean goes ON after the acquisition of every tenth sample.
I have tried keeping the indicator in a case structure, but it ends up displaying 0 all the time. I then tried to pass the wire through the case structure keeping the indicator outside, and even that didn't work.
Can you please suggest a solution ?
Thank you
09-28-2013 02:07 AM
THis sounds trivial.
Make sure the case structure calculates the average and updates the indicator every 10 iterations.
Please show us your code so we can see what you are doing wrong. Thanks.
09-28-2013 02:10 AM
Show us your code
09-28-2013 09:56 AM
Hi,
PFA an image of my program.
I don't want to hide the inidicator. I just need it to update itself at the end of every fixed number of cycles.
I know this problem is quite trivial, which is why this is quite frustrating,
Thanks
09-28-2013 09:57 AM
BTW, The "AnalogAverage" is the indicator I am trying to update every fixed number of cycles.
09-28-2013 10:26 AM
You are not showing your program, but just a picture. That's not the same. For example we cannot see what's in the other cases.
I don't see why placing the "Analog average" indicator inside the case structure would not solve the problem.
You should really keep the "total" inside a shift register also. I see many problems with you code overall (e.g. race conditions). For example the "No of data pts acquired" is read from the local variable before the terminal has been updated, while the "total" contains the updated value of the iteration. You are mixing stale and current values in the same operation!
Why the weird mix of representations I16 data, I32 counts, I64 total, etc.? Your code is peppered with coercion dots.
Several of your case structures can be combined into one. Keep it simple!
What determines the loop rate?
09-28-2013 12:28 PM