NuMicro™ Mini51 Technical Reference ManualFeb 9, 2012 Page 184 of 342 Revision V1.03NUMICRO™ MINI51 TECHNICAL REFERENCE MANUAL5.9.7 Operation ModesThe on-chip I2C port supports five operation modes: Master transmitter, Master receiver, Slavetransmitter, Slave receiver, and GC call.In a given application, I2C port may operate as a master or as a slave. In Slave mode, the I2C porthardware looks for its own slave address and the general call address. If one of these addressesis detected, and if the slave is willing to receive or transmit data from/to master (by setting the AAbit), acknowledge pulse will be transmitted out on the 9th clock, hence an interrupt is requested onboth master and slave devices if interrupt is enabled. When the microcontroller wishes to becomethe bus master, the hardware waits until the bus is free before the Master mode is entered so thata possible slave action is not interrupted. If bus arbitration is lost in Master mode, I2C port switchesto Slave mode immediately and can detect its own slave address in the same serial transfer.5.9.8 Master Transmitter ModeSerial data is output through SDA while SCL outputs the serial clock. The first byte transmittedcontains the slave address of the receiving device (7 bits) and the data direction bit. In this casethe data direction bit (R/W) will be logic “0”, and it is represented by “W” in the flow diagrams. Thusthe first byte transmitted is SLA+W. Serial data transmits 8 bits at a time. After each byte istransmitted, an acknowledge bit is received. The START and STOP conditions are output toindicate the beginning and end of a serial transfer.5.9.9 Master Receiver ModeIn this case the data direction bit (R/W) will be logic “1”, and it is represented by “R” in the flowdiagrams. Thus the first byte transmitted is SLA+R. Serial data is received via SDA while SCLoutputs the serial clock. Serial data receives 8 bits at a time. After each byte is received, anacknowledge bit is transmitted. The START and STOP conditions are output to indicate thebeginning and end of a serial transfer.5.9.10 Slave Receiver ModeSerial data and serial clock are received through SDA and SCL. After each byte is received, anacknowledge bit is transmitted. START and STOP conditions are recognized as the beginning andend of a serial transfer. Address recognition is performed by hardware after reception of the slaveaddress and direction bit.5.9.11 Slave Transmitter ModeThe first byte is received and handled as in the slave receiver mode. However, in this mode, thedirection bit will indicate that the transfer direction is reversed. Serial data is transmitted via SDAwhile the serial clock is input through SCL. START and STOP conditions are recognized as thebeginning and end of a serial transfer.5.9.12 Data Transfer Flow in Five Operation ModesThe five operation modes are: Master transmitter, Master receiver, Slave transmitter, Slavereceiver, and GC Call. Bits STA, STO and AA in I2CON register will determine the next state of theI2C hardware after SI flag is cleared. Upon completion of the new action, a new status code will beupdated and the SI flag will be set. If the I2C interrupt control bit EI (I2CON[7]) is set, appropriateaction or software branch of the new status code can be performed in the Interrupt service routine.Data transfers in each mode are shown in the following figures.