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>FUN108 D PT_SHFTABLE SHIFTFUN108 D PT_SHFOperandRangeIW : Data to fill the room after shift operation, can be aconstant or a registerTs : Source tableTd : Destination table storing shift resultsL: Lengths of tables Ts and TdOW : Register to accept the shifted out dataTs, Td may combine with V, Z, P0~P9 to serve indirectaddress applicationWX WY WM WS TMR CTR HR IR OR SR ROR DR K XRWX0∣WX240WY0∣WY240WM0∣WM1896WS0∣WS984T0∣T255C0∣C255R0∣R3839R3840∣R3903R3904∣R3967R3968∣R4167R5000∣R8071D0∣D409516/32-bit+/-numberIW ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○Ts ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○Td ○ ○ ○ ○ ○ ○ ○ ○* ○* ○ ○L ○ ○* ○ 2~256OW ○ ○ ○ ○ ○ ○ ○ ○* ○* ○V、ZP0~P0• When shift control "EN" = 1 or "EN↑" ( P instruction) has a transition from 0 to 1, all the data from table Ts willbe taken out and shifted one position to the left (when "L/R" = 1) or to the right (when "L/R" = 0). The roomcreated by the shift operation will be filled by IW and the results will be written into table Td. The data shiftedout will be written into OW.X0X1ENL/R108P.T_SHFIW :TS :Td :L :OW :R 10R 0R 010R 11• In the program at left, Ts and Td is the same table.Therefore, the table shifts itself and then writes back toitself (the table must be writ able). It first perform a shift leftoperation (let X1 = 1, and X0 go from 0→1) then perform ashift to right operation (let X1 = 0, and makes X0 go from 0→1). The result are shown at right in the diagram below.Ts(Td) (Shift left) (Shift right)Td(Ts)Td(Ts)R0 0000 R0 1234 R0 0000(Shift left) R1 1111 R1 0000 R1 1111R2 2222 R2 1111 R2 2222R3 3333 OW R3 2222 R3 3333R10 1234 R4 4444 R11 ×××× R4 3333 R4 4444R5 5555 R5 4444 R5 5555R6 6666 R6 5555 R6 6666R7 7777 R7 6666 R7 7777R8 8888 R8 7777 R8 8888R9 9 9 9 9 (Shift left) R9 8888 R9 1234OWOWDotted line is the path for shift right R11 9999 R11 1234Before execution First time Second time7-92

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

Saved successfully!

Ooh no, something went wrong!