我想在現有的生產線彈簧受力程序中添加一段計算平均值的程序,原程序僅讀取一個隨機值然后輸出。
5 R6 G h" y& a$ c% y/ T- W因為彈簧受力有小幅度的震蕩,所以我想讓程序讀取10個值,然后算出平均值輸出。( [# R. `1 l8 J5 l* a* `! |% Q
關于提取測量數據計算平均值的程序,小弟實在是學得太少。。只會輸入幾個數求平均值的程序。
5 W$ K; I; u: ]4 o! D9 \) F下面這段是原程序,感謝進來幫忙的高手們!! 8 W, b8 m8 C- Z, I
JU S_00; / / Wait for release ! s: P$ N6 D; ? y. `- w
JU S_01; / / Read controller status and decide whether to start is needed.
P- M( M" `, A- p7 t JU S_02; / / Start CanOpenNode (if necessary) then return to Step 1. ; M4 `0 x4 x. R" Q* [
JU S_03; / / Reserve Step : K$ ?3 v9 J5 z; d
JU S_04; / / Read current position in increments
. D) J/ S7 E5 k& \ s JU S_05; / / Read current limit set in mA 6 n% L) u/ h# G% Z/ V
JU S_06; / / Read current flow in 1 / 1000 to current limit / R2 E& l* W& }8 u( Y* n5 q
JU S_07; / / Read back
& x0 ]: P$ g, P( z) h JU S_08; / ??/ Read back , a- H7 c, m8 H8 d4 C. H
JU S_09; / / Read back
) \& g' U8 ^3 D5 R4 e t JU S_10; / / write the forward position ; H" f# F7 E# d
JU S_11; / / Write back position
1 j: j v) {! b! M" k* L- s4 s JU S_12; / / Write Maximum Test Current
; v- B. p/ L; `3 ~4 |% r JU S_13; / / write back
! x/ t Z/ z9 ~0 t' q* D, R JU S_14; / / write back
5 {8 R3 O% m7 z% v JU S_15; / / write back
; e% `6 A. \2 G0 X& w JU S_16; / / write back
1 y9 D0 D H0 ?2 ?! Q1 x JU S_17; / / write back ! J4 v4 A) J5 X5 x( t
|