[Instruction] Contents

[Instruction] Contents [Instruction] Contents

servotechnica.ru
from servotechnica.ru More from this publisher
13.07.2015 Views

Advanced Function InstructionFUN109 D PT_ROTTABLE ROTATEFUN109 D PT_ROTRotate controlLeft/Right directionENL/RLadder symbol109DP.T_ROTTs :Td :L :Ts : Source table for rotateTd : Destination table storing results of rotationL : Lengths of tableTs, Td may combine with V, Z, P0~P9 to serve indirectaddress 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~P9Ts ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○Td ○ ○ ○ ○ ○ ○ ○ ○* ○* ○ ○L ○ ○* ○ ○2∣256V、Z• When rotation control "EN" = 1 or "EN↑" ( P instruction) has a transition from 0 to 1, the data from the table ofTs will be rotated 1 position to the left (when "L/R" = 1)or 1 position to the right (when "L/R" = 0). The results ofthe rotation will then be written onto table Td.X0X1EN TS :Td :L/R L :109P.T_ROTR 0R 010• In the program at left, Ts and Td is the same table. Thetable after rotation will write back to itself. It first performone left rotation (let X1 = 1, and X0 go from 0→1), andthen performs one right rotation (let X1 = 0, and X0 gofrom 0→1). The results are shown at right in the diagrambelow.Rotate left Rotate right (Rotate left) (Rotate right)Ts(Td)Td(Ts)Td(Ts)R0 0 0 0 0 (right) R0 9999 R0 0000R1 1111 R1 0000 R1 1111R2 2222 R2 1111 R2 2222R3 3333 R3 2222 R3 3333R4 4444 R4 3333 R4 4444R5 5555 R5 4444 R5 5555R6 6666 R6 5555 R6 6666R7 7777 R7 6666 R7 7777R8 8888 R8 7777 R8 8888R9 9999 (left) R9 8888 R9 9999Before execution First time Second time7-93

Advanced Function InstructionFUN110 D PQUEUEQUEUEFUN110 D PQUEUEExecution controlENLadder symbol110DP.QUEUEIW :QU :In/Out control I/O L :OperandRangePr :OW :EPTFULERRQueue emptyQueuePointer errorIW : Data pushed into queue, can be a constantor a registerQU : Starting register of queueL : Size of queuePr : Pointer registerOW : Register accepting data popped outfrom queueQU may combine with V, Z, P0~P9 to serveindirect address 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 ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○QU ○ ○ ○ ○ ○ ○ ○ ○ ○* ○ ○L ○ ○* ○ 2~256Pr ○ ○ ○ ○ ○ ○ ○ ○* ○* ○OW ○ ○ ○ ○ ○ ○ ○ ○* ○* ○V、ZP0~P9• Queue is also a kind of table. It is different from ordinary table in that its queue register numbers go from 1 to Land not from 0 to L-1. In other words QU 1~QU L respectively correspond to pointers Pr = 1 to L, and Pr = 0 isused to show that the queue is empty.• Queue is a first in first out (FIFO) device, i.e. - the data that first pushed into the queue will be the first to popout from the queue. A queue is comprised of L consecutive 16 or 32 bit registers ( D instruction) starting fromthe QU register, as in the diagram below:IW5555push(I/O=1)1.IW always push intoQU12.Pr+1→Pr ~ is the sequence number ofoperation QULPr4QUQU1 4444QU2 3333 PushQU3 2222 downQU4 1111OWQU5 ××××… …Pop out(I/O=0)2. QUpr →OW3. Pr-1→Pr• When execution control "EN" = 1 or "EN↑" ( P instruction) has a transition from 0 to 1, the status of in/outcontrol "I/O" determines whether the IW data will be pushed into the queue (when "I/O" = 1) or be popped outand transferred to OW (when "I/O" = 0). As shown in the diagram above, the IW data will always be pushedinto the first (QU1) register of the queue. After it has been pushed in, Pr will immediately be increased by 1, sothat the pointer can always point to the first data that was pushed into the queue. When it is popped out, thedata pointed by Pr will be transferred directly to OW. Pr will be reduced by 1, so that it still point to the first dataremained in the queue.7-94

Advanced Function <strong>Instruction</strong>FUN109 D PT_ROTTABLE ROTATEFUN109 D PT_ROTRotate controlLeft/Right directionENL/RLadder symbol109DP.T_ROTTs :Td :L :Ts : Source table for rotateTd : Destination table storing results of rotationL : Lengths of tableTs, Td may combine with V, Z, P0~P9 to serve indirectaddress 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~P9Ts ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○Td ○ ○ ○ ○ ○ ○ ○ ○* ○* ○ ○L ○ ○* ○ ○2∣256V、Z• When rotation control "EN" = 1 or "EN↑" ( P instruction) has a transition from 0 to 1, the data from the table ofTs will be rotated 1 position to the left (when "L/R" = 1)or 1 position to the right (when "L/R" = 0). The results ofthe rotation will then be written onto table Td.X0X1EN TS :Td :L/R L :109P.T_ROTR 0R 010• In the program at left, Ts and Td is the same table. Thetable after rotation will write back to itself. It first performone left rotation (let X1 = 1, and X0 go from 0→1), andthen performs one right rotation (let X1 = 0, and X0 gofrom 0→1). The results are shown at right in the diagrambelow.Rotate left Rotate right (Rotate left) (Rotate right)Ts(Td)Td(Ts)Td(Ts)R0 0 0 0 0 (right) R0 9999 R0 0000R1 1111 R1 0000 R1 1111R2 2222 R2 1111 R2 2222R3 3333 R3 2222 R3 3333R4 4444 R4 3333 R4 4444R5 5555 R5 4444 R5 5555R6 6666 R6 5555 R6 6666R7 7777 R7 6666 R7 7777R8 8888 R8 7777 R8 8888R9 9999 (left) R9 8888 R9 9999Before execution First time Second time7-93

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

Saved successfully!

Ooh no, something went wrong!