我想在现有的生产线弹簧受力程序中添加一段计算平均值的程序,原程序仅读取一个随机值然后输出。
' c. \4 r5 F. J3 j, K5 r# c" o4 @! B因为弹簧受力有小幅度的震荡,所以我想让程序读取10个值,然后算出平均值输出。' B% E. B; u2 S; [2 g* f
关于提取测量数据计算平均值的程序,小弟实在是学得太少。。只会输入几个数求平均值的程序。" S2 A8 a8 \& ^
下面这段是原程序,感谢进来帮忙的高手们!!
$ @: C0 j" v! F3 H2 J JU S_00; / / Wait for release $ K( e: c$ H7 B5 u n$ ?
JU S_01; / / Read controller status and decide whether to start is needed.
9 d, S& P- S( T- }, I+ K' f JU S_02; / / Start CanOpenNode (if necessary) then return to Step 1. % \: E2 E. K1 }0 `; O6 F" G1 `
JU S_03; / / Reserve Step
! e0 z9 L; c F9 c2 M JU S_04; / / Read current position in increments / m- h' @3 ~8 H& L/ T4 u% ?' w5 k, i$ c
JU S_05; / / Read current limit set in mA 0 C8 P4 h; l% Y% M3 z% N
JU S_06; / / Read current flow in 1 / 1000 to current limit
: Y* w' A' ]. K3 y9 b( C l d JU S_07; / / Read back Q, E" @( I4 q
JU S_08; / ??/ Read back , l( Z8 u- E' U" T4 ]
JU S_09; / / Read back
* |& H5 N$ f- }& _3 ^ JU S_10; / / write the forward position ) K) J0 ]: V9 u ]& r7 G8 S- A
JU S_11; / / Write back position
+ _3 h! X& x7 A! ` JU S_12; / / Write Maximum Test Current
% z9 o! r) I9 g! ]& ? JU S_13; / / write back
( z. D: p5 p8 {4 g" n- O. i) G JU S_14; / / write back
+ q0 B: e/ _, k4 F" y JU S_15; / / write back / Q0 U. Q% A2 s9 H/ Z- K
JU S_16; / / write back
! y' ~8 e/ G6 @1 K JU S_17; / / write back 4 c% P( }, D! q6 c
|