Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Сигнальный МП Motorola DSP56002.pdf
Скачиваний:
22
Добавлен:
26.05.2014
Размер:
2 Мб
Скачать
☆

Freescale Semiconductor, Inc.

Freescale Semiconductor, Inc.

SERIAL COMMUNICATION INTERFACE (SCI)

The interrupt service routine, which can be a fast interrupt or a long interrupt, (4) reads the received character. Reading the SRX (5) automatically clears RDFR in the SSR and makes the SRX ready to receive another byte.

If (1) an FE, PE, or OR occurs while receiving data (see Figure 6-24), (2) RDRF is set because a character has been received; FE, PE, or OR is set in the SSR to indicate that an error was detected. Either (3) the SSR can be polled by software to look for errors, or (4) interrupts can be used to execute an interrupt service routine. This interrupt is different from the normal receive interrupt and is caused only by receive errors. The long interrupt service routine should (5) read the SSR to determine what error was detected and then

(6) read the SRX to clear RDRF and all three error flags.

6.3.7.2Asynchronous Data Transmission

Figure 6-25 illustrates initializing the SCI data transmitter for asynchronous data. The first step (1) resets the SCI to prevent the SCI from transmitting or receiving data. Step two (2) selects the desired operation by programming the SCR. As a minimum, the word format (WDS2, WDS1, and WDS0) must be selected, and (3) the transmitter must be enabled (TE=1). If (4) interrupts are to be used, set TIE equals one. Use Table 6-3 (a) through Table 6-4 (b) to set (5) the baud rate (SCP and CD0–CD11 in the SCCR). Once the SCI is completely configured, it can be enabled by (6) setting the TXD bit in the PCC. Transmission begins with (7) a preamble of ones.

If polling is used to transmit data (see Figure 6-26), the polling routine can look at either TDRE or TRNE to determine when to load another byte into STX. If TDRE is used (1), one byte may be loaded into STX. If TRNE is used (2), two bytes may be loaded into STX if enough time is allowed for the first byte to begin transmission (see 6.3.2.4.2). If interrupts are used (3), then an interrupt is generated when STX is empty. The interrupt routine, which can be a fast interrupt or a long interrupt, writes (4) one byte into STX. If multidrop mode is being used and this byte is an address, STXA should be used instead of STX.

Writing STX or STXA (5) clears TDRE in the SSR. When the transmit data shift register is empty (6), the byte in STX (or STXA) is latched into the transmit data shift register, TRNE is cleared, and TDRE is set.

There is a provision to send a break or preamble. A break (space) consists of a period of zeros with no start or stop bits that is as long or longer than a character frame. A preamble

(mark) is an inverted break. A preamble of 10 or 11 ones (depending on the word length selected by WDS2, WDS1, and WDS0) can be sent with the following procedure (see Figure 6-27). (1) Write the last byte to STX and (2) wait for TDRE equals one. This is the byte that will be transmitted immediately before the preamble. (3) Clear TE and then again set it to one. Momentarily clearing TE causes the output to go high for one character frame.

6 - 48 PORT C MOTOROLA

For More Information On This Product, Go to: www.freescale.com

Freescale Semiconductor, Inc.

Freescale Semiconductor, Inc.

SERIAL COMMUNICATION INTERFACE (SCI)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

SRX

 

 

 

 

OR, PE, AND

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

8 7

 

 

 

 

 

 

 

CLEARS THE

 

 

 

 

 

 

 

 

 

 

 

(SSR)REGISTERSTATUSSCI

 

 

 

 

 

(SSR)REGISTERSTATUSSCI

 

 

23 16 15

 

SRX

 

 

 

 

 

SSR AND

 

Reception with Exception

 

 

 

 

 

RXD

 

 

 

