© 2000 Scenix Semiconductor, Inc. All rights reserved. 91 SX User’s Manual Rev. 3.1 www.scenix.com Chapter 3 Instruction Set 3.6.22    MOV !rx,W Move Data Between W and Control Register Operation: rx = W (move W to rx) or
W = rx (move rx to W) or
rx <=> W (exchange W and rx)
Bits affected: none Opcode: 0000 0000 ffff Description: This instruction moves data between W and one of the port control registers (rx).
The port control register is specified in the instruction mnemonic as !RA, !RB, !RC,
!RD, or !RE. This corresponds to a 4-bit field in the opcode that is set to 5, 6, 7, 8
or 9 to access a port control register for Port A, B, C, D, or E, respectively.
To access the port data register rather than a port control register, use the “MOV
fr,W” or similar instruction, addressing the port as “fr” rather than “!rx”.
Each port has a set of control registers: one each for setting the data direction, the
pullup  configuration,  the  Schmitt  trigger  configuration,  and  so  on.  The  MODE
register setting determines the port control register accessed by the “MOV !rx,W”
instruction, as well as the type of access (read, write, or exchange).
For information on the specific MODE register values to use for accessing the port
control registers, see Section 5.3.2.
Cycles: 1 Example 1: mov W,#$1F ;1Fh to select data direction mov M,W ;write 1Fh to MODE register mov W,#$3F ;pins 0-5 Hi-Z inputs, pins 6-7 outputs mov !RB,W ;configure Port B pin data directions mov W,#$FF ;all pins Hi-Z inputs mov !RC,W ;configure Port C pin data directions This example configures the data direction for each pin of Port B and Port C. The
first two instructions program the MODE register to allow access to the port data
direction registers. The third instruction loads W with the value 3Fh. The fourth
instruction writes this value to the RB direction register, which configures pins 0
through  5  to  operate  as  high-impedance  inputs  and  pins  6  and  7  to  operate  as outputs. The last two instructions configure all Port C pins to operate as inputs.