04-20-2010 05:49 PM
We are currently using Scan Mode on the CompactRIO, but the analog input channel has some noise on it and we would like to perform some time averaging (e.g. average the last N samples).
I am currently using the Mean PtByPt.vi on the RT side, but it is using significant processor power when the loop is run quickly. Is there a way to have the Scan Engine do this for me? Or am I better off writing something in FPGA to handle this?
-Nate
04-20-2010 05:55 PM
Hello Nate,
There is no built in feature to get the Scan Engine to do the averaging for you. An FPGA VI is probably what I'd recommend if you need to offload processing.
Out of curiosity, how fast are you running your loop such that you run in to problems with CPU usage?
Thanks,
Sebastian
04-20-2010 06:05 PM
04-21-2010 09:00 AM
Nate,
You mention that you are using the Wait Until Next ms function.
Do you have the scan engine configured to run at the rate you would like? You do this from the controller's property page in the LabVIEW Project.
You should then use a timed loop and select 'Synchronize to Scan Engine' as the timing source.
Kurt
04-21-2010 09:45 AM
To add to what Kurt said, the IOV is only updated once per scan, so it is important to synchronize to the scan if you want to a) be sure to get every update and b) ensure that the same value isn't read twice.
Sebastian
04-21-2010 12:11 PM
Kurt, Sebastian,
Excellent points! I have changed the loop to Synchronize with the Scan Engine.
-Nate
04-21-2010 01:47 PM
Nate,
Glad to hear it.
Are you still having difficulty doing the average with reasonable CPU usage? What sort of usage numbers were you seeing / what was N?
Sebastian