Arithmetic instructions
464
Part III FP Instructions
Body
When the variable output is set to TRUE, the function F275_MEAN is carried out. The function
calculates the sum of all elements of the data table (sum = 4 + 3 + 8 + (-2) + 1 + (-6) = 8) and
writes the result (in this case 8) to the variable sum. Additionally, the function calculates the
arithmetic mean of all elements of the data table (mean = sum/6 = (4 + 3 + 8 + (-2) + 1 + (-6)) / 6 =
1.333) and writes the roanded-off number (in this case 1) to the variable mean.
LD
ST
IF start THEN
F275_MEAN( s1_Start:= data_field[0],
s2_End:= data_field[4],
Sum=> sum,
Mean=> mean);
END_IF;