Parallel i/o, Port 0, Port 2 – Maxim Integrated Ultra-High-Speed Flash Microcontroller User Manual

Page 115: Parallel i/o -2, Port 0 -2, Port 2 -2

Advertising
background image

10-2

Ultra-High-Speed Flash

Microcontroller User’s Guide

SECTION 10: I/O PORTS

The ultra-high-speed flash microcontroller provides 8-bit I/O ports. Each port appears as a special function register that can be

addressed as a byte or 8 individual bit locations. In general, the register and the port pin have identical values, and reading or writing

a port is the same as reading or writing the SFR for the port. The basic I/O driver function and its electrical characteristics are similar

to the drivers used in the DS87C520, with respect to individual port and pin conditions.

Port 0 and port 2 can serve either as general-purpose parallel I/O ports or as the expanded memory bus. Ports 1 and 3 can be used

as general-purpose parallel I/O ports with optional special functions associated with each pin. Enabling the special function for a pin

automatically converts the I/O pin to that function. An optional function of a pin can be turned on and off dynamically to suit the appli-

cation. Using one or more I/O pins of a port as special functions does not affect the remaining port pins. It should be noted that port

0 drivers are open-drain and require external pullups when used as general-purpose I/O ports.

Parallel I/O

Each I/O port can be used as a general-purpose, bidirectional parallel I/O port. Data written to the port latch serves to set both the

level and the direction of the data on the pin. The output of the port pin is established by writing to the associated port pin latch. When

logic 0 is written to the port for output, the port is pulled to ground. When logic 1 is written to ports 1, 2, or 3, a strong driver momen-

tarily drives the pin from 0 to 1, and then a weak pullup maintains the 1. A logic 1 written to port 0 causes those pins to go tri-state,

functioning as open-drain outputs. A logic 1 in the port latch also configures the port pin to the input state. Since the pin is either weak-

ly pulled up or in three-state, the pin is the same as the driven logic state. The logic state of the pin itself does not alter the logic value

of the port latch.

Port 0

This is an open drain, 8-bit, bidirectional, general-purpose I/O port. A reset condition or logic 1, written to the latches of this port, three-

state the port pins. This condition also serves as an input mode. When used as an I/O port, external pullups are required. As an alter-

nate function, this port can be used as part of the multiplexed address/data bus to access external memory. Both nonpage and page

mode are supported. During the original 8051 expanded bus configuration (nonpage mode), when ALE is high, the LSB of the address

is presented to P0. When ALE is low, the port transitions to a bidirectional data bus. When used in page mode 1, P0 is used as the pri-

mary data bus only. When used in page mode 2, P0 is used for the LSB of the address only.

The use of port 0 as general-purpose I/O is not recommended if the device is used to access external memory. In this case, the state

of the pins are disturbed during the memory access. In addition, the pullups required to maintain a high state during the use as gen-

eral-purpose I/O interfere with the complementary drivers employed when the device operates as an expanded memory bus.

When port 0 is used as an address bus, the AD0-7 pins provide true drive capability for logic levels 1 and 0. No external pullups are

required. In fact, external pullups degrade the memory interface timing. A two-state system is used on AD0-7. This allows the pin to

be driven hard for a period of time, allowing the greatest possible setup or access time. The pin states are then held in a weak latch

until forced to the next state or overwritten by an external device. This assures a smooth transition between logic states and also allows

a longer hold time.

Port 2

Port 2 is an 8-bit bidirectional I/O port. The reset condition sets the port pins to logic 1. In this state, a weak pullup holds the port pin

high. This condition also serves as an input mode, since any external circuit that writes to the port overcomes the weak pullup. Writing

a logic 0 to the port pin activates a strong pulldown that remains on until a 1 is written or a reset occurs. Writing a logic 1 after the port

has been at 0 causes a strong transition driver to turn on, followed by a weaker sustaining pullup. Once the momentary strong driver

turns off, the pin assumes both the output high and input state. As an alternate function, port 2 can function as the MSB of the address

bus for external memory access during nonpage mode. When used in page mode 1, P2 is used for both LSB and MSB of external

address. When used in page mode 2, P2 is used for the MSB of external address and data.

Maxim Integrated

Advertising