ONLY)(READ

 

 

 

 

ONLY)(READ

 

X:$FFF6

X:$FFF5

X:$FFF4

INTERRUPT

SERVICE

ROUTINE

5. READ SSR

6. READ SRX. THIS CLEARS RDRF IN THE

FE FLAGS.

RECEIVEDISCHARACTERA1.WITH AT LEAST ONE OF THE FOLLOWING ERRORS:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

SRX

 

 

 

 

 

 

 

 

 

BIT=(FEERRORFRAMING—6 IN SSR

5BIT=(PEERRORPARITY—IN SSR)

BIT=(ORERROROVERRUN— 4 IN SSR)

STRINGSERIALOF BAD DATA

XXXXXXXX

OR,SETANDRDRFSETSTHIS2. PE, OR FE IN SSR.

SOFTWARE.BYPOLLEDBECANSSR3.

567 4 3 2 1 0

PEFER8X:$FFF1OR IDLE 1 TDRE TRNE

RDRF

ONELEASTATBIT SET

INTERRUPTANTHENSCR,IN1=RIEIF4. WITH ERROR IS GENERATED.

567 4 3 2 1 0

PEFER8X:$FFF1OR IDLE 1 TDRE TRNE

RDRF

 

 

RIE

RECEIVE WITH

INTERRUPT EXCEPTION

VECTOR

TABLE

 

 

P:$0016

Figure 6-24 SCI Character

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

WITH INTERRUPT

EXCEPTION

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

SCI RECEIVEDATA

 

If TE remains cleared for a longer period, the output will remain high for an even number

MOTOROLA PORT C 6 - 49

For More Information On This Product, Go to: www.freescale.com

50 - 6

More For

Information

.wwwGoto:

PORT

freescale

C

On

This

com.

 

Product,

MOTOROLA

Freescale Semiconductor, Inc.

1.HARDWARE OR SOFTWARE RESET

2.PROGRAM SCR WITH DESIRED MODE AND FEATURES.

3.TURN ON TRANSMITTER (TE = 1).

4.OPTIONALLY ENABLE TRANSMITTER INTERRUPTS (TIE = 1).

 

 

15

 

14

 

13

12

 

11

10

9

 

 

8

7

6

5

4

3

2

1

 

 

0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

SCKP

 

 

STIR

 

TMIE

1

 

RIE

ILIE

1

 

 

RE

WOMS

RWU

WAKE

SBK

SSFTD

WDS2

WDS1

WDS0

 

SCICONTROLREGISTER(SCR)

X:$FFF0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

(READ/WRITE)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

TIE

 

 

TE

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

5.

SET THE SCI CLOCK PRESCALER BIT AND THE CLOCK DIVIDER BITS IN THE SCCR.

 

 

 

 

 

 

 

 

 

 

 

 

6.

SET THE TXD BIT IN PCC TO ENABLE THE SCI TRANSMITTER SYSTEM.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

SCI

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

23

 

 

 

 

 

 

 

 

 

 

9

 

8

7

6

5

4

3

2

1

 

 

0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0

 

 

 

 

 

 

 

CC8

CC7

CC6

CC5

CC4

CC3

CC2

1

 

 

CC0

 

 

X:$FFE1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

PORTCCONTROLREGISTER(PCC)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

TXD

 

 

 

 

CCx Function

0GPIO

1Serial Interface

7.THE TRANSMITTER WILL FIRST BROADCAST A PREAMBLE OF ONES BEFORE BEGINNING DATA TRANSMISSION: 10 ONES WILL BE TRANSMITTED FOR THE 10-BIT ASYNCHRONOUS MODE.

11 ONES WILL BE TRANSMITTED FOR THE 11-BIT ASYNCHRONOUS MODE.

NOTE:

If TE is cleared while transmitting a character, the transmission of the character will be completed before the transmitter is disabled.

 

 

Figure 6-25 Asynchronous SCI Transmitter Initialization

(SCI) INTERFACE COMMUNICATION SERIAL

Inc Semiconductor, Freescale

 

.

Freescale Semiconductor, Inc.

Freescale Semiconductor, Inc.

SERIAL COMMUNICATION INTERFACE (SCI)

TXD

 

 

SCISTATUSREGISTER(SSR) (READ/WRITE)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0

 

1

 

 

TRNE

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1

 

1

 

 

TDRE

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

2

 

RDRF

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

3

 

IDLE

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

4

 

OR

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

5

 

PE

 

 

 

 

 

 

 

 

 

 

 

 

 

1.

 

 

 

 

 

 

 

 

 

TRNE =

 

6

 

FE

 

 

 

 

 

 

 

 

 

 

 

 

 

 

AND THE TRANSMIT DATA SHIFT REGISTER IS EMPTY THEN

TDRE = 1 IN SSR, THEN AN INTERRUPT IS GENERATED.

13 12 11 10 9 8 7

 

R8

 

 

 

 

 

0

 

 

 

 

 

0

 

 

 

 

 

0

 

 

 

 

 

0

 

 

 

 

 

0

 

 

 

 

THEN TDRE = 1.

0

 

 

 

 

 

 

15 14

 

 

0

 

 

 

 

1. WHEN STX IS EMPTY,

2. WHEN STX IS EMPTY

3. IF TIE = 1 IN SCR AND

 

 

 

 

 

 

0

 

 

 

 

 

 

 

 

 

 

 

 

 

X:$FFF1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0

 

 

 

 

 

 

 

STX

 

 

STXA

7

 

 

 

 

 

8

 

 

 

 

 

 

STX

 

 

 

 

16 15

 

 

 

 

 

STX

 

 

 

 

 

23

 

 

 

 

 

X:$FFF6

X:$FFF5

X:$FFF4

 

 

X:$FFF3

TRANSMIT INTERRUPT SERVICE ROUTINE

 

STORE ONE

CHARACTER INTO STX (A)

THIS CLEARS TDRE IN SSR.

DATA SHIFT REGISTER.

INTERRUPTVECTOR TABLE

 

4.

AVAILABLEFOR HOST COMMAND

5.

TRANSMIT

 

P:$0018

 

CHARACTERTHE.6 IN STX IS COPIED INTO CLEARED.ISTRNE SET.ISTDRE 2STEPTOGO.

 

 

TRANSMITDATASCI

 

 

 

Figure 6-26 Asynchronous SCI Character Transmission

of character frames until TE is set. (4) Write the first byte to follow the preamble into SRX

MOTOROLA PORT C 6 - 51

For More Information On This Product, Go to: www.freescale.com

Соседние файлы в предмете Радиоприемные устройства