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

CHAPTER 8 SYNCHRONOUS SERIAL I/O (SSIO) PORT

This device has a synchronous serial I/O (SSIO) port that shares pins with port 6. This chapter describes the SSIO port and explains how to program it. Chapter 6, “I/O Ports,” explains how to configure the port pins for their special functions. Refer to Appendix B for details about the signals discussed in this chapter.

8.1SYNCHRONOUS SERIAL I/O (SSIO) PORT FUNCTIONAL OVERVIEW

The synchronous serial I/O (SSIO) port provides for simultaneous, bidirectional communications between this device and another synchronous serial I/O device. The SSIO port consists of two identical transceiver channels. A single dedicated baud-rate generator controls the baud rate of the SSIO port (15.625 kHz to 2.0 MHz at 16 MHz). Figure 8-1 is a block diagram of the SSIO port showing a master and slave configuration.

 

SDx

SDx

 

 

SSIOx_BUF

 

 

SSIOx_BUF

 

 

SCx

SCx

 

 

SSIOx_BAUD

 

 

SSIOx_BAUD

 

Control Logic

SSIOx Interrupt

Control Logic

SSIOx Interrupt

 

to Interrupt Controller

 

to Interrupt Controller

 

or PTS

 

 

or PTS

SSIOx_CON

 

 

SSIOx_CON

 

Master 8XC196 SSIO

 

 

Slave 8XC196 SSIO

 

 

 

 

 

A2840-02

Figure 8-1. SSIO Block Diagram

8-1

8XC196Kx, Jx, CA USER’S MANUAL

8.2SSIO PORT SIGNALS AND REGISTERS

Table 8-1 describes the SSIO signals and Table 8-2 describes the control and status registers.

 

 

 

Table 8-1. SSIO Port Signals

Port

SSIO

SSIO Port

 

 

Port

 

Description

Pin

Signal Type

Signal

 

 

 

 

 

 

 

 

 

 

P6.4

SC0

I/O

 

SSIO0 Clock Pin

 

 

 

 

This pin transmits a clock signal when SSIO0 is configured as a

 

 

 

 

master and receives a clock signal when it is configured as a

 

 

 

 

slave.

 

 

 

 

SC0 carries a clock signal only during receptions and transmis-

 

 

 

 

sions. The SC0 pin clocks once for each bit transmitted or

 

 

 

 

received (eight clocks per transmission or reception). When the

 

 

 

 

SSIO port is idle, the pin remains either high (with handshaking)

 

 

 

 

or low (without handshaking).

 

 

 

 

Handshaking mode requires an external pull-up resistor.

 

 

 

 

 

P6.5

SD0

I/O

 

SSIO0 Data Pin

 

 

 

 

SD0 transmits data when SSIO0 is configured as a transmitter

 

 

 

 

and receives data when it is configured as a receiver.

 

 

 

 

 

P6.6

SC1

I/O

 

SSIO1 Clock Pin

 

 

 

 

This pin transmits a clock signal when SSIO1 is configured as a

 

 

 

 

master and receives a clock signal when it is configured as a

 

 

 

 

slave.

 

 

 

 

SC1 carries a clock signal only during receptions and transmis-

 

 

 

 

sions. This pin carries a clock signal only during receptions and

 

 

 

 

transmissions. The SC1 pin clocks once for each bit transmitted

 

 

 

 

or received (eight clocks per transmission or reception). When

 

 

 

 

the SSIO port is idle, the pin remains either high (with

 

 

 

 

handshaking) or low (without handshaking).

 

 

 

 

 

P6.7

SD1

I/O

 

SSIO1 Data Pin

 

 

 

 

SD1 transmits data when SSIO1 is configured as a transmitter

 

 

 

 

and receives data when it is configured as a receiver.

 

 

 

 

 

Table 8-2. SSIO Port Control and Status Registers

Mnemonic

Address

Description

 

 

 

INT_MASK1

0013H

Interrupt Mask 1

 

 

Setting the SSIO0 bit of this register enables the SSIO channel 0

 

 

transfer interrupt; clearing the bit disables (masks) the interrupt.

 

 

Setting the SSIO1 bit of this register enables the SSIO channel 1

 

 

transfer interrupt; clearing the bit disables (masks) the interrupt.

 

 

 

NOTE: Always write zeros to the reserved bits in these registers.

8-2

 

 

 

SYNCHRONOUS SERIAL I/O (SSIO) PORT

 

Table 8-2. SSIO Port Control and Status Registers (Continued)

 

 

 

 

Mnemonic

 

Address

Description

 

 

 

 

INT_PEND1

 

0012H

Interrupt Pending 1

 

 

 

When set, SSIO0 indicates a pending channel 0 transfer interrupt.

 

 

 

When set, SSIO1 indicates a pending channel 1 transfer interrupt.

 

 

 

 

P6_DIR

 

1FD2H

Port 6 Direction

 

 

 

This register selects the direction of each port 6 pin. Clear P6_DIR.7:4

 

 

 

to configure SD1 (P6.7), SC1 (P6.6), SD0 (P6.5), and SC0 (P6.4) as

 

 

 

high-impedance inputs/open-drain outputs.

 

 

 

 

P6_MODE

 

1FD1H

