SX Users Manual Rev. 3.1
143
© 2000 Scenix Semiconductor, Inc. All rights reserved.
www.scenix.com
Chapter 5
Input/Output Ports
5.1 Introduction
The SX device has a set of Input/Output (I/O) ports. Each port consists of a set of pins on which the
device can read logic signals from other devices, or send logic signals to other devices. Each port pin
can be individually software-configured to operate as an input or as an output, to accept TTL or CMOS
voltage levels, and to use or not use an internal pullup resistor. Some ports allow the selection of
Schmitt-trigger input characteristics.
All SX devices have at least a Port A and a Port B, with at least four pins in Port A and eight pins in
Port B. Some devices also have a Port C, Port D, and/or Port E, with eight pins per port. The ports share
many of the same features, but have some characteristics that vary from port to port:
Port A offers symmetrical drive capability, which means that the same voltage drop occurs across
the external load whether the output pin is sourcing or sinking current. There are either four or
eight pins in this port, depending on the SX device type.
The Port B pins can be software-configured to operate as general-purpose I/O pins, interrupt/
wakeup inputs, or comparator I/O signals. There are eight pins in this port.
The Port C, Port D, and Port E pins are general-purpose I/O pins available in certain devices.
When available, there are eight pins per port. Some of these pins can be software-configured to
operate as special-purpose I/O pins.
5.2
Reading and Writing the Ports
The I/O ports are memory-mapped into the data memory address space. To the CPU, the ports are
available as the RA through RE file registers at data memory addresses 05h through 09h, respectively.
Writing to a port data register sets the voltage levels of the corresponding port pins that have been
configured to operate as outputs. Reading from a register reads the voltage levels of the corresponding
port pins that have been configured as inputs.
For example, in a device that has four Port A pins, suppose that you want to use all four pins as outputs,
and you want RA0 and RA1 to be high, and RA2 and RA3 to be low. You would first configure all
four pins to operate as outputs, and then you would execute code such as the following:
mov
W,#$03
;load W with the value 03h (bits 0 and 1 high)
mov
$05,W
;write 03h to Port A data register