我想在现有的生产线弹簧受力程序中添加一段计算平均值的程序,原程序仅读取一个随机值然后输出。
& G1 b' K, F4 R因为弹簧受力有小幅度的震荡,所以我想让程序读取10个值,然后算出平均值输出。2 w* w. G! O2 H5 [0 ~1 g# Y
关于提取测量数据计算平均值的程序,小弟实在是学得太少。。只会输入几个数求平均值的程序。& f0 R: |6 b: i
下面这段是原程序,感谢进来帮忙的高手们!!
* f' [) j: n8 l+ y: I JU S_00; / / Wait for release
5 z1 \3 ]+ K# {- E7 n! ~ N+ v JU S_01; / / Read controller status and decide whether to start is needed.
! ]$ Q. p a" p, c' k [* s4 t4 e JU S_02; / / Start CanOpenNode (if necessary) then return to Step 1.
) I* @7 p- T! v4 D. c JU S_03; / / Reserve Step
* `% Y( |# P. o1 M5 K JU S_04; / / Read current position in increments 5 [+ [4 v8 ^" ~7 h- }, d/ s
JU S_05; / / Read current limit set in mA
! ]* k. p/ z* A JU S_06; / / Read current flow in 1 / 1000 to current limit ; }# c, R. I+ j7 i- Q
JU S_07; / / Read back ) U- m7 A& I) ~8 B, L" K' E- b
JU S_08; / ??/ Read back ! _5 V( ?! x9 }& V z4 H
JU S_09; / / Read back
! z, n6 @5 n: L& T: v3 W* j. K) z o JU S_10; / / write the forward position 4 F, E% O: l7 {0 e" m6 _! {
JU S_11; / / Write back position , L* u2 A ~1 W8 F
JU S_12; / / Write Maximum Test Current ; V7 n& B5 Y' E" b7 X/ Z
JU S_13; / / write back
% z% Y5 |2 U- C5 p JU S_14; / / write back
( M0 Z4 O5 y6 V JU S_15; / / write back
9 u, B: J, s2 j; | JU S_16; / / write back
# P/ Q& u! m) x0 x1 f' P JU S_17; / / write back * F* M; m$ f) {; f% r% e
|