Arithmetic instructions
466
Part III FP Instructions
POU header
All input and output variables used for programming this function have been declared in the POU
header.
Body
When the variable start is set to TRUE, the function is carried out. The function calculates the sum
of all elements of ARRAY data_field (sum = 2 + 3 + 222222 + (-333333) + 1 = -111105) and
transfers the result to the variable sum. In addition, the function calculates the mean (mean =
sum/5 = -111105/5 = -22221) and transfers the result to the variable mean.
LD
ST
IF start THEN
F276_DMEAN( s1_Start:= data_field[0],
s2_End:= data_field[4],
Sum=> sum,
Mean=> mean);
END_IF;