1304
11 PROCESS CONTROL INSTRUCTIONS
11.3 Control Operation Instructions
■Input data
■Block memory
This instruction outputs an intermediate value between the maximum and minimum values among input values E1 to En.
■Middle value selector processing
An intermediate value among input values E1 to En is stored in the output value (BW).
In addition, the BB output selection (BB1 to BB16) corresponding to the intermediate value is set to 1.
The correspondence between input values 1 (E1) to 16 (E16) and BB output selections (BB1 to BB16) is shown below.
• When the number of inputs is an even number, the smaller value among the intermediate values is stored.
• When two or more intermediate values exist, the bits corresponding to the intermediate values are all set to 1.
■Remarks
Intermediate values are selected as follows:
• Input values 1 (E1) to n (En) are sorted in ascending order. (When there are same input values, they are sorted in
ascending order of their input numbers.)
• The intermediate value in the sorted values is selected.
When the input data are 2, 5, 1, 4, and 3, operations are performed as shown below.
In this example, 3 is the intermediate value and accordingly the output select (BB5) is set to 1.
Operand: (s1)
Device Symbol Name Recommended range Data type Standard
value
Set by
+0 n Number of
inputs
1 to 16 16-bit unsigned
binary
User
+1
+2
E1 Input value 1 -999999 to 999999 Single-precision
real number
User
+3
+4
E2 Input value 2
+2n-1
+2n
En Input value n
Operand: (d1)
Device Symbol Name Recommended range Data type Standard
value
Set by
+0
+1
BW Output value Intermediate value between maximum and minimum values Single-precision
real number
System
+2 BB BB1
to
BB1
6
Output selection
0: Corresponding input value is not the intermediate value.
1: Corresponding input value is the intermediate value.
16-bit unsigned
binary
System
Input value E16 E15 E14 to E2 E1
Bit to be set to 1 at an intermediate value BB16 BB15 BB14 to BB2 BB1
(1) Input data
(2) Rearrangement
(3) Rearranged data
b15 b2b3b4b5b6b7b8b9b10b11b12b13b14 b1 b0
BB3
BB4
BB5
BB6
BB7
BB8
BB9
BB10
BB11
BB12
BB13
BB14
BB15
BB16
BB2
BB1
E1 E2 E3 E4 E5 E3 E1 E5 E4 E2
2 5 1 4 3 1 2 3 4 5
(1)
(2)
(3)