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

Freescale Semiconductor, Inc.

Freescale Semiconductor, Inc.

SERIAL COMMUNICATION INTERFACE (SCI)

one 24-bit word by “OR”-ing three data bytes read from the three addresses. The following code fragment requires that R0 initially points to X:$FFF4, register A is initially cleared, and R3 points to a data buffer. The only programming trick is using BCLR to test bit 1 of the packing pointer to see if it is pointing to X:$FFF6 and clearing bit 1 to point to X:$FFF4 if it had been pointing to X:$FFF6. This procedure resets the packing pointer after receiving three bytes.

MOVE

X:(R0),X0

;Copy received data to temporary register

BCLR

#$1,R0

;Test for last byte

 

 

;reset pointer if it is the last byte

OR

X0,A

;Pack the data into register A

MOVE

(R0)+

;and increment the packing pointer

JCS

FLAG

;Jump to clean up routine if last byte

RTI

 

;Else return until next byte is received

FLAG MOVE

A,(R3)+

;Move the packed data to memory

CLR

A

;Prepare A for packing next three bytes

RTI

 

;Return until the next byte is received

The length and format of the serial word is defined by the WDS0, WDS1, and WDS2 control bits in the SCI control register. In the synchronous modes, the start bit, the eight data bits with LSB first, the address/data indicator bit and/or the parity bit, and the stop bit are received in that order for SSFTD equals zero (see Figure 6-10 (a)). For SSFTD equals one, the data bits are transmitted MSB first (see Figure 6-10(b)). The clock source is defined by the receive clock mode (RCM) select bit in the SCR. In the synchronous mode, the synchronization is provided by gating the clock. In either mode, when a complete word has been clocked in, the contents of the shift register can be transferred to the SRX and the flags; RDRF, FE, PE, and OR are changed appropriately. Because the operation of the SCI receive shift register is transparent to the DSP, the contents of this register are not directly accessible to the programmer.

6.3.2.4.2SCI Transmit Registers

The transmit data register is one byte-wide register mapped into four addresses:

X:$FFF3, X:$FFF4, X:$FFF5, and X:$FFF6. In the asynchronous mode, when data is to be transmitted, X:$FFF4, X:$FFF5, and X:$FFF6 are used, and the register is called STX. When X:$FFF4 is written, the low byte on the data bus is transferred to the STX; when X:$FFF5 is written, the middle byte is transferred to the STX; and when X:$FFF6 is written, the high byte is transferred to the STX. This structure (see Figure 6-9) makes it easy for the programmer to unpack the bytes in a 24-bit word for transmission. Location

X:$FFF3 should be written in the 11-bit asynchronous multidrop mode when the data is

6 - 28 PORT C MOTOROLA

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

Freescale Semiconductor, Inc.

Freescale Semiconductor, Inc.

SERIAL COMMUNICATION INTERFACE (SCI)

an address and it is desired that the ninth bit (the address bit) be set. When X:$FFF3 is written, the transmit data register is called STXA, and data from the low byte on the data bus is stored in STXA. The address data bit will be cleared in the 11-bit asynchronous multidrop mode when any of X:$FFF4, X:$FFF5, or X:$FFF6 is written. When either STX or STXA is written, TDRE is cleared.

The transfer from either STX or STXA to the transmit shift register occurs automatically, but not immediately, when the last bit from the previous word has been shifted out – i.e., the transmit shift register is empty. Like the receiver, the transmitter is double buffered. However, there will be a two to four serial clock cycle delay between when the data is transferred from either STX or STXA to the transmit shift register and when the first bit appears on the TXD pin. (A serial clock cycle is the time required to transmit one data bit).

 

 

 

 

“A”

 

 

“B”

 

 

 

“C”

 

 

 

 

 

X0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

23

16 15

8

7

 

 

 

0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

STX

 

 

 

 

 

 

 

 

 

 

 

 

X:$FFF6

 

 

 

 

 

 

 

 

 

 

 

 

MOVE X0, X:$FFF6; TRANSMIT CHARACTER “A”

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

X:$FFF5

 

 

 

 

 

 

STX

 

 

 

 

 

 

 

MOVE X0, X:$FFF5; TRANSMIT CHARACTER “B”

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

X:$FFF4

 

 

 

 

 

 

 

 

 

 

STX

 

 

 

MOVE X0, X:$FFF4; TRANSMIT CHARACTER “C”

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

NOTE: STX is the same register decoded at three different addresses.

(a) Unpacking

 

 

 

 

23

16 15

8

7

 

 

 

0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

SRX

 

 

 

 

 

 

 

 

 

 

 

 

X:$FFF6

 

 

 

 

 

 

 

 

 

 

 

 

 

MOVE X0, X:$FFF6; RECEIVE CHARACTER “A”

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

X:$FFF5

 

 

 

 

 

 

SRX

 

 

 

 

 

 

 

MOVE X0, X:$FFF5; RECEIVE CHARACTER “B”

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

X:$FFF4

 

 

 

 

 

 

 

 

 

 

SRX

 

 

 

MOVE X0, X:$FFF4; RECEIVE CHARACTER “C”

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

“A”

 

 

“B”

 

 

 

“C”

 

 

 

 

 

X0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

NOTE: SRX is the same register decoded at three different addresses.

(b) Packing

Figure 6-13 Data Packing and Unpacking

MOTOROLA PORT C 6 - 29

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

Freescale Semiconductor, Inc.

Freescale Semiconductor, Inc.

SERIAL COMMUNICATION INTERFACE (SCI)

The transmit shift register is not directly addressable, and a dedicated flag for this register does not exist. Because of this fact and the two to four cycle delay, two bytes cannot be written consecutively to STX or STXA without polling. The second byte will overwrite the first byte. The TDRE flag should always be polled prior to writing STX or STXA to prevent overruns unless transmit interrupts have been enabled. Either STX or STXA is usually written as part of the interrupt service routine. Of course, the interrupt will only be generated if TDRE equals one. The transmit shift register is indirectly visible via the TRNE bit in the SSR.

In the synchronous modes, data is synchronized with the transmit clock, which may have either an internal or external source as defined by the TCM bit in the SCCR. The length and format of the serial word is defined by the WDS0, WDS1, and WDS2 control bits in the SCR. In the asynchronous modes, the start bit, the eight data bits (with the LSB first if SSFTD=0 and the MSB first if SSFTD=1), the address/data indicator bit or parity bit, and the stop bit are transmitted in that order (see Figure 6-10).

The data to be transmitted can be written to any one of the three STX addresses. If SCKP equals one and SSHTD equals one, the SCI synchronous mode is equivalent to the SSI operation in the 8-bit data on-demand mode.

6.3.2.5Preamble, Break, and Data Transmission Priority

It is possible that two or three transmission commands are set simultaneously:

1.A preamble (TE was toggled)

2.A break (SBK was set or was toggled)

3.There is data for transmission (TDRE=0)

After the current character transmission, if two or more of these commands are set, the transmitter will execute them in the following priority:

1.Preamble

2.Break

3.Data

6 - 30 PORT C MOTOROLA

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

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