Arithmetic instructions
506
Part III FP Instructions
In this example, the input variable sort_order is declared. However, you can write a constant (e.g.
1 for a descending sorting order) directly at the input contact of the function in the body.
Example
In this example, the same POU header is used for all programming languages. For an example
using IL (instruction list), please refer to the online help.
POU header
All input and output variables used for programming this function have been declared in the POU
header.
Body
The variable sort_order is specified as the value 1. When the variable start is set to TRUE, the
function is carried out. It sorts the elements of the ARRAY data_field in descending order.
LD
ST
sort_order:=1;
IF start THEN
F353_FSORT( s1_Start:= data_field[0],
s2_End:= data_field[4],
s3_Descending:= sort_order);
END_IF;