23.04.2013 Views

TMPM330 - Keil

TMPM330 - Keil

TMPM330 - Keil

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<br />

<br />

SCK pin (output)<br />

SI pin<br />

INTSBIx interrupt request<br />

SBIxDBR<br />

Under development<br />

Fig. 10-29 Receive Mode (Example: Internal Clock)<br />

8-bit transmit/receive mode<br />

<strong>TMPM330</strong> (rev 0.4) 10-36<br />

is cleared.<br />

a0 a1 a2 a3 a4 a5 a6 a7 b0 b1 b2 b3 b4 b5 b6 b7<br />

<strong>TMPM330</strong><br />

Set the control register to the transfer/receive mode. Then writing the transmit data to<br />

SBIxDBR and setting SBIxCR1 to “1” enables transmission and reception. The<br />

transmit data is output through the SO pin at the falling of the serial clock, and the received<br />

data is taken in through the SI pin at the rising of the serial clock, with the least-significant bit<br />

(LSB) first. Once the shift register is loaded with the 8-bit data, it transfers the received data<br />

to SBIxDBR and the INTSBIx interrupt request is generated. The interrupt service program<br />

reads the received data from the data buffer register and writes the next transmit data.<br />

Because SBIxDBR is shared between transmit and receive operations, the received data<br />

must be read before the next transmit data is written.<br />

In the internal clock operation, the serial clock will be automatically in the wait state until the<br />

received data is read and the next transmit data is written.<br />

In the external clock mode, shift operations are executed in synchronization with the<br />

external serial clock. Therefore, the received data must be read and the next transmit data<br />

must be written before the next shift operation is started. The maximum data transfer rate<br />

for the external clock operation varies depending on the maximum latency between when<br />

the interrupt request is generated and when the transmit data is written.<br />

At the beginning of transmission, the same value as in the last bit of the previously<br />

transmitted data is output in a period from setting to “1” to the falling edge of SCK.<br />

Transmission and reception can be terminated by clearing to “0” or setting<br />

SBIxCR1 to “1” in the INTSBIx interrupt service program. If is cleared,<br />

transmission and reception continue until the received data is fully transferred to SBIxDBR.<br />

The program checks SBIxSR to determine whether transmission and reception<br />

have come to an end. is cleared to “0” at the end of transmission and reception. If<br />

is set, the transmission and reception are aborted immediately and is<br />

cleared to “0.”<br />

(Note) The contents of SBIxDBR will not be retained after the transfer mode is<br />

changed. The ongoing transmission and reception must be completed by<br />

clearing to “0” and the last received data must be read before the<br />

transfer mode is changed.<br />

a<br />

Read the received data Read the received data<br />

Serial Bus Interface (SBI)<br />

b

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!