Port 6 Mode

 

 

 

This register selects either the general-purpose input/output function or

 

 

 

the peripheral function for each pin of port 6. Set P6_MODE.7:4 to

 

 

 

configure SD1 (P6.7), SC1 (P6.6), SD0 (P6.5), and SC0 (P6.4) for the

 

 

 

SSIO.

 

 

 

 

P6_PIN

 

1FD7H

Port 6 Pin State

 

 

 

Read P6_PIN to determine the current values of SD1 (P6.7), SC1

 

 

 

(P6.6), SD0 (P6.5), and SC0 (P6.4).

 

 

 

 

P6_REG

 

1FD5H

Port 6 Output Data

 

 

 

This register holds data to be driven out on the pins of port 6. For pins

 

 

 

serving as inputs, set the corresponding P6_REG bits; for pins serving

 

 

 

as outputs, write the data to be driven out on the pins to the corre-

 

 

 

sponding P6_REG bits.

 

 

 

 

SSIO_BAUD

 

1FB4H

SSIO Baud Rate

 

 

 

This register enables and disables the baud-rate generator and selects

 

 

 

the SSIO baud rate.

 

 

 

 

SSIO0_BUF

 

1FB0H

SSIO Receive and Transmit Buffers

SSIO1_BUF

 

1FB2H

These registers contain either received data or data for transmission,

 

 

 

 

 

 

depending on the communications mode. Data is shifted into this

 

 

 

register from the SDx pin or from this register to the SDx pin, with the

 

 

 

most-significant bit first.

 

 

 

 

SSIO0_CON

 

1FB1H

These registers control the communications mode and handshaking

SSIO1_CON

 

1FB3H

and reflect the status of the SSIO channels.

 

 

 

 

NOTE: Always write zeros to the reserved bits in these registers.

8.3SSIO OPERATION

Each SSIO channel can be configured as either master or slave and as either transmitter or receiver, allowing the channels to communicate in several bidirectional, single-byte transfer modes (Figure 8-2). A master device transmits a clock signal; a slave device receives a clock signal.

8-3

8XC196Kx, Jx, CA USER’S MANUAL

 

SD0

SD0

Master

Slave

SC0

SC0

Single-channel Half-duplex Master/Slave Configuration

SD0

SD0

Master

Slave

SC0

SC0

SD1

SD1

Slave

Slave

SC1

SC1

Double-channel Full-duplex Lockstep

Common Clock Configuration

 

SD0

SD0

Master

Slave

SC0

SC0

SD1

SD1

Slave

Master

SC1

SC1

Double-channel Full-duplex Master/Slave

Separate Clock Configuration

 

 

A0233-03

Figure 8-2. SSIO Operating Modes

One channel can act as master transceiver to communicate with compatible protocols in half-duplex mode. This mode requires one data input/output pin and one clock output pin.

One channel can act as slave transceiver to communicate with compatible protocols in halfduplex mode. This mode requires one data input/output pin and one clock input pin.

8-4

SYNCHRONOUS SERIAL I/O (SSIO) PORT

The two channels can operate together, from the same clock, as master transceivers to communicate in lockstep (mutually synchronous), full-duplex mode. This mode requires one data input pin, one data output pin, and two clock pins (the clock output pin from one channel connected to the clock input pin of the other).

The two channels can operate together, from the same clock, as slave transceivers to communicate in lockstep (mutually synchronous), full-duplex mode. This mode requires one data input pin, one data output pin, and two clock input pins.

The two channels can operate independently, with different clocks, to communicate in nonlockstep, full-duplex mode. In this mode, one channel acts as slave (receives a clock) and the other acts as master (transmits a clock). This mode requires a data input pin, a data output pin, a clock input pin, and a clock output pin.

The SSIO channels can also operate in handshaking modes for unidirectional, multi-byte transfers. These modes enable a master device to perform SSIO transfers using the PTS. Handshaking prevents a data underflow or overflow from occurring at the slave. It takes place in hardware, using the clock pins, with no CPU overhead.

The two channels can operate with handshaking enabled, in full-duplex mode. One channel acts as slave and the other acts as master. This mode requires four pins.

The two channels can operate with handshaking enabled, in half-duplex mode. One channel acts as slave and the other acts as master. This mode requires two pins.

Each channel contains an 8-bit buffer register, SSIOx_BUF, and logic to clock the data into and out of the transceiver. In receive mode, data is shifted (MSB first) from the SDx pin into SSIOx_BUF. In transmit mode, data is shifted from SSIOx_BUF onto the SDx pin. The receiver latches data from the transmitter on the rising edge of SCx and the transmitter changes (or floats) output data on the falling edge of SCx.

In the handshaking modes, the clock polarities are reversed, so the corresponding clock edges are also reversed. The clock pin, SCx, must be configured as an open-drain output in both master and slave modes. (This configuration requires an external pull-up.) The master leaves the SCx output high at the end of each byte transfer. The slave pulls its clock input low when it is busy. (In receive mode, the slave is busy when the buffer is full; in transmit mode, the slave is busy when the buffer is empty.) The slave releases SCx when it is ready to receive or transmit. The master waits for SCx to return high before attempting the next transfer. Figure 8-3 illustrates transmit and receive timings with and without handshaking.

8-5

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