[Instruction] Contents
[Instruction] Contents [Instruction] Contents
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
- Page 150 and 151: Advanced Function InstructionFUN 63
- Page 152 and 153: Advanced Function InstructionFUN 64
- Page 154 and 155: Advanced Function InstructionEND PR
- Page 156 and 157: Advanced Function InstructionFUN 66
- Page 158 and 159: Advanced Function InstructionFUN 68
- Page 160 and 161: Advanced Function InstructionFUN 70
- Page 162 and 163: Advanced Function InstructionFUN 74
- Page 164 and 165: Advanced Function InstructionFUN 76
- Page 166 and 167: Advanced Function InstructionFUN 78
- Page 168 and 169: Advanced Function InstructionFUN 79
- Page 170 and 171: Advanced Function InstructionFUN 81
- Page 172 and 173: Advanced Function InstructionFUN 82
- Page 174 and 175: Advanced Function InstructionFUN 84
- Page 176 and 177: Advanced Function InstructionFUN 86
- Page 178 and 179: Advanced Function InstructionFUN 86
- Page 180 and 181: Advanced Function InstructionFUN89/
- Page 182 and 183: Advanced Function InstructionFUN 90
- Page 184 and 185: Advanced Function InstructionFUN 92
- Page 186 and 187: Advanced Function InstructionFUN 94
- Page 188 and 189: Advanced Function InstructionFUN 95
- Page 190 and 191: Advanced Function InstructionTable
- Page 192 and 193: Advanced Function InstructionFUN101
- Page 194 and 195: Advanced Function InstructionFUN103
- Page 196 and 197: Advanced Function InstructionFUN105
- Page 198 and 199: Advanced Function InstructionFUN107
- Page 202 and 203: Advanced Function InstructionFUN110
- Page 204 and 205: Advanced Function InstructionFUN111
- Page 206 and 207: Advanced Function InstructionFUN112
- Page 208 and 209: Advanced Function InstructionFUN114
- Page 210 and 211: Advanced Function InstructionFUN120
- Page 212 and 213: Advanced Function InstructionFUN122
- Page 214 and 215: Advanced Function InstructionFUN124
- Page 216 and 217: Advanced Function InstructionFUN126
- Page 218 and 219: Advanced Function InstructionFUN128
- Page 220 and 221: Advanced Function InstructionFUN130
- Page 222 and 223: Advanced Function InstructionFUN 13
- Page 224 and 225: Advanced Function InstructionFUN141
- Page 226 and 227: Advanced Function InstructionFUN143
- Page 228 and 229: Advanced Function InstructionFUN146
- Page 230 and 231: Advanced Function InstructionFUN 15
- Page 232 and 233: Advanced Function InstructionFUN160
- Page 234 and 235: Advanced Function InstructionFUN201
- Page 236 and 237: Advanced Function InstructionFUN 20
- Page 238 and 239: Advanced Function InstructionFUN 20
- Page 240 and 241: Advanced Function InstructionFUN 20
- Page 242 and 243: Advance Function InstructionFUN 208
- Page 244 and 245: Advanced Function InstructionFUN 21
- Page 246 and 247: Advanced Function InstructionFUN 21
- Page 248 and 249: MEMO
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