Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
8XC196Kx,8XC196Jx,87C196CA microcontroller family user's manual.1995.pdf
Скачиваний:
73
Добавлен:
23.08.2013
Размер:
4 Мб
Скачать
☆

8XC196Kx, Jx, CA USER’S MANUAL

6.3BIDIRECTIONAL PORTS 1, 2, 5, AND 6

Although the bidirectional ports are very similar in both circuitry and configuration, port 5 differs from the others in some ways. Port 5, a memory-mapped port, uses a standard CMOS input buffer because of the high speeds required for system control functions. The remaining bidirectional ports use Schmitt-triggered input buffers for improved noise immunity.

NOTE

Ports 3 and 4 are significantly different from the other bidirectional ports. See “Bidirectional Ports 3 and 4 (Address/Data Bus)” on page 6-15 for details on the structure and operation of these ports.

Table 6-4 lists the bidirectional port pins with their special-function signals and associated peripherals.

Table 6-4. Bidirectional Port Pins

Port Pin

Special-function

Special-function

Associated

Signal(s)

Signal Type

Peripheral

 

 

 

 

 

P1.0

EPA0

I/O

EPA

T2CLK

I

Timer 2

 

P1.1

EPA1

I/O

EPA

P1.2

EPA2

I/O

EPA

T2DIR

I

Timer 2

 

P1.3

EPA3

I/O

EPA

P1.4†

EPA4

I/O

EPA

P1.5†

EPA5

I/O

EPA

P1.6†

EPA6

I/O

EPA

P1.7†

EPA7

I/O

EPA

P2.0

TXD

O

SIO

P2.1

RXD

I/O

SIO

P2.2

EXTINT

I

Interrupts

P2.3†

BREQ#

O

Bus controller

P2.4

INTOUT#

O

Interrupts

P2.5†

HOLD#

I

Bus controller

P2.6

HLDA#

O

Bus controller

P2.7

CLKOUT

O

Clock generator

P5.0

ALE/ADV#

O

Bus controller

SLPALE

I

Slave port

 

† This pin is not implemented on 8XC196Jx and 87C196CA devices.

†† This pin is not implemented on 8XC196Jx devices.

††† P5.4/SLPINT is not implemented on 8XC196Jx devices. P5.4 is implemented on the 87C196CA as a low-speed input/output pin (but it is not multiplexed with SLPINT).

6-4

I/O PORTS

Table 6-4. Bidirectional Port Pins (Continued)

Port Pin

Special-function

Special-function

Associated

Signal(s)

Signal Type

Peripheral

 

 

 

 

 

P5.1†

INST

O

Bus controller

SLPCS#

I

Slave port

 

P5.2

WR#/WRL#

O

Bus controller

SLPWR#

I

Slave port

 

P5.3

RD#

O

Bus controller

SLPRD#

I

Slave port

 

P5.4†††

SLPINT†††

O

Slave port

P5.5††

BHE#/WRH#

O

Bus controller

P5.6††

READY

I

Bus controller

P5.7††

BUSWIDTH

I

Bus controller

P6.0

EPA8

I/O

EPA

P6.1

EPA9

I/O

EPA

P6.2†

T1CLK

I

Timer 1

P6.3†

T1DIR

I

Timer 1

P6.4

SC0

I/O

SSIO0

P6.5

SD0

I/O

SSIO0

P6.6

SC1

I/O

SSIO1

P6.7

SD1

I/O

SSIO1

† This pin is not implemented on 8XC196Jx and 87C196CA devices.

†† This pin is not implemented on 8XC196Jx devices.

††† P5.4/SLPINT is not implemented on 8XC196Jx devices. P5.4 is implemented on the 87C196CA as a low-speed input/output pin (but it is not multiplexed with SLPINT).

Table 6-5 lists the registers associated with the bidirectional ports. Each port has three control registers (Px_MODE, Px_DIR, and Px_REG); they can be both read and written. The Px_PIN register is a status register that returns the logic level present on the pins; it can only be read. The registers for the standard ports are byte-addressable and can be windowed. The port 5 registers must be accessed using 16-bit addressing and cannot be windowed. “Bidirectional Port Considerations” on page 6-12 discusses special considerations for reading P2_REG.7 and P6_REG.7:4.

