13.07.2015 Views

[Instruction] Contents

[Instruction] Contents

[Instruction] Contents

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Advanced Function <strong>Instruction</strong>FUN 58 PENCODENCODEFUN 58 PENCODS : Starting register to be encodedN S : Bit position within S as the encoding startpointN L : Number of encoding discrete points (2~256)D : Number of register storing encoding results(1 word)S, N S, N L, D may combine with V, Z, P0~P9 toserve indirect address applicationRangeWX WY WM WS TMR CTR HR IR OR SR ROR DR K XROperandWX0∣WX240WY0∣WY240WM0∣WM1896WS0∣WS984T0∣T255C0∣C255R0∣R3839R3840∣R3903R3904∣R3967R3968∣R4167R5000∣R8071D0∣D409516-bit+/-numberS ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○N S ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ 0~15 ○N L ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ 2~256 ○D ○ ○ ○ ○ ○ ○ ○ ○* ○* ○ ○V、ZP0~P9●When encode control "EN" = 1 or "EN↑" ( P instruction) has a transition from 0 to 1, will starting from thepoints specified by Ns within S, take out towards the left (high position direction) N L number of successive bitsBN S~BN S+N L−1 (BN S is called the encoding start point, and its relative bit number is b0;BN S+N L−1 is calledthe encoding end point, and its relative bit number is BN L-1). From left to right do higher priority (when H/L=1)encoding or from right to left do lower priority (when H/L=0) encoding (i.e. seek the first bit with the value of 1,and the relative bit number of this point will be stored into the low byte (B0~B7) of encoded resultant registerD, and the high byte of D will be filled with 0.(bN L−1) (b H) (b L) (b 0)← Relative bit numberBN S+N L−1BN S↓ B15 ↓ B1 B0← …Direction of extension… 0 0 0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1SHigh Total N L discrete points LowHigh priority search direction Low priority search directionD 00000000 H or L●As shown in the diagram above, for high priority encoding, the bit first to find is b H (with a value of 12), and forlow priority encoding, the bit first to find b L (with a value of 4). Among the N L discrete points there must be atleast one bit with value of 1. If all bits are 0, will not to carry out this instruction, and the all zero flag "D=0" willset to 1.●Because S is a 16-bit register, Ns can be 0~15, and is used to assign a point of B0~B15 within S as theencoding start point (b0). The value of N L can be 2~256, and it is used to identify the encoding end point, i.e. itassigns N L successive single points starting from the start point (b0) towards the left (high position direction)as the encoding zone (i.e. b0~bN L−1). If the value of Ns or NL exceeds the above value, then do not carry outthis instruction, and set the range-error flag "ERR" as 1.7-35

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

Saved successfully!

Ooh no, something went wrong!