13.07.2015 Views

[Instruction] Contents

[Instruction] Contents

[Instruction] Contents

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Advanced Function <strong>Instruction</strong>FUN 25 D PMEANMEAN(Average of the block data)FUN 25 D PMEANOperation controlENLadder symbol25DP.MEANS :ERRN range errorS : Source register numberN : Number of registers to be averaged(N units of successive registers starting from S)N :D :D : Register number for storing result (mean value)The S, N, D may combine with V, Z, P0~P9 toserve indirect address applicationOperandRangeWX WY WM WS TMR CTR HR IR OR SR ROR DR K XRWX0∣WX240WY0∣WY240WM0∣WM1896WS0∣WS984T0∣T255C0∣C255R0∣R3839R3840∣R3903R3904∣R3967R3968∣R4167R5000∣R8071D0∣D4095P0~P9S ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○N ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○D ○ ○ ○ ○ ○ ○ ○ ○* ○* ○ ○2∣256V、Z• When operation control "EN" = 1 or "EN↑" ( P instruction) from 0 to 1, add the N successive 16-bit or 32-bit( D instruction) numerical values starting from S, and then divided by N. Store this mean value (rounding offnumbers after the decimal point) in the register specified by D.• While the N value is derived from the content of the register, if the N value is not between 2 and 256, then theN range error "ERR" will be set to 1, and do not execute the operation.X0EN25P.MEANS : R 0ERR• At left, the example program gets the mean value of the3 successive 16-bit registers starting from R0, and storesthe results into the 16-bit register R10N :3D :R 10S(N=3)R0 123R1 9R2 788 123+9+788 X0= 3=306 (Rouding off the remainder)D R10 3067-4

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!