11
6.7 I/O Refresh Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
6.7.1 RFS, RFSP I/O refresh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .285
6.8 Other Convenient Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .287
6.8.1 UDCNT1 Counter 1-phase input up or down . . . . . . . . . . . . . . . . . . . . . .287
6.8.2 UDCNT2 Counter 2-phase input up or down . . . . . . . . . . . . . . . . . . . . . .289
6.8.3 TTMR Teaching timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .291
6.8.4 STMR Special function timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .292
6.8.5 ROTC Rotary table shortest direction control . . . . . . . . . . . . . . . . . . .294
6.8.6 RAMP Ramp signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .296
6.8.7 SPD Pulse density measurement . . . . . . . . . . . . . . . . . . . . . . . . . . .298
6.8.8 PLSY Fixed cycle pulse output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .300
6.8.9 PWM Pulse width modulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .301
6.8.10 MTR Matrix input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .302
CHAPTER 7 APPLICATION INSTRUCTIONS 305
7.1 Logical operation instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
7.1.1 WAND, WANDP Logical products with 16-bit data . . . . . . . . . . . . . . . . . . . . . . .306
DAND, DANDP Logical products with 32-bit data . . . . . . . . . . . . . . . . . . . . . . .306
7.1.2 BKAND, BKANDP Block logical products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .310
7.1.3 WOR, WORP Logical sums of 16-bit data . . . . . . . . . . . . . . . . . . . . . . . . . . . .312
DOR, DORP Logical sums of 32-bit data . . . . . . . . . . . . . . . . . . . . . . . . . . . .312
7.1.4 BKOR, BKORP Block logical sum operations . . . . . . . . . . . . . . . . . . . . . . . . . .316
7.1.5 WXOR, WXORP 16-bit exclusive OR operations . . . . . . . . . . . . . . . . . . . . . . . . .318
DXOR, DXORP 32-bit exclusive OR operations . . . . . . . . . . . . . . . . . . . . . . . . .318
7.1.6 BKXOR, BKXORP Block exclusive OR operations . . . . . . . . . . . . . . . . . . . . . . . . .322
7.1.7 WXNR, WXNRP 16-bit data exclusive NOR operations . . . . . . . . . . . . . . . . . . .324
DXNR, DXNRP 32-bit data exclusive NOR operations . . . . . . . . . . . . . . . . . . .324
7.1.8 BKXNR, BKXNRP Block exclusive NOR operations . . . . . . . . . . . . . . . . . . . . . . .328
7.2 Rotation instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330
7.2.1 ROR, RORP, RCR, RCRPRight rotation of 16-bit data . . . . . . . . . . . . . . . . . . . . . . . . . . .330
7.2.2 ROL, ROLP, RCL, RCLP Left rotation of 16-bit data . . . . . . . . . . . . . . . . . . . . . . . . . . . . .333
7.2.3 DROR, DRORP, DRCR, Right rotation of 32-bit data . . . . . . . . . . . . . . . . . . . . . . . . . . .335
DRCRP
7.2.4 DROL, DROLP, DRCL, Left rotation of 32-bit data . . . . . . . . . . . . . . . . . . . . . . . . . . . . .337
DRCLP
7.3 Shift instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
7.3.1 SFR, SFRP n-bit shift to right of 16-bit data . . . . . . . . . . . . . . . . . . . . . . . . .339
SFL, SFLP n-bit shift to left of 16-bit data . . . . . . . . . . . . . . . . . . . . . . . . . .339
7.3.2 BSFR, BSFRP 1-bit shift to right of n-bit data . . . . . . . . . . . . . . . . . . . . . . . . . .341
BSFL, BSFLP 1-bit shift to left of n-bit data . . . . . . . . . . . . . . . . . . . . . . . . . . .341
7.3.3 SFTBR, SFTBRP n-bit shift to right of n-bit data . . . . . . . . . . . . . . . . . . . . . . . . . .343
SFTBL, SFTBLP n-bit shift to left of n-bit data . . . . . . . . . . . . . . . . . . . . . . . . . . .343
7.3.4 DSFR, DSFRP 1-word shift to right of n-word data . . . . . . . . . . . . . . . . . . . . . .345
DSFL, DSFLP 1-word shift to left of n-word data . . . . . . . . . . . . . . . . . . . . . . .345
7.3.5 SFTWR, SFTWRP n-word shift to right of n-word data . . . . . . . . . . . . . . . . . . . . . .346
SFTWL, SFTWLP n-word shift to left of n-word data . . . . . . . . . . . . . . . . . . . . . . .346