25.08.2015 Views

UM10139

UM10139 Volume 1: LPC214x User Manual - Fab@Home

UM10139 Volume 1: LPC214x User Manual - Fab@Home

SHOW MORE
SHOW LESS
  • No tags were found...

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

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

Philips SemiconductorsVolume 1<strong>UM10139</strong>Chapter 11: I 2 C interfaces11.8.1 Master Transmitter modeIn the master transmitter mode, a number of data bytes are transmitted to a slave receiver(see Figure 33). Before the master transmitter mode can be entered, I2CON must beinitialized as follows:Table 145: I2CONSET used to initialize Master Transmitter modeBit 7 6 5 4 3 2 1 0Symbol - I2EN STA STO SI AA - -Value - 1 0 0 0 x - -The I 2 C rate must also be configured in the I2SCLL and I2SCLH registers. I2EN must beset to logic 1 to enable the I 2 C block. If the AA bit is reset, the I 2 C block will notacknowledge its own slave address or the general call address in the event of anotherdevice becoming master of the bus. In other words, if AA is reset, the I 2 C interface cannotenter a slave mode. STA, STO, and SI must be reset.The master transmitter mode may now be entered by setting the STA bit. The I 2 C logic willnow test the I 2 C-bus and generate a start condition as soon as the bus becomes free.When a START condition is transmitted, the serial interrupt flag (SI) is set, and the statuscode in the status register (I2STAT) will be 0x08. This status code is used by the interruptservice routine to enter the appropriate state service routine that loads I2DAT with theslave address and the data direction bit (SLA+W). The SI bit in I2CON must then be resetbefore the serial transfer can continue.When the slave address and the direction bit have been transmitted and anacknowledgment bit has been received, the serial interrupt flag (SI) is set again, and anumber of status codes in I2STAT are possible. There are 0x18, 0x20, or 0x38 for themaster mode and also 0x68, 0x78, or 0xB0 if the slave mode was enabled (AA = logic 1).The appropriate action to be taken for each of these status codes is detailed in Table 148.After a repeated start condition (state 0x10). The I 2 C block may switch to the masterreceiver mode by loading I2DAT with SLA+R).11.8.2 Master Receiver modeIn the master receiver mode, a number of data bytes are received from a slave transmitter(see Figure 34). The transfer is initialized as in the master transmitter mode. When thestart condition has been transmitted, the interrupt service routine must load I2DAT with the7-bit slave address and the data direction bit (SLA+R). The SI bit in I2CON must then becleared before the serial transfer can continue.When the slave address and the data direction bit have been transmitted and anacknowledgment bit has been received, the serial interrupt flag (SI) is set again, and anumber of status codes in I2STAT are possible. These are 0x40, 0x48, or 0x38 for themaster mode and also 0x68, 0x78, or 0xB0 if the slave mode was enabled (AA = 1). Theappropriate action to be taken for each of these status codes is detailed in Table 149. Aftera repeated start condition (state 0x10), the I 2 C block may switch to the master transmittermode by loading I2DAT with SLA+W.© Koninklijke Philips Electronics N.V. 2005. All rights reserved.User manual Rev. 01 — 15 August 2005 148

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

Saved successfully!

Ooh no, something went wrong!