sx20ac Parallax, Inc., sx20ac Datasheet - Page 11

no-image

sx20ac

Manufacturer Part Number
sx20ac
Description
Configurable Communications Controllers With Ee/flash Program Memory, In-system Programming Capability And On-chip Debug
Manufacturer
Parallax, Inc.
Datasheet

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
sx20ac/SS
Manufacturer:
EUDYNA
Quantity:
12
Part Number:
sx20ac/SS
Manufacturer:
UBICOM
Quantity:
20 000
Part Number:
sx20ac/SS-G
Manufacturer:
IR
Quantity:
31 400
Parallax SX20AC/SX28AC
3.1.1.
Caution must be exercised when performing two
successive read-modify-write instructions (SETB or
CLRB operations) on an I/O port pin. Input data used for
an instruction must be valid during the time the
instruction is executed, and the output result from an
instruction is valid only after that instruction completes its
operation. Unexpected results from successive read-
modify-write operations on I/O pins can occur when the
device is running at high speeds. Although the device has
an internal write-back section to prevent such conditions,
it is still recommended that the user program include a
NOP instruction as a buffer between successive read-
modify-write instructions performed on I/O pins of the
same port.
Also note that reading an I/O port is actually reading the
pins, not the output data latches. That is, if the pin output
driver is enabled and driven high while the pin is held low
externally, the port pin will read low.
3.2.
Each port pin offers the following configuration options:
Port B offers the additional option to use the port pins for
the Multi-Input Wakeup/Interrupt function and/or the
analog comparator function.
Port configuration is performed by writing to a set of
control registers associated with the port. A special-
purpose instruction is used to write these control registers:
Each one of these instructions writes a port control
register for Port A, Port B, or Port C. There are multiple
control registers for each port. To specify which one you
want to access, you use another register called the MODE
register.
3.2.1.
The MODE register controls access to the port
configuration registers. Because the MODE register is not
memory-mapped, it is accessed by the following special
purpose instructions:
The value contained in the MODE register determines
which port control register is accessed by the
© Parallax Inc.
• data direction
• input voltage levels (TTL or CMOS)
• pullup type (pullup resistor enable or disable)
• Schmitt trigger input (for Port B and Port C only)
• mov !RA,W (move W to Port A control register)
• mov !RB,W (move W to Port B control register)
• mov !RC,W (move W to Port C control register)
• mov M, #lit (move literal to MODE register)
• mov M,W (move W to MODE register)
• mov W,M (move MODE register to W)
Read-Modify-Write Considerations
Port Configuration
MODE Register
Page 11 of 51
“mov !rx,W” instruction as indicated in Table 2-1. MODE
register values not listed in the table are reserved for
future expansion and should not be used. Therefore, the
MODE register should always contain a value from 08h
to 0Fh. Upon reset, the MODE register is initialized to
0Fh, which enables access to the port direction registers.
After a value is written to the MODE register, that setting
remains in effect until it is changed by writing to the
MODE register again. For example, you can write the
value 0Eh to the MODE register just once, and then write
to each of the three pullup configuration registers using
the three “mov !rx,W” instructions.
The following code example shows how to program the
pullup control registers.
mov M,#$0E
mov W,#$03
mov !RA,W
mov W,#$FF
mov !RB,W
mov W,#$00
mov !RC,W
First the MODE register is loaded with 0Eh to select
access to the pullup control registers (PLP_A, PLP_B,
and PLP_C). Then the “mov !rx,W” instructions are used
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.
3.2.2.
The port configuration registers that you control with the
“mov !rx,W” instruction operate as described below.
RA, RB, and RC Data Direction Registers (MODE=0Fh)
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.
MODE Reg.
0Ch
0Dh
08h
09h
0Ah
0Bh
0Eh
0Fh
Port Configuration Registers
Table 3-2:
Port Control Register Access
RA Direction
Mov !RA,W
;MODE=0Eh to access port pullup
;registers
;W = 0000 0011
;disable pullups for RA0 and RA1
;W = 1111 1111
;disable all pullups for RB0-RB7
;W = 0000 0000
;enable all pullups for RC0-RC7
not used
not used
not used
not used
not used
LVL_A
PLP_A
MODE Register and
Mov !RB, W
RB Direction
WKPND_B
WKEN_B
WKED_b
CMP_B
PLP_B
LVL_B
ST_B
Rev 1.6 11/20/2006
www.parallax.com
Mov !Rc, W
RC Direction
not used
not used
not used
not used
PLP_C
LVL_C
ST_C

Related parts for sx20ac