23.04.2013 Views

TMPM330 - Keil

TMPM330 - Keil

TMPM330 - Keil

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Under development<br />

10.5.6 Configuring the SBI as a Transmitter or a Receiver<br />

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

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

Setting SBIxCR2 to “1” configures the SBI as a transmitter. Setting to “0”<br />

configures the SBI as a receiver.<br />

At the slave mode, the SBI receives the direction bit ( R/ W ) from the master device on the<br />

following occasions:<br />

• when data is transmitted in the addressing format<br />

• when the received slave address matches the value specified at I2CCR<br />

• when a general-call address is received; i.e., the eight bits following the start<br />

condition are all zeros<br />

If the value of the direction bit ( R/ W ) is “1,” is set to “1” by the hardware. If the bit is<br />

“0,” is set to “0”.<br />

As a master device, the SBI receives acknowledgement from a slave device. If the direction<br />

bit of “1” is transmitted, is set to “0” by the hardware. If the direction bit is “0,” <br />

changes to “1.” If the SBI does not receive acknowledgement, retains the previous<br />

value.<br />

is cleared to “0” by the hardware when it detects the stop condition on the bus or the<br />

arbitration lost.<br />

10.5.7 Generating Start and Stop Conditions<br />

SCL line<br />

SDA line<br />

Start condition<br />

When SBIxSR is “0,” writing “1” to SBIxCR2 causes the SBI to<br />

generate the start condition on the bus and output 8-bit data. must be set to “1” in<br />

advance.<br />

1<br />

A6<br />

Fig. 10-10 Generating the Start Condition and a Slave Address<br />

When is “1,” writing “1” to and “0” to causes the SBI to start<br />

a sequence for generating the stop condition on the bus. The contents of should not be altered until the stop condition appears on the bus.<br />

SCL line<br />

SDA line<br />

2 3 4 5 6 7 8 9<br />

A5 A4 A3 A2 A1 A0 R/W<br />

Slave address and direction bit<br />

Stop condition<br />

Fig. 10-11 Generating the Stop Condition<br />

Acknowledgement<br />

signal<br />

SBIxSR can be read to check the bus state. is set to “1” when the start<br />

condition is detected on the bus (the bus is busy), and set to “0” when the stop condition is<br />

detected (the bus is free).<br />

Serial Bus Interface (SBI)

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

Saved successfully!

Ooh no, something went wrong!