Table 6-5. Bidirectional Port Control and Status Registers

Mnemonic

Address

 

Description

 

 

 

P1_DIR

1FD2H

Port x Direction

P2_DIR

1FCBH

Each bit of Px_DIR controls the direction of the corresponding pin.

P5_DIR

1FF3H

0

=complementary output (output only)

P6_DIR

1FD3H

1

=input or open-drain output (input, output, or bidirectional)

 

 

 

 

 

Open-drain outputs require external pull-ups.

 

 

 

 

6-5

8XC196Kx, Jx, CA USER’S MANUAL

Table 6-5. Bidirectional Port Control and Status Registers (Continued)

Mnemonic

Address

Description

 

 

 

P1_MODE

1FD0H

Port x Mode

P2_MODE

1FC9H

Each bit of Px_MODE controls whether the corresponding pin

P5_MODE

1FF1H

functions as a standard I/O port pin or as a special-function signal.

P6_MODE

1FD1H

0 = standard I/O port pin

 

 

 

 

1 = special-function signal

 

 

 

P1_PIN

1FD6H

Port x Input

P2_PIN

1FCFH

Each bit of Px_PIN reflects the current state of the corresponding

P5_PIN

1FF7H

pin, regardless of the pin configuration.

P6_PIN

1FD7H

 

 

 

 

P1_REG

1FD4H

Port x Data Output

P2_REG

1FCDH

For an input, set the corresponding Px_REG bit.

P5_REG

1FF5H

For an output, write the data to be driven out by each pin to the

P6_REG

1FD5H

corresponding bit of Px_REG. When a pin is configured as standard

 

 

 

 

I/O (Px_MODE.x=0), the result of a CPU write to Px_REG is

 

 

immediately visible on the pin. When a pin is configured as a

 

 

special-function signal (Px_MODE.x=1), the associated on-chip

 

 

peripheral or off-chip component controls the pin. The CPU can still

 

 

write to Px_REG, but the pin is unaffected until it is switched back to

 

 

its standard I/O function.

 

 

This feature allows software to configure a pin as standard I/O (clear

 

 

Px_MODE.x), initialize or overwrite the pin value, then configure the

 

 

pin as a special-function signal (set Px_MODE.x). In this way, initial-

 

 

ization, fault recovery, exception handling, etc., can be done without

 

 

changing the operation of the associated peripheral.

 

 

 

6.3.1Bidirectional Port Operation

Figure 6-2 shows the logic for driving the output transistors, Q1 and Q2. Q1 can source at least –3 mA at V CC – 0.7 volts. Q2 can sink at least 3 mA at 0.45 volts. (Consult the datasheet for specifications.)

In I/O mode (selected by clearing Px_MODE.y), Px_REG and Px_DIR are input to the multiplexers. These signals combine to drive the gates of Q1 and Q2 so that the output is high, low, or high impedance. Table 6-6 is a logic table for I/O operation of these ports.

In special-function mode (selected by setting Px_MODE.y), SFDIR and SFDATA are input to the multiplexers. These signals combine to drive the gates of Q1 and Q2 so that the output is high, low, or high impedance. Special-function output signals clear SFDIR; special-function input signals set SFDIR. Table 6-7 is a logic table for special-function operation of these ports. Even if a pin is to be used in special-function mode, you must still initialize the pin as an input or output by writing to Px_DIR.

6-6

I/O PORTS

Resistor R1 provides ESD protection for the pin. Input signals are buffered. The standard ports use Schmitt-triggered buffers for improved noise immunity. Port 5 uses a standard input buffer because of the high speeds required for system control functions. The signals are latched into the Px_PIN sample latch and output onto the internal bus when the Px_PIN register is read.

The falling edge of RESET# turns on transistor Q3, which remains on for about 300 ns, causing the pin to change rapidly to its reset state. The active-low level of RESET# turns on transistor Q4, which weakly holds the pin high. (Q4 can source approximately –10 μA; consult the datasheet for exact specifications.) Q4 remains on, weakly holding the pin high, until your software writes to the Px_MODE register.

NOTE (8XC196CA, JQ, JR, JT, JV, KQ, KR)

P2.7 is an exception. After reset, P2.7 carries the CLKOUT signal (half the crystal input frequency) rather than being held high. When CLKOUT is selected, it is always a complementary output.

6-7

8XC196Kx, Jx, CA USER’S MANUAL

 

 

 

 

 

Internal Bus

 

 

 

 

 

 

 

 

 

 

 

Vcc

 

Px_REG

0

 

 

 

 

 

SFDATA

1

 

 

 

Q1

 

 

 

 

 

 

 

 

 

 

 

 

 

I/O Pin

Px_DIR

0

 

 

 

 

 

SFDIR

 

 

 

 

Q2

 

1

 

 

 

 

 

 

 

 

 

 

 

Px_MODE

 

 

 

 

Vss

 

 

 

 

 

 

 

 

Sample

 

 

150Ω to 200Ω

 

 

Latch

 

 

 

R1

 

Px_PIN

 

 

 

 

 

Q

D

 

 

 

 

 

LE

 

 

 

 

 

Read Port

 

 

 

 

 

 

 

PH1 Clock

 

 

Vcc

 

 

 

 

 

 

Medium

 

 

 

 

 

 

Pullup

 

 

300ns Delay

 

 

Q3

 

 

RESET#

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Vcc

 

 

 

 

 

 

Weak

 

 

RESET#

 

R

 

Pullup

 

 

 

 

 

Q

Q4

 

 

 

 

 

 

 

 

Any Write to Px_MODE

 

S

 

 

 

 

 

 

 

 

 

A0238-04

Figure 6-2. Bidirectional Port Structure

6-8

I/O PORTS

Table 6-6. Logic Table for Bidirectional Ports in I/O Mode

Configuration

Complementary Output

Open-drain

Input

Output

 

 

 

 

 

 

 

 

 

Px_MODE

0

0

0

0

 

 

 

 

 

Px_DIR

0

0

1

1

 

 

 

 

 

SFDIR

X

X

X

X

 

 

 

 

 

SFDATA

X

X

X

X

 

 

 

 

 

Px_REG

0

1

0, 1 (Note 2)

1

 

 

 

 

 

Q1

off

on

off

off

 

 

 

 

 

Q2

on

off

on, off (Note 2)

off

 

 

 

 

 

Px_PIN

0

1

X (Note 3)

high-impedance (Note 4)

 

 

 

 

 

NOTES:

1.X = Don’t care.

2.If Px_REG is cleared, Q2 is on; if Px_REG is set, Q2 is off.

3.Px_PIN contains the current value on the pin.

4.During reset and until the first write to Px_MODE, Q3 is on.

Table 6-7. Logic Table for Bidirectional Ports in Special-function Mode

Configuration

Complementary Output

Open-drain

Input

Output

 

 

 

 

 

 

 

 

 

Px_MODE

1

1

1

1

 

 

 

 

 

Px_DIR

0

0

1

1

 

 

 

 

 

SFDIR

0

0

1

1

 

 

 

 

 

SFDATA

0

1

0, 1 (Note 2)

1

 

 

 

 

 

Px_REG

X

X

X

1

 

 

 

 

 

Q1

off

on

off

off

 

 

 

 

 

Q2

on

off

on, off (Note 2)

off

 

 

 

 

 

Px_PIN

0

1

X (Note 3)

high-impedance (Note 4)

 

 

 

 

 

NOTES:

1.X = Don’t care.

2.If Px_REG is cleared, Q2 is on; if Px_REG is set, Q2 is off.

3.Px_PIN contains the current value on the pin.

4.During reset and until the first write to Px_MODE, Q3 is on.

6-9

Соседние файлы в предмете Электротехника