© 2000 Scenix Semiconductor, Inc. All rights reserved. 147 SX User’s Manual Rev. 3.1 www.scenix.com Chapter 5 Input/Output Ports To modify the contents of the MODE register, you can move the desired value into W and then from
W to the MODE register. However, if you only want to modify the lower four bits of the MODE
register, you can use the “mov M,#lit” instruction, which takes just one clock cycle and preserves the
contents of W.
5.3.3 Port Configuration Example The following code example shows how to program the pullup control registers. mov W,#$1E ;MODE=1Eh to access port pullup registers mov M,W ;write 1Eh to MODE register mov W,#$03 ;W = 0000 0011 mov !RA,W ;disable pullups for A0 and A1 mov W,#$FF ;W = 1111 1111 mov !RB,W ;disable all pullups for B0-B7 mov W,#$00 ;W = 0000 0000 mov !RC,W ;enable all pullups for C0-C7 First you load the MODE register with 1Eh to select access to the pullup control registers (PLP_A,
PLP_B, and PLP_C). Then you use the “mov !rx,W” instructions to specify which port pins are to be
connected  to  the  internal  pullup  resistors.  Setting  a  bit  to  1  disconnects  the  corresponding  pullup
resistor, and clearing a bit to 0 connects the corresponding pullup resistor.
5.3.4 Port Configuration Registers The port configuration registers controlled by the “mov !rx,W” instruction operate as described below. RA through RE Data Direction Registers (MODE=1Fh) Each register bit sets the data direction for one port pin. Set the bit to 1 to make the pin operate as a
high-impedance input. Clear the bit to 0 to make the pin operate as an output. The bit is set to 1 after
all resets.
19h Exchange WKPND_B 1Ah Write WKED_B 1Bh Write WKEN_B 1Ch Write ST_B Write ST_C Write ST_D Write ST_E 1Dh Write LVL_A Write LVL_B Write LVL_C Write LVL_D Write LVL_E 1Eh Write PLP_A Write PLP_B Write PLP_C Write PLP_D Write PLP_E 1Fh Write RA
Direction
Write RB
Direction
Write RC
Direction
Write RD
Direction
Write RE
Direction
Table 5-2  MODE Register Settings for SX48/52BD  (Sheet 2 of 2) MODE Reg. mov !RA,W mov !RB,W mov !RC,W mov !RD,W mov !RE,W