AH500 Programming Manual Symbol: S : Initial device Word/Double word D : Device in which the mean is stored Word/Double word n : Number of devices Word/Double word Explanation: 1. After the values in the n devices starting from the device specified by S are added up, the mean of the sum is stored in D . 2. If a remainder appears in the calculation, it is left out. 3. The operand n used in the 16-bit instruction should be within the range between 1 and 256, and the operand n used in the 32-bit instruction should be within the range between 1 and 128. 4. Only the 32-bit instructions can use the 32-bit counter. Example:
When X0.0 is ON, the values in the three registers starting from D0 are added up. After the values are added up, the sum is divided by 3. The quotient is stored in D10, and the remainder is left out. (D0+D1+D2)/3 D10 D0 100 D10 After the instruction is executed D1 113 112 D2 125 The quotient 2 is left out. 6-278 API Instruction code Operand Function 1208 D MEAN P S, D, n Mean Device X Y M S T C HC D L SM SR E PR K 16# “$” DF S D n Pulse instruction 16-bit instruction (7 steps) 32-bit instruction(7 steps) AH500 AH500 AH500