i2c mode

47
I 2 C Mode The MSSP module in I2C mode fully implements all master and slave functions (including general call support) and provides interrupts on Start and Stop bits in hardware to determine a free bus (multi-master function). The MSSP module implements the standard mode specifications, as well as 7-bit and 10-bit addressing. Two pins are used for data transfer: • Serial clock (SCL) – RC3/SCK/SCL • Serial data (SDA) – RC4/SDI/SDA The user must configure these pins as inputs or outputs through the TRISC<4:3> bits. El módulo MSSP en el modo I2C completamente implementa todo Las funciones de amo y del esclavo (incluyendo llamada general El soporte) y provee interrupciones en el Principio y los bits de parada En hardware para determinar un autobús gratis (el multiamo La función). El módulo MSSP implementa el estándar Las especificaciones de modo, así como también de 7 pedacitos y de 10 pedacitos El direccionamiento. Dos alfileres sirven para reembarque de datos: •†El reloj serial (SCL) _ RC3/SCK/SCL •†/ la CED serial de datos _ RC4/SDI (la CED) El usuario debe configurar estos alfileres como los aportes o las salidas A través de los > pedacitos TRISC < 4:3.

Upload: daniel

Post on 27-Nov-2014

109 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: I2C Mode

I 2 C Mode The MSSP module in I2C mode fully implements allmaster and slave functions (including general callsupport) and provides interrupts on Start and Stop bitsin hardware to determine a free bus (multi-masterfunction). The MSSP module implements the standardmode specifications, as well as 7-bit and 10-bitaddressing.Two pins are used for data transfer:• Serial clock (SCL) – RC3/SCK/SCL• Serial data (SDA) – RC4/SDI/SDAThe user must configure these pins as inputs or outputsthrough the TRISC<4:3> bits.

El módulo MSSP en el modo I2C completamente implementa todoLas funciones de amo y del esclavo (incluyendo llamada generalEl soporte) y provee interrupciones en el Principio y los bits de paradaEn hardware para determinar un autobús gratis (el multiamoLa función). El módulo MSSP implementa el estándarLas especificaciones de modo, así como también de 7 pedacitos y de 10 pedacitosEl direccionamiento.Dos alfileres sirven para reembarque de datos:•†El reloj serial (SCL) _ RC3/SCK/SCL•†/ la CED serial de datos _ RC4/SDI (la CED)El usuario debe configurar estos alfileres como los aportes o las salidasA través de los > pedacitos TRISC < 4:3.

17.4.1 REGISTERSThe MSSP module has six registers for I2C operation.These are:

Page 2: I2C Mode

• MSSP Control Register 1 (SSPCON1)• MSSP Control Register 2 (SSPCON2)• MSSP Status Register (SSPSTAT)• Serial Receive/Transmit Buffer Register(SSPBUF)• MSSP Shift Register (SSPSR) – Not directlyaccessible• MSSP Address Register (SSPADD)SSPCON1, SSPCON2 and SSPSTAT are the controland status registers in I2C mode operation. TheSSPCON1 and SSPCON2 registers are readable andwritable. The lower 6 bits of the SSPSTAT are read-only.The upper two bits of the SSPSTAT are read/write.SSPSR is the shift register used for shifting data in orout. SSPBUF is the buffer register to which data bytesare written to or read from.SSPADD register holds the slave device address whenthe MSSP is configured in I2C Slave mode. When theMSSP is configured in Master mode, the lower sevenbits of SSPADD act as the Baud Rate Generator reloadvalue.In receive operations, SSPSR and SSPBUF togethercreate a double-buffered receiver. When SSPSRreceives a complete byte, it is transferred to SSPBUFand the SSPIF interrupt is set.During transmission, the SSPBUF is not doublebuffered.A write to SSPBUF will write to both SSPBUFand SSPSR

17.4.1 SE REGISTRAEl módulo MSSP tiene seis registros para la operación I2C.Estos son:•†MSSP Controle Registro 1 (SSPCON1)•†MSSP Controle Registro 2 (SSPCON2)•†MSSP Registro Status (SSPSTAT)•†La Novela Por Entregas Reciba / Transmite Registro Intermedio(SSPBUF)•†MSSP No Cambie de Posición a Register (SSPSR) directamenteAccesible•†MSSP Ocúpese de Registro (SSPADD)SSPCON1, SSPCON2 y SSPSTAT son el controlY el estatus registra en la operación de modo I2C. LoEl SSPCON1 y los registros SSPCON2 son legibles yEscribible. Los pedacitos 6 inferiores del SSPSTAT son de sólo lectura.Los pedacitos dos superiores del SSPSTAT son lectura / de escritura.SSPSR es el registro de cambio destinado para intercambiar información adentro oFuera. SSPBUF es el registro intermedio para el cual los bytes de datosLe escribió o leer de.El registro SSPADD sujeta la dirección del dispositivo del esclavo cuándoEl MSSP es configurado en el modo I2C Slave. Cuando loMSSP es configurado en el modo amo, lo más bajo sieteLos pedacitos de acto SSPADD como el Generador de Velocidad en Baudios vuelven a cargarEl valor.Adentro reciba operaciones, SSPSR y SSPBUF conjuntamenteCree un aparato receptor de amortiguador doble. Cuando SSPSRRecibe un byte completo, es transferido para SSPBUFY la interrupción SSPIF es determinada.Durante la transmisión, el SSPBUF no es doublebuffered.Uno de escritura para SSPBUF le escribirá a ambos SSPBUFY SSPSR

Page 3: I2C Mode

bit 7 SMP: Slew Rate Control bit Rapidez de respuesta Control mordióIn Master or Slave mode: En amo o el modo del Esclavo:1 = Slew rate control disabled for Standard Speed mode (100 kHz)__ El control de rapidez de respuesta deshabilitado para el modo Estándar (100 kHz) de Velocidad0 = Slew rate control enabled for High-Speed mode (400 kHz)bit 6 CKE: SMBus Select bitIn Master or Slave mode:1 = Enable SMBus specific inputs__Permita SMBus aportes específicos0 = Disable SMBus specific inputsbit 5 D/A: Data/Address bitIn Master mode:Reserved.In Slave mode:1 = Indicates that the last byte received or transmitted was data_Señala que el último byte recibido o transmitido fue información0 = Indicates that the last byte received or transmitted was address___ Señala que el último byte recibido o transmitido fue direcciónbit 4 P: Stop bit(1)

1 = Indicates that a Stop bit has been detected last__ Señala que un bit de parada ha sido detectado último0 = Stop bit was not detected lastbit 3 S: Start bit(1)

1 = Indicates that a Start bit has been detected last__ Señala que un bit de arranque ha sido detectado último0 = Start bit was not detected lastbit 2 R/W: Read/Write Information bit (I2C mode only)(2,3)

In Slave mode:1 = Read0 = WriteIn Master mode:1 = Transmit is in progress0 = Transmit is not in progressbit 1 UA: Update Address bit (10-Bit Slave mode only)__ Actualización Address mordió (el modo del Esclavo de 10 pedacitos sólo)1 = Indicates that the user needs to update the address in the SSPADD register__ Señala que las necesidades del usuario para actualizar la dirección en el SSPADD registran0 = Address does not need to be updated__ La dirección no necesita estar actualizadabit 0 BF: Buffer Full Status bitIn Transmit mode:1 = SSPBUF is full0 = SSPBUF is empty__ VacíeseIn Receive mode:1 = SSPBUF is full (does not include the ACK and Stop bits)0 = SSPBUF is empty (does not include the ACK and Stop bits)

Note 1: This bit is cleared on Reset and when SSPEN is cleared.2: This bit holds the R/W bit information following the last address match. This bit is only valid from theaddress match to the next Start bit, Stop bit or not ACK bit.3: ORing this bit with SEN, RSEN, PEN, RCEN or ACKEN will indicate if the MSSP is in Active mode.

Nota 1: Este pedacito es despejado en la Reanudación y cuándo SSPEN es descongestionado.2: Estos agarres del pedacito el grupo de seguidores de información del pedacito de la / W de Acto Inapropiado el último fósforo de la dirección. Este pedacito es sólo válido de loEl fósforo de la dirección para el siguiente bit de arranque, el Alto mordió o no ACK mordió.3: El ORing que esto mordió con SEN, RSEN, PLUMA, RCEN o ACKEN indicará si el MSSP está en modo En Ejecución

Page 4: I2C Mode

bit 7 WCOL: Write Collision Detect bit___ La colisión de escritura Detect mordióIn Master Transmit mode:1 = A write to the SSPBUF register was attempted while the I2C conditions were not valid for atransmission to be started (must be cleared in software)___Uno de escritura para el registro SSPBUF fue intentado mientras las condiciones I2C no fueron válidas para unoLa transmisión a ser iniciada (debe ser aclarado en software)0 = No collisionIn Slave Transmit mode:1 = The SSPBUF register is written while it is still transmitting the previous word (must be cleared insoftware)___ El registro SSPBUF está escrito mientras todavía transmite la palabra previa (debe ser aclarado adentroEl software)0 = No collisionIn Receive mode (Master or Slave modes):This is a “don’t care” bit.bit 6 SSPOV: Receive Overflow Indicator bit___ Reciba pedacito del Señalizador de RebalseIn Receive mode:1 = A byte is received while the SSPBUF register is still holding the previous byte (must be cleared insoftware)___ Un byte es recibido mientras el registro SSPBUF todavía sustenta el byte previo (debe ser aclarado en software)0 = No overflowIn Transmit mode:This is a “don’t care” bit in Transmit mode.bit 5 SSPEN: Master Synchronous Serial Port Enable bit(1)

1 = Enables the serial port and configures the SDA and SCL pins as the serial port pins0 = Disables serial port and configures these pins as I/O port pinsbit 4 CKP: SCK Release Control bit___ SCK Suelte pedacito de ControlIn Slave mode:1 = Releases clock__ Las liberaciones registran el tiempo0 = Holds clock low (clock stretch), used to ensure data setup time___Los agarres cronometran punto bajo (la elasticidad del reloj), usó asegurar tiempo de instalación de datosIn Master mode:Unused in this mode.___ Sin uso en este modo.bit 3-0 SSPM3:SSPM0: Master Synchronous Serial Port Mode Select bits(2)

1111 = I2C Slave mode, 10-bit address with Start and Stop bit interrupts enabledEl modo I2C Slave, la dirección de 10 pedacitos con Principio e interrupciones del pedacito Stop habilitadas1110 = I2C Slave mode, 7-bit address with Start and Stop bit interrupts enabled1011 = I2C Firmware Controlled Master mode (Slave Idle)I2C Firmware Controlled Domine con Maestría modo (el Esclavo Idle)1000 = I2C Master mode, clock = FOSC/(4 * (SSPADD + 1))0111 = I2C Slave mode, 10-bit address0110 = I2C Slave mode, 7-bit addressBit combinations not specifically listed here are either reserved or implemented in SPI mode only.Las combinaciones de bits no específicamente listadas aquí son uno u otro reservó o implementó en el modo SPI sólo.Note 1: When enabled, the SDA and SCL pins must be properly configured as inputs or outputs.Nota 1: Estando habilitados, la CED y los alfileres SCL deben ser de verdad configurados como aportes o salidas.

bit 7 GCEN: General Call Enable bit (Slave mode only)La llamada general Enable mordió (el modo del Esclavo sólo)1 = Enables interrupt when a general call address (0000h) is received in the SSPSRPermite interrupción cuando una dirección general (0000h) de llamada es recibida en el SSPSR0 = General call address disabled.bit 6 ACKSTAT: Acknowledge Status bit (Master Transmit mode only)Agradezco pedacito de Estatus (el modo Amo Transmit sólo)Acknowledge=reconocer1 = Acknowledge was not received from slaveAcuse recibo no fue recibido de esclavo

Page 5: I2C Mode

0 = Acknowledge was received from slavebit 5 ACKDT: Acknowledge Data bit (Master Receive mode only)(2)

Admito bit de datos (el modo Amo Receive sólo) (2)

1 = Not AcknowledgeNo loreconoce no lo admite0 = Acknowledgebit 4 ACKEN: Acknowledge Sequence Enable bit (Master Receive mode only)(1)

1 = Initiates Acknowledge sequence on SDA and SCL pins and transmit ACKDT data bit. Automaticallycleared by hardware.Los iniciados Admiten secuencia en alfileres de CED y SCL y transmiten bit de datos ACKDT. Automáticamente aclarado por hardware.0 = Acknowledge sequence Idle_Reconocimiento de la secuencia terminadabit 3 RCEN: Receive Enable bit (Master mode only)(1)

1 = Enables Receive mode for I2C0 = Receive Idlebit 2 PEN: Stop Condition Enable bit (Master mode only)(1)

1 = Initiates Stop condition on SDA and SCL pins. Automatically cleared by hardware.Los iniciados Detienen condición en alfileres de CED y SCL. Automáticamente aclarado por hardware.0 = Stop condition Idlebit 1 RSEN: Repeated Start Condition Enable bit (Master mode only)(1)

Repitió el rato de Condición de Principio Enable (el modo amo sólo) (1)

1 = Initiates Repeated Start condition on SDA and SCL pins. Automatically cleared by hardware.Los iniciados Repitieron condición de Principio en alfileres de CED y SCL. Automáticamente aclarado por hardware.0 = Repeated Start condition Idlebit 0 SEN: Start Condition Enable/Stretch Enable bit(1)

La Condición de Principio Permite / Elasticidad PermitaIn Master mode:1 = Initiates Start condition on SDA and SCL pins. Automatically cleared by hardware.0 = Start condition IdleLa condición de principio IdleIn Slave mode:1 = Clock stretching is enabled for both slave transmit and slave receive (stretch enabled)El estirar relojes está habilitado para ambos esclavo transmita y trabaje como esclavo reciba (la elasticidad habilitada)0 = Clock stretching is disabledStretching====estitamientoNote 1: For bits ACKEN, RCEN, PEN, RSEN, SEN: If the I2C module is not in the Idle mode, these bits may not beset (no spooling) and the SSPBUF may not be written (or writes to the SSPBUF are disabled).2: Value that will be transmitted when the user initiates an Acknowledge sequence at the end of a receiveNota 1: Para pedacitos ACKEN, RCEN, ESCRIBA, RSEN, SEN: Si el módulo I2C no está en el modo Sin Valor, estos pedacitos no lo pueden hacerEl set (ninguna realización de operaciones periféricas simultáneas) y el SSPBUF no pueden ser a los que se escribió (o le escribe al SSPBUF está discapacitado).2: El valor que será transmitido cuando el usuario inicie una secuencia Acknowledge al final de uno reciba.

17.4.2 OPERATIONThe MSSP module functions are enabled by settingMSSP Enable bit, SSPEN (SSPCON1<5>).The SSPCON1 register allows control of the I2Coperation. Four mode selection bits (SSPCON1<3:0>)allow one of the following I2C modes to be selected:• I2C Master mode clock• I2C Slave mode (7-bit address)• I2C Slave mode (10-bit address)• I2C Slave mode (7-bit address) with Start andStop bit interrupts enabled• I2C Slave mode (10-bit address) with Start andStop bit interrupts enabled• I2C Firmware Controlled Master mode, slave is IdleSelection of any I2C mode with the SSPEN bit set,forces the SCL and SDA pins to be open-drain,provided these pins are programmed to inputs by

Page 6: I2C Mode

setting the appropriate TRISC bits. To ensure properoperation of the module, pull-up resistors must beprovided externally to the SCL and SDA pins.

La OPERACIÓN del 17.4.2Las funciones de módulo MSSP están habilitadas sedimentándoseMSSP Faculte pedacito, SSPEN (SSPCON1<5 > ).El registro del SSPCON1 consiente control del I2CLa operación. Cuatro pedacitos de selección de modo (SSPCON1<3:0 > )Permítale uno de los siguientes modos I2C ser seleccionado:•†I2C Amaestre reloj de modo•†El modo I2C Slave (la dirección de 7 pedacitos)•†El modo I2C Slave (la dirección de 10 pedacitos)•†El modo I2C Slave (la dirección de 7 pedacitos) con Principio yLas interrupciones del bit de parada habilitadas•†El modo I2C Slave (la dirección de 10 pedacitos) con Principio yLas interrupciones del bit de parada habilitadas•†I2C Firmware Controlled Domine con Maestría modo, el esclavo está ociosoLa selección de cualquier modo I2C con el SSPEN mordió set,Fuerzas el SCL y alfileres de CED para ser tubo de desagüe de claro,Siempre y cuando estos alfileres están programados para los aportes por ahíEl trasfondo los pedacitos correctos TRISC. Para asegurar correctoLa operación del módulo, resistores de actuación debe serSiempre y cuando externamente para el SCL y alfileres de CED.

17.4.3 SLAVE MODEIn Slave mode, the SCL and SDA pins must be configuredas inputs (TRISC<4:3> set). The MSSP modulewill override the input state with the output data whenrequired (slave-transmitter).The I2C Slave mode hardware will always generate aninterrupt on an address match. Through the modeselect bits, the user can also choose to interrupt onStart and Stop bitsWhen an address is matched, or the data transfer afteran address match is received, the hardware automaticallywill generate the Acknowledge (ACK) pulseand load the SSPBUF register with the received valuecurrently in the SSPSR register.Any combination of the following conditions will causethe MSSP module not to give this ACK pulse:• The Buffer Full bit, BF (SSPSTAT<0>), was setbefore the transfer was received.• The overflow bit, SSPOV (SSPCON1<6>), wasset before the transfer was received.In this case, the SSPSR register value is not loadedinto the SSPBUF, but bit, SSPIF (PIR1<3>), is set. TheBF bit is cleared by reading the SSPBUF register, whilebit, SSPOV, is cleared through software.The SCL clock input must have a minimum high andlow for proper operation. The high and low times of theI2C specification, as well as the requirement of theMSSP module, are shown in timing parameter 100 andparameter 101.

EL MODO DEL ESCLAVO DEL 17.4.3En Esclavo el modo, el SCL y alfileres de CED deben ser configuradosComo los aportes (TRISC < 4:3 > se sedimentó). El módulo MSSPPasará sobre la disposición del aporte estatal con los datos de salida cuándoRequerido (el transmisor de esclavo).El hardware de modo I2C Slave siempre generará unoInterrumpa en un fósforo de la dirección. A través del modoHaga una selección pedacitos, el usuario también puede elegir interrumpir adelanteEl principio y los bits de paradaCuando una dirección es a la que se correspondió, o los datos se trasladan despuésUn fósforo de la dirección es recibido, el hardware automáticamente

Page 7: I2C Mode

Generará el pulso Acknowledge (el reconocimiento)Y la carga el registro SSPBUF con el valor recibidoActualmente en el registro SSPSR.Cualquier combinación de las siguientes condiciones dará lugar a queEl módulo MSSP para no dar este pulso de reconocimiento:•†El Amortiguador Full pedacito, BF (SSPSTAT < 0 > ), estaba listoAntes de que el reembarque fuese recibido.•†El rebalse mordido, SSPOV (SSPCON1<6 > ), fueSediméntese antes de que el reembarque fuese recibido.En este caso, el valor de registro SSPSR no es cargadoEn el SSPBUF, pero se muerde, SSPIF (PIR1<3 > ), está listo. LoEl pedacito BF es despejado leyendo el registro SSPBUF, mientrasEl pedacito, SSPOV, es descongestionado a través de software.El aporte del reloj SCL debe tener un mínimo a gran altura yMuja para la operación correcta. Las veces altas y bajas de loLa especificación I2C, así como también el requisito de loEl módulo MSSP, es demostrado en parámetro de oportunidad del momento 100 yEl parámetro 101.

17.4.3.1 AddressingOnce the MSSP module has been enabled, it waits fora Start condition to occur. Following the Start condition,the 8 bits are shifted into the SSPSR register. All incomingbits are sampled with the rising edge of the clock(SCL) line. The value of register SSPSR<7:1> iscompared to the value of the SSPADD register. Theaddress is compared on the falling edge of the eighthclock (SCL) pulse. If the addresses match and the BFand SSPOV bits are clear, the following events occur:1. The SSPSR register value is loaded into theSSPBUF register.2. The Buffer Full bit, BF, is set.3. An ACK pulse is generated.4. MSSP Interrupt Flag bit, SSPIF (PIR1<3>), isset (interrupt is generated, if enabled) on thefalling edge of the ninth SCL pulse.In 10-Bit Addressing mode, two address bytes need tobe received by the slave. The five Most Significant bits(MSbs) of the first address byte specify if this is a 10-bitaddress. Bit R/W (SSPSTAT<2>) must specify a writeso the slave device will receive the second addressbyte. For a 10-bit address, the first byte would equal‘11110 A9 A8 0’, where ‘A9’ and ‘A8’ are thetwo MSbs of the address. The sequence of events for10-bit addressing is as follows, with steps 7 through 9for the slave-transmitter:1. Receive first (high) byte of address (bits SSPIF,BF and UA (SSPSTAT<1>) are set).2. Update the SSPADD register with second (low)byte of address (clears bit, UA, and releases theSCL line).3. Read the SSPBUF register (clears bit, BF) andclear flag bit, SSPIF.4. Receive second (low) byte of address (bits,SSPIF, BF and UA, are set).5. Update the SSPADD register with the first (high)byte of address. If match releases SCL line, thiswill clear bit, UA.6. Read the SSPBUF register (clears bit, BF) andclear flag bit, SSPIF.7. Receive Repeated Start condition.8. Receive first (high) byte of address (bits, SSPIFand BF, are set).9. Read the SSPBUF register (clears bit, BF) andclear flag bit, SSPIF.

Page 8: I2C Mode

El direccionamiento del 17.4.3.1Una vez que el módulo MSSP ha estado habilitado, espera paraUna condición de Principio a ocurrir. Después de la condición de Principio,Los 8 pedacitos son intercambiados en el registro SSPSR. Todo entranteLos pedacitos son probados con el borde ascendente del reloj(SCL) la línea. El valor de registro SSPSR < 7:1 > esComparado por valor del registro SSPADD. LoLa dirección es comparada en el borde descendente del octavoEl pulso del reloj (SCL). Si las direcciones equivalen y el BFY los pedacitos SSPOV están claros, los siguientes acontecimientos ocurren:1. El valor de registro SSPSR está forrado en loSSPBUF regístrese.2. El Amortiguador Full pedacito, BF, está listo.3. Un pulso de reconocimiento es generado.4. MSSP Córtele el Hilo al rato de la Bandera, SSPIF (PIR1<3 > ), esSediméntese (la interrupción es generada, si es permitida) adelante loEl borde descendente del noveno pulso SCL.En modo de 10 pedacitos que Le Dirige la Palabra a, dos bytes de la dirección necesitanSer recibido por el esclavo. Los cinco Bits Más Significativos(MSbs) del primer byte de la dirección especifique si esto es uno de 10 pedacitosLa dirección. Acto Inapropiado mordido / W (SSPSTAT < 2 > ) debe especificar uno de escrituraAsí es que el dispositivo del esclavo recibirá la segunda direcciónEl byte. Para una dirección de 10 pedacitos, el primer byte igualaría_ 11110 A9 A8 0 _, donde _ A9 _ y _ A8 _ son loDos MSbs de la dirección. La secuencia de acontecimientos paraEl direccionamiento de 10 pedacitos es como sigue, con pasos 7 a través de 9Para el transmisor de esclavo:1. Reciba primer (pedacitos SSPIF, (a gran altura) byte de direcciónBF y UA (SSPSTAT < 1 > ) están listos).2. Actualice el registro SSPADD con en segundo lugar (el punto bajo)El byte de dirección (los claros mordidos, UA, y liberaciones loLa línea SCL).3. Lea al SSPBUF el registro (los claros mordidos, BF) yAclare bit indicador, SSPIF.4. Reciba segundo (los pedacitos, (el punto bajo) byte de direcciónSSPIF, BF y UA, estén listos).5. Actualice el registro SSPADD con la primera parte (a gran altura)El byte de dirección. Si el fósforo suelta a SCL aplíquele delineador, estoDescongestionará mordido, UA.6. Lea al SSPBUF el registro (los claros mordidos, BF) yAclare bit indicador, SSPIF.7. Reciba Repetida condición de Principio.8. Reciba primer (los pedacitos, SSPIF (a gran altura) byte de direcciónY BF, estén listos).9. Lea al SSPBUF el registro (los claros mordidos, BF) yAclare bit indicador, SSPIF.

17.4.3.2 ReceptionWhen the R/W bit of the address byte is clear and anaddress match occurs, the R/W bit of the SSPSTATregister is cleared. The received address is loaded intothe SSPBUF register and the SDA line is held low(ACK).When the address byte overflow condition exists, thenthe no Acknowledge (ACK) pulse is given. An overflowcondition is defined as either bit, BF (SSPSTAT<0>), isset, or bit, SSPOV (SSPCON1<6>), is set.An MSSP interrupt is generated for each data transferbyte. Flag bit, SSPIF (PIR1<3>), must be cleared insoftware. The SSPSTAT register is used to determinethe status of the byte.If SEN is enabled (SSPCON2<0> = 1), RC3/SCK/SCLwill be held low (clock stretch) following each datatransfer. The clock must be released by setting bit,CKP (SSPCON<4>). See Section 17.4.4 “ClockStretching” for more detail.

Page 9: I2C Mode

La recepción del 17.4.3.2Cuando la / W de Acto Inapropiado mordida del byte de la dirección está clara y unoLa dirección que el fósforo ocurre, la / W de Acto Inapropiado mordida del SSPSTATEl registro es aclarado. La dirección recibida está forrada enEl registro SSPBUF y la CED le aplican delineador a es punto bajo sustentado(ACK).Cuando la condición de rebalse de byte de la dirección existe, luegoEl ningún pulso Acknowledge (el reconocimiento) es dado. Un rebalseLa condición es definida como ya sea pedacito, BF (SSPSTAT < 0 > ), esEl pedacito determinado, o, SSPOV (SSPCON1<6 > ), está listo.Una interrupción MSSP es generada para cada reembarque de datosEl byte. El bit indicador, SSPIF (PIR1<3 > ), debe ser descongestionado adentroEl software. El registro SSPSTAT se usa para determinarEl estatus del byte.Si SEN es facultado (SSPCON2<0 > = 1), RC3/SCK/SCLSerá punto bajo sustentado (la elasticidad del reloj) siguiendo cada informaciónEl reembarque. El reloj debe ser soltado por pedacito poniente,CKP (SSPCON < 4 > ). Vea Sección 17.4.4 " el RelojEl estiramiento " para más detalle.

17.4.3.3 TransmissionWhen the R/W bit of the incoming address byte is setand an address match occurs, the R/W bit of theSSPSTAT register is set. The received address isloaded into the SSPBUF register. The ACK pulse willbe sent on the ninth bit and the RC3/SCK/SCL pin isheld low regardless of SEN (see Section 17.4.4“Clock Stretching” for more detail). By stretching theclock, the master will be unable to assert another clockpulse until the slave is done preparing the transmitdata. The transmit data must be loaded into theSSPBUF register which also loads the SSPSR register.Then the RC3/SCK/SCL pin should be enabled by settingbit, CKP (SSPCON1<4>). The eight data bits areshifted out on the falling edge of the SCL input. Thisensures that the SDA signal is valid during the SCLhigh time (Figure 17-9).

La transmisión del 17.4.3.3Cuando la / W de Acto Inapropiado mordida del byte entrante de la dirección está colocadaY una dirección que el fósforo ocurre, la / W de Acto Inapropiado mordida de loEl registro SSPSTAT es determinado. La dirección recibida esCargado en el registro SSPBUF. El pulso de reconocimiento lo haráSer remitido el noveno pedacito y el alfiler del RC3/SCK/SCL esEl punto bajo sustentado a pesar de SEN (vea 17.4.4 de Sección"El reloj Desperezándose" para más detalle). Desperezándose loEl reloj, el amo será incapaz de afirmar otro relojPulse hasta que el esclavo termine preparándose lo transmitaLos datos. Lo transmite datos deben estar forrados en loSSPBUF regístrese cuál también carga al SSPSR se registra.Luego el alfiler del RC3/SCK/SCL debería estar habilitado sedimentándoseEl pedacito, CKP (SSPCON1<4 > ). Los ocho bits de datos sonIntercambiado apagado en el borde descendente del aporte SCL. EstoAsegura que la señal de CED es válida durante el SCLEl tiempo alto (la Figura 17-9).

The ACK pulse from the master-receiver is latched onthe rising edge of the ninth SCL input pulse. If the SDAline is high (not ACK), then the data transfer iscomplete. In this case, when the ACK is latched by theslave, the slave logic is reset and the slave monitors foranother occurrence of the Start bit. If the SDA line waslow (ACK), the next transmit data must be loaded intothe SSPBUF register. Again, the RC3/SCK/SCL pinmust be enabled by setting bit CKP.An MSSP interrupt is generated for each data transferbyte. The SSPIF bit must be cleared in software and

Page 10: I2C Mode

the SSPSTAT register is used to determine the statusof the byte. The SSPIF bit is set on the falling edge ofthe ninth clock pulse.

El pulso de reconocimiento del aparato receptor maestro es al que se puso el pasador adelanteEl borde ascendente del noveno pulso de aporte SCL. Si la CEDLa línea es alta (no el reconocimiento), luego los datos se trasladan esComplete. En este caso, cuando el reconocimiento es al que se puso el pasador por ahí loEsclavo, la lógica del esclavo es reanudación y el esclavo monitorea paraOtra ocurrencia del bit de arranque. Si la línea de CED fueEl punto bajo (el reconocimiento), lo siguiente transmiten datos deben estar forrados enEl registro SSPBUF. Otra vez, el alfiler del RC3/SCK/SCLDebe estar habilitado colocando a CKP mordido.Una interrupción MSSP es generada para cada reembarque de datosEl byte. El pedacito SSPIF debe ser despejado en software yEl registro SSPSTAT se usa para determinar el estatusDel byte. El pedacito SSPIF es colocado en el borde descendente deEl noveno pulso del reloj.

Page 11: I2C Mode

17.4.4 CLOCK STRETCHINGBoth 7-bit and 10-bit Slave modes implementautomatic clock stretching during a transmit sequence.The SEN bit (SSPCON2<0>) allows clock stretching tobe enabled during receives. Setting SEN will causethe SCL pin to be held low at the end of each datareceive sequence.

EL RELOJ DEL 17.4.4 DESPEREZÁNDOSEAmbos modos del Esclavo de 7 pedacitos y de 10 pedacitos implementanEl reloj automático desperezándose durante uno transmite secuencia.El pedacito SEN (SSPCON2<0 > ) consiente reloj desperezándose paraEstar habilitado durante recibe. SEN poniente dará lugar a queEl alfiler SCL para ser sustentó punto bajo al final de cada datosReciba secuencia.

17.4.4.1 Clock Stretching for 7-Bit SlaveReceive Mode (SEN = 1)

Page 12: I2C Mode

In 7-Bit Slave Receive mode, on the falling edge of theninth clock at the end of the ACK sequence if the BFbit is set, the CKP bit in the SSPCON1 register isautomatically cleared, forcing the SCL output to beheld low. The CKP being cleared to ‘0’ will assert theSCL line low. The CKP bit must be set in the user’sISR before reception is allowed to continue. By holdingthe SCL line low, the user has time to service the ISRand read the contents of the SSPBUF before themaster device can initiate another receive sequence.This will prevent buffer overruns from occurring (seeFigure 17-13).

17.4.4.1 Clock Desperezándose para Esclavo de 7 PedacitosReciba Modo (SEN = 1)En el modo del Esclavo Receive de 7 pedacitos, en el borde descendente de loEl noveno reloj al final de la secuencia de reconocimiento si el BFEl pedacito está colocado, el CKP mordió en el registro del SSPCON1 esEl forzamiento automáticamente aclarado, la salida SCL a serEl punto bajo sustentado. El CKP siendo descongestionado para _ 0 _ afirmará loSCL aplíquele delineador al punto bajo. El pedacito CKP debe ser incrustado en las _ s del usuarioISR antes de la recepción tiene permiso de continuar. Teniendo aplicaciónEl punto bajo de la línea SCL, el usuario tiene tiempo para reparar al ISRY la lectura el contenido del SSPBUF antes de loEl dispositivo maestro puede iniciar otro recibe secuencia.Esto impedirá sobreproducciones del amortiguador de ocurrir (veaLa Figura 17-13).

Note 1: If the user reads the contents of theSSPBUF before the falling edge of theninth clock, thus clearing the BF bit, theCKP bit will not be cleared and clockstretching will not occur.2: The CKP bit can be set in softwareregardless of the state of the BF bit. Theuser should be careful to clear the BF bitin the ISR before the next receivesequence in order to prevent an overflowcondition.

Nota 1: Si el usuario lee el contenido de loSSPBUF antes del borde descendente de loEl noveno reloj, así despejándose el BF mordió, loEl pedacito CKP no será despejado y cronometraráEl estiramiento no ocurrirá.2: El pedacito CKP puede ser incrustado en softwareA pesar del estado del pedacito BF. LoEl usuario debería tener el cuidado de despejarse el pedacito BFEn el ISR antes de lo siguiente recibaLa secuencia para impedir un rebalseLa condición.

17.4.4.2 Clock Stretching for 10-Bit SlaveReceive Mode (SEN = 1)In 10-Bit Slave Receive mode during the addresssequence, clock stretching automatically takes placebut CKP is not cleared. During this time, if the UA bit isset after the ninth clock, clock stretching is initiated.The UA bit is set after receiving the upper byte of the10-bit address and following the receive of the secondbyte of the 10-bit address with the R/W bit cleared to‘0’. The release of the clock line occurs upon updatingSSPADD. Clock stretching will occur on each datareceive sequence as described in 7-bit mode.

17.4.4.2 Clock Desperezándose para Esclavo de 10 Pedacitos

Page 13: I2C Mode

Reciba Modo (SEN = 1)En el modo del Esclavo Receive de 10 pedacitos durante la direcciónLa secuencia, el reloj desperezándose automáticamente toma lugarPero CKP no es descongestionado. Durante esta vez, si la UA mordió esSediméntese después del noveno reloj, el estirar relojes es iniciado.El rato UA le siguió la pista a recibir el byte superior de loLa dirección de 10 pedacitos y después de lo reciba del segundoEl byte de la dirección de 10 pedacitos con el pedacito de la / W de Acto Inapropiado aclarado para_ 0. La liberación de la línea del reloj ocurre al actualizarSSPADD. El estirar relojes ocurrirá en cada datosReciba secuencia tan descrita en el modo de 7 pedacitos.

Note: If the user polls the UA bit and clears it byupdating the SSPADD register before thefalling edge of the ninth clock occurs and ifthe user hasn’t cleared the BF bit by readingthe SSPBUF register before that time,then the CKP bit will still NOT be assertedlow. Clock stretching on the basis of thestate of the BF bit only occurs during adata sequence, not an address sequence.

Nota: Si el usuario da el voto la UA mordió y claros eso por ahíActualizando el registro SSPADD antes de loEl borde descendente del noveno reloj ocurre y siEl usuario hasn t se despejó que el BF mordió leyendoEl registro SSPBUF antes de esa vez,Luego el pedacito CKP no aquietará sea a lo que se hizo valerEl punto bajo. El reloj desperezándose con base en loEl estado del pedacito BF sólo ocurre durante unoLos datos ponen en secuencia, no una secuencia de la dirección.

17.4.4.3 Clock Stretching for 7-Bit SlaveTransmit Mode7-Bit Slave Transmit mode implements clock stretchingby clearing the CKP bit after the falling edge of theninth clock if the BF bit is clear. This occurs regardlessof the state of the SEN bit.The user’s ISR must set the CKP bit before transmissionis allowed to continue. By holding the SCL linelow, the user has time to service the ISR and load thecontents of the SSPBUF before the master device caninitiate another transmit sequence (see Figure 17-9).

17.4.4.3 Clock Desperezándose para Esclavo de 7 PedacitosTransmita ModoEl reloj de implementos de modo del Esclavo Transmit de 7 pedacitos desperezándoseDespejándose el CKP mordió después del borde descendente de loEl noveno reloj si el BF mordido está claro. Esto ocurre independientementeDel estado del pedacito SEN.La usuaria _ s ISR deben sedimentarse que el CKP mordió antes de la transmisiónTiene permiso de continuar. Sujetando la línea SCLEl punto bajo, el usuario tiene tiempo para reparar al ISR y carga loEl contenido del SSPBUF antes del dispositivo maestro puedeInicie otro transmite secuencia (vea a Figure 17-9).

Note 1: If the user loads the contents of SSPBUF,setting the BF bit before the falling edge ofthe ninth clock, the CKP bit will not becleared and clock stretching will not occur.2: The CKP bit can be set in softwareregardless of the state of the BF bit.

Nota 1: Si el usuario carga el contenido de SSPBUF,Sedimentarse el BF mordió antes del borde descendente deEl noveno reloj, el pedacito CKP no será

Page 14: I2C Mode

El estirar aclarado de relojes y no ocurrirá.2: El pedacito CKP puede ser incrustado en softwareA pesar del estado del pedacito BF.

17.4.4.4 Clock Stretching for 10-Bit SlaveTransmit ModeIn 10-Bit Slave Transmit mode, clock stretching iscontrolled during the first two address sequences bythe state of the UA bit, just as it is in 10-Bit SlaveReceive mode. The first two addresses are followedby a third address sequence which contains the highorderbits of the 10-bit address and the R/W bit set to‘1’. After the third address sequence is performed, theUA bit is not set, the module is now configured inTransmit mode and clock stretching is controlled bythe BF flag as in 7-Bit Slave Transmit mode (seeFigure 17-11).

17.4.4.4 Clock Desperezándose para Esclavo de 10 PedacitosTransmita ModoEn el modo del Esclavo Transmit de 10 pedacitos, el estirar relojes esControlado durante las primeras dos secuencias de la dirección por ahíEl estado de la UA mordió, tal como está en Esclavo de 10 pedacitosReciba modo. Las primeras dos direcciones son seguidasPor una tercera secuencia de la dirección que contiene el highorderLos pedacitos de la dirección de 10 pedacitos y la / W de Acto Inapropiado mordieron set para_ 1. Después de que la tercera secuencia de la dirección sea realizada, loEl pedacito UA no está colocado, el módulo es ahora configurado adentroTransmita modo y el estirar relojes se controla por ahíLa bandera BF tan en el modo del Esclavo Transmit de 7 pedacitos (veaLa Figura 17-11).

17.4.4.5 Clock Synchronization andthe CKP bitWhen the CKP bit is cleared, the SCL output is forcedto ‘0’. However, clearing the CKP bit will not assert theSCL output low until the SCL output is alreadysampled low. Therefore, the CKP bit will not assert theSCL line until an external I2C master device has already asserted the SCL line. The SCL output willremain low until the CKP bit is set and all otherdevices on the I2C bus have deasserted SCL. Thisensures that a write to the CKP bit will not violate theminimum high time requirement for SCL (seeFigure 17-12).

La Sincronización del Reloj del 17.4.4.5 yEl CKP mordióCuando el CKP mordido es descongestionado, la salida SCL es obtenida a la fuerzaPara _ 0. Sin embargo, descongestionar al CKP mordido no afirmará loLa salida SCL baja hasta la salida SCL está yaEl punto bajo probado. Por consiguiente, el pedacito CKP no afirmará loLa línea SCL hasta un dispositivo maestro I2C externo ya ha hecho valer la línea SCL. La salida SCL lo haráPermanezca bajo hasta que el CKP mordido esté listo y demás otroLos dispositivos en el autobús I2C tienen a deasserted SCL. EstoAsegura que uno de escritura para el pedacito CKP no violará loEl requisito de tiempo alto mínimo para SCL (veaLa Figura 17-12).

Page 15: I2C Mode
Page 16: I2C Mode

17.4.5 GENERAL CALL ADDRESSSUPPORTThe addressing procedure for the I2C bus is such thatthe first byte after the Start condition usuallydetermines which device will be the slave addressed bythe master. The exception is the general call addresswhich can address all devices. When this address isused, all devices should, in theory, respond with anAcknowledge.The general call address is one of eight addressesreserved for specific purposes by the I2C protocol. Itconsists of all ‘0’s with R/W = 0.The general call address is recognized when theGeneral Call Enable bit, GCEN, is enabled(SSPCON2<7> is set). Following a Start bit detect,8 bits are shifted into the SSPSR and the address iscompared against the SSPADD. It is also compared tothe general call address and fixed in hardware.

LA DIRECCIÓN DE LLAMADA DEL GENERAL DEL 17.4.5El SOPORTEEl procedimiento de direccionamiento para el autobús I2C es tal queEl primer byte después de la condición de Principio usualmenteDetermina cuál dispositivo será el esclavo tratado segúnEl amo. La excepción es la dirección general de llamadaQue pueda poner la dirección en todos los dispositivos. Cuando esta dirección esUsados, todos los dispositivos, en teoría, deberían responder con unoAcuse recibo.La dirección general de llamada es una de ocho direccionesConfidencial para los propósitos específicos por el protocolo I2C. EsoConsta de todas las _ 0 _ s con Acto Inapropiado / W = 0.La dirección general de llamada es reconocida cuando loLa llamada general Enable pedacito, GCEN, es facultada(SSPCON2<7 está listo). Después de un bit de arranque detecte,8 pedacitos son intercambiados en el SSPSR y la dirección esComparado en contra del SSPADD. Es también al que se comparóLa dirección general de llamada y fijo en hardware.

If the general call address matches, the SSPSR istransferred to the SSPBUF, the BF flag bit is set (eighthbit) and on the falling edge of the ninth bit (ACK bit), theSSPIF interrupt flag bit is set.

Page 17: I2C Mode

When the interrupt is serviced, the source for theinterrupt can be checked by reading the contents of theSSPBUF. The value can be used to determine if theaddress was device specific or a general call address.In 10-bit mode, the SSPADD is required to be updatedfor the second half of the address to match and the UAbit (SSPSTAT<1>) is set. If the general call address issampled when the GCEN bit is set, while the slave isconfigured in 10-Bit Addressing mode, then the secondhalf of the address is not necessary, the UA bit will notbe set and the slave will begin receiving data after theAcknowledge (Figure 17-15).

Si la dirección general de llamada equivale, el SSPSR esCedida para el SSPBUF, la bandera BF mordida está colocada (el octavoEl pedacito) y en el borde descendente del pedacito del noveno (el reconocimiento mordido), loEl bit indicador de interrupción SSPIF está colocado.Cuando la interrupción es reparada, la fuente para loLa interrupción puede ser comprobada leyendo el contenido de loSSPBUF. El valor puede usarse para determinar si loLa dirección fue dispositivo específico o una dirección general de llamada.En el modo de 10 pedacitos, el SSPADD está obligado a ponerse al corrientePara que el segundo la mitad de dirección correspondan y la UAEl pedacito (SSPSTAT < 1 > ) está colocado. Si la dirección general de llamada esProbado cuando el GCEN mordido está listo, mientras el esclavo lo haceConfigurado en modo de 10 pedacitos que Le Dirige la Palabra a, luego el segundoLa mitad de dirección no es menester, la UA mordida no lo haráEstar listos y el esclavo empezará a recibiendo datos después de loAcuse Recibo (la Figura 17-15).

17.4.6 MASTER MODEMaster mode is enabled by setting and clearing theappropriate SSPM bits in SSPCON1 and by setting theSSPEN bit. In Master mode, the SCL and SDA linesare manipulated by the MSSP hardware.Master mode of operation is supported by interruptgeneration on the detection of the Start and Stopconditions. The Stop (P) and Start (S) bits are clearedfrom a Reset or when the MSSP module is disabled.Control of the I2C bus may be taken when the P bit isset, or the bus is Idle, with both the S and P bits clear.In Firmware Controlled Master mode, user codeconducts all I2C bus operations based on Start andStop bit conditions.Once Master mode is enabled, the user has six

Page 18: I2C Mode

options.1. Assert a Start condition on SDA and SCL.2. Assert a Repeated Start condition on SDA andSCL.3. Write to the SSPBUF register initiatingtransmission of data/address.4. Configure the I2C port to receive data.5. Generate an Acknowledge condition at the endof a received byte of data.6. Generate a Stop condition on SDA and SCL.

EL MODO DEL AMO DEL 17.4.6El modo maestro está habilitado sedimentándose y despejándose loAsigne pedacitos SSPM en SSPCON1 y sedimentándose loSSPEN mordió. En el modo amo, el SCL y líneas de CEDEs manipulado por el hardware MSSP.La modalidad de operación maestra es soportada por la interrupciónLa generación en la detección del Principio y el AltoLas condiciones. El Alto (P) y pedacitos de Principio (S) son despejadosDe una Reanudación o cuando el MSSP el módulo está deshabilitado.El control del autobús I2C puede ser tomado cuando el pedacito de la P esEl set, o el autobús está Desocupado, con ambos la S y los pedacitos P se descongestionan.En el modo Amo Controlado Firmware, el código del usuarioDirige todo I2C que las operaciones del autobús basaron en el Principio yLas condiciones del bit de parada.Una vez que el modo amo está habilitado, el usuario tiene seisLas opciones.1. Afirme una condición de Principio en la CED y SCL.2. Afirme una Repetida condición de Principio en la CED ySCL.3. Escríbale al registrador SSPBUF iniciandoLa transmisión de datos /dirección.4. Configure el puerto I2C para recibir datos.5. Genere una condición Acknowledge al finalDe un byte recibido de datos.6. Genere una condición de Alto en la CED y SCL

Note: The MSSP module, when configured inI2C Master mode, does not allow queueingof events. For instance, the user is notallowed to initiate a Start condition andimmediately write the SSPBUF register toinitiate transmission before the Startcondition is complete. In this case, theSSPBUF will not be written to and theWCOL bit will be set, indicating that a writeto the SSPBUF did not occur.

Nota: El módulo MSSP, estando configurado adentroI2C Domine con Maestría modo, no le permite queueingDe acontecimientos. Por ejemplo, el usuario no esPermitido para iniciar una condición de Principio yInmediatamente escriba al SSPBUF el registro paraInicie transmisión antes del PrincipioLa condición es completa. En este caso, loSSPBUF le escribió y loEl pedacito WCOL estará colocado, indicando eso uno de escrituraPara el SSPBUF no ocurrió.

The following events will cause the MSSP InterruptFlag bit, SSPIF, to be set (MSSP interrupt, if enabled):• Start condition• Stop condition• Data transfer byte transmitted/received• Acknowledge transmit• Repeated Start

Page 19: I2C Mode

Los siguientes acontecimientos causarán la Interrupción MSSPEl bit indicador, SSPIF, a ser determinados (MSSP interrumpa, si sea permitido):•†La condición de principio•†La condición de alto•†Los datos transfieren que el byte transmitido / recibido•†Acuse recibo transmita•†Repitió Principio

17.4.6.1 I2C Master Mode OperationThe master device generates all of the serial clockpulses and the Start and Stop conditions. A transfer isended with a Stop condition or with a Repeated Startcondition. Since the Repeated Start condition is alsothe beginning of the next serial transfer, the I2C bus willnot be released.In Master Transmitter mode, serial data is outputthrough SDA, while SCL outputs the serial clock. Thefirst byte transmitted contains the slave address of thereceiving device (7 bits) and the Read/Write (R/W) bit.In this case, the R/W bit will be logic ‘0’. Serial data istransmitted 8 bits at a time. After each byte is transmitted,an Acknowledge bit is received. Start and Stopconditions are output to indicate the beginning and theend of a serial transfer.

17.4.6.1 I2C Master Mode OperationEl dispositivo maestro genera todo el reloj de la novela por entregasPulso y las condiciones de Principio y de Alto. Un reembarque esFinalizado con una condición de Alto o con un Repetido PrincipioLa condición. Desde el Repetido Principio que la condición está tambiénEl comienzo de la siguiente transferencia secuencial, el autobús I2C lo haráNo sea soltado.En el modo Amo del Transmisor, los datos seriales es salidaA través de la CED, mientras SCL devuelve el reloj serial. LoEl primer byte transmitido contiene la dirección del esclavo de loRecibiendo dispositivo (7 pedacitos) y el pedacito / De Escritura Leído (Acto Inapropiado / W).En este caso, el pedacito de la / W de Acto Inapropiado será lógico _ 0. Los datos seriales sonPedacitos 8 transmitidos a la vez. Después de que cada byte sea transmitido,Un pedacito Acknowledge es recibido. El Principio y el Alto

Page 20: I2C Mode

Las condiciones son salida para indicar el comienzo y loEl fin de una transferencia secuencial.

In Master Receive mode, the first byte transmittedcontains the slave address of the transmitting device(7 bits) and the R/W bit. In this case, the R/W bit will belogic ‘1’. Thus, the first byte transmitted is a 7-bit slaveaddress followed by a ‘1’ to indicate the receive bit.Serial data is received via SDA, while SCL outputs theserial clock. Serial data is received 8 bits at a time. Aftereach byte is received, an Acknowledge bit is transmitted.Start and Stop conditions indicate the beginningand end of transmission.The Baud Rate Generator used for the SPI modeoperation is used to set the SCL clock frequency foreither 100 kHz, 400 kHz or 1 MHz I2C operation. SeeSection 17.4.7 “Baud Rate” for more detail.

En el modo Amo Receive, el primer byte transmitidoContiene la dirección del esclavo del dispositivo transmisor(7 pedacitos) y la / W de Acto Inapropiado mordida. En este caso, el pedacito de la / W de Acto Inapropiado seráLa lógica _ 1. Así, el primer byte transmitido es un esclavo de 7 pedacitosLa dirección seguida por uno _ 1 _ para indicar lo recibe mordido.Los datos seriales son recibidos por la CED, mientras SCL devuelve loEl reloj serial. Los datos seriales son recibidos 8 pedacitos a la vez. DespuésCada byte es recibido, un Acknowledge mordido es transmitido.El principio y las condiciones de Alto indican el comienzoY la despedida del aire.El Baud Rate Generator usó para el modo SPILa operación se usa para establecer la frecuencia del reloj SCL paraYa sea 100 kHz, 400 la operación kHz o 1 MHz I2C. VeaSección 17.4.7 "velocidad en baudios" para más detalle.

A typical transmit sequence would go as follows:1. The user generates a Start condition by settingthe Start Enable bit, SEN (SSPCON2<0>).2. SSPIF is set. The MSSP module will wait therequired start time before any other operationtakes place.3. The user loads the SSPBUF with the slaveaddress to transmit.4. Address is shifted out the SDA pin until all 8 bitsare transmitted.5. The MSSP module shifts in the ACK bit from theslave device and writes its value into theSSPCON2 register.6. The MSSP module generates an interrupt at theend of the ninth clock cycle by setting the SSPIFbit.7. The user loads the SSPBUF with eight bits ofdata.8. Data is shifted out the SDA pin until all 8 bits aretransmitted.9. The MSSP module shifts in the ACK bit from theslave device and writes its value into theSSPCON2 register.10. The MSSP module generates an interrupt at theend of the ninth clock cycle by setting the SSPIFbit.11. The user generates a Stop condition by settingthe Stop Enable bit, PEN (SSPCON2<2>).12. Interrupt is generated once the Stop condition iscomplete.

Uno típico transmite secuencia iría como sigue:1. El usuario genera una condición de Principio sedimentándose

Page 21: I2C Mode

El Principio Enable mordió, SEN (SSPCON2<0 > ).2. SSPIF está listo. El módulo MSSP esperará loEl tiempo de arranque requerido antes de cualquier otra operaciónTiene lugar.3. El usuario carga al SSPBUF con el esclavoDiríjale la palabra a transmitir.4. La dirección es intercambiada fuera del alfiler de CED hasta todos los 8 pedacitosEs transmitido.5. El MSSP que el módulo cambia de posición en el reconocimiento mordió de loEl dispositivo del esclavo y escribe su valor en loEl registro del SSPCON2.6. El módulo MSSP genera una interrupción en loEl fin del noveno ciclo de reloj colocando al SSPIFEl pedacito.7. El usuario carga al SSPBUF con ocho pedacitos deLos datos.8. Los datos son intercambiados fuera del alfiler de CED hasta todos los 8 pedacitos esTransmitido.9. El MSSP que el módulo cambia de posición en el reconocimiento mordió de loEl dispositivo del esclavo y escribe su valor en loEl registro del SSPCON2.10. El módulo MSSP genera una interrupción en loEl fin del noveno ciclo de reloj colocando al SSPIFEl pedacito.11. El usuario genera una condición de Alto sedimentándoseEl Alto Enable mordió, PLUMA (SSPCON2<2 > ).12. La interrupción es generada una vez que la condición de Alto esComplete.

17.4.7 BAUD RATEIn I2C Master mode, the Baud Rate Generator (BRG)reload value is placed in the lower 7 bits of theSSPADD register (Figure 17-17). When a write occursto SSPBUF, the Baud Rate Generator will automaticallybegin counting. The BRG counts down to ‘0’ and stopsuntil another reload has taken place. The BRG count isdecremented twice per instruction cycle (TCY) on theQ2 and Q4 clocks. In I2C Master mode, the BRG isreloaded automatically.

LA VELOCIDAD EN BAUDIOS DEL 17.4.7En el modo Amo I2C, el Baud Rate Generator (BRG)Vuelva a cargar valor es colocado en los pedacitos 7 inferiores de loSSPADD regístrese (la Figura 17-17). Cuando uno de escritura ocurrePara SSPBUF, el Generador de Velocidad en Baudios lega automáticamenteEmpiece conteo. El BRG cuenta hacia atrás para _ 0 _ y se detieneHasta otro vuelva a cargar ha tenido lugar. La cuenta BRG esEl decremented dos veces por el ciclo de búsqueda y ejecución (TCY) en loLos relojes Q2 y Q4. En el modo Amo I2C, el BRG esVuelto a cargar automáticamente.

Once the given operation is complete (i.e., transmissionof the last data bit is followed by ACK), the internalclock will automatically stop counting and the SCL pinwill remain in its last state.Table 17-3 demonstrates clock rates based oninstruction cycles and the BRG value loaded intoSSPADD.

Una vez que la operación dada es completa (i.e., La transmisiónDe los últimos datos el pedacito es perseguido por reconocimiento), lo internoEl reloj automáticamente dejará de conteo y el alfiler SCLSe quedará en su último estado.El 17-3 de la mesa demuestra tasas del reloj basadas adelanteLos ciclos de búsqueda y ejecución y el valor BRG cargados enSSPADD.

Page 22: I2C Mode

Note 1: The I2C interface does not conform to the 400 kHz I2C specification (which applies to rates greater than100 kHz) in all details, but may be used with care where higher rates are required by the application.Nota 1: La interfaz I2C no se conforma a la especificación 400 kHz I2C (que se aplica a las tasas más gran que100 kHz) en todos los detalles, pero puede ser usado con cuidado donde las tasas superiores son requeridas por la aplicación.

17.4.7.1 Clock ArbitrationClock arbitration occurs when the master, during anyreceive, transmit or Repeated Start/Stop condition,deasserts the SCL pin (SCL allowed to float high).When the SCL pin is allowed to float high, the BaudRate Generator (BRG) is suspended from countinguntil the SCL pin is actually sampled high. When the SCL pin is sampled high, the Baud Rate Generator is reloaded with the contents of SSPADD<6:0> andbegins counting. This ensures that the SCL high timewill always be at least one BRG rollover count in theevent that the clock is held low by an external device(Figure 17-18).

El Arbitraje del Reloj del 17.4.7.1El arbitraje del reloj ocurre cuando el amo, durante cualquierReciba, transmita o Repetida condición de principio /alto,Los deasserts el alfiler SCL (SCL dio rienda suelta a que para flotar a gran altura).Cuando el alfiler SCL está permitido para flotar a gran altura, el BaudioEl generador de tasa (BRG) es suspendido de contarHasta el SCL el alfiler está alto de hecho probado. Cuándo el alfiler SCL es alto probado, el Generador de Velocidad en Baudios es vuelto a cargar con el contenido de SSPADD < 6:0 > yEmpieza conteo. Esto asegura que el tiempo de alto SCLSiempre estará en mínimo escrutinio de refinanciación BRG en loEl acontecimiento que el reloj es sustentó punto bajo por un dispositivo externo(La Figura 17-18).

Page 23: I2C Mode

17.4.8 I2C MASTER MODE STARTCONDITION TIMINGTo initiate a Start condition, the user sets the StartEnable bit, SEN (SSPCON2<0>). If the SDA and SCLpins are sampled high, the Baud Rate Generator isreloaded with the contents of SSPADD<6:0> and startsits count. If SCL and SDA are both sampled high whenthe Baud Rate Generator times out (TBRG), the SDApin is driven low. The action of the SDA being drivenlow while SCL is high is the Start condition and causesthe S bit (SSPSTAT<3>) to be set. Following this, theBaud Rate Generator is reloaded with the contents ofSSPADD<6:0> and resumes its count. When the BaudRate Generator times out (TBRG), the SEN bit(SSPCON2<0>) will be automatically cleared byhardware; the Baud Rate Generator is suspended,leaving the SDA line held low and the Start condition iscomplete.

17.4.8 I2C DOMINE CON MAESTRÍA PRINCIPIO de MODOCONDICIONE OPORTUNIDAD DEL MOMENTOPara iniciar una condición de Principio, el usuario establece el PrincipioFaculte pedacito, SEN (SSPCON2<0 > ). Si la CED y SCLLos alfileres son alto probado, el Baud Rate Generator esVuelto a cargar con el contenido de SSPADD < 6:0 > y principiosSu cuenta. Si SCL y CED son ambos tomaron muestras a gran altura cuandoEl Baud Rate Generator cronometra fuera (TBRG), la CEDEl alfiler es punto bajo conducido. La acción de la CED siendo conducidoMuja mientras SCL está drogado es la condición de Principio y las causasLa S mordida (SSPSTAT < 3 > ) para ser determinada. Después de esto, loEl generador de velocidad en baudios es vuelto a cargar con el contenido deSSPADD < 6:0 > y curriculumes vitaes su cuenta. Cuando el BaudioEl generador de tasa cronometra fuera (TBRG), el pedacito SEN(SSPCON2<0 > ) será automáticamente aclarado por ahíEl hardware; El Baud Rate Generator es suspendido,Dejar la línea SDA sustentó punto bajo y la condición de Principio sonComplete.

Note: If at the beginning of the Start condition,the SDA and SCL pins are already sampledlow, or if during the Start condition, theSCL line is sampled low before the SDAline is driven low, a bus collision occurs,the Bus Collision Interrupt Flag, BCLIF, isset, the Start condition is aborted and theI2C module is reset into its Idle state.

Nota: Si al principio de la condición de Principio,La CED y alfileres SCL son ya probado

Page 24: I2C Mode

El punto bajo, o si durante el Principio pone en forma, loLa línea SCL es punto bajo probado antes de la CEDLa línea es punto bajo conducido, una colisión del autobús ocurre,La Bandera de Interrupción de Colisión del Autobús, BCLIF, esCírculo, la condición de Principio es abortada y loEl módulo I2C es puesto a cero en su estado Desocupado.

17.4.8.1 WCOL Status FlagIf the user writes the SSPBUF when a Start sequenceis in progress, the WCOL is set and the contents of thebuffer are unchanged (the write doesn’t occur).

17.4.8.1 Bandera WCOL StatusSi el usuario le escribe al SSPBUF cuando una secuencia de PrincipioEs en curso, el WCOL está listo y el contenido de loEl amortiguador está inalterado (el doesn t de escritura ocurra).

Note: Because queueing of events is notallowed, writing to the lower 5 bits ofSSPCON2 is disabled until the Startcondition is complete.

Nota: Porque el queueing de acontecimientos no esLa escritura permitida, para los pedacitos 5 inferiores deEl SSPCON2 está deshabilitado hasta el PrincipioLa condición es completa.

17.4.9 I2C MASTER MODE REPEATEDSTART CONDITION TIMINGA Repeated Start condition occurs when the RSEN bit(SSPCON2<1>) is programmed high and the I2C logicmodule is in the Idle state. When the RSEN bit is set,the SCL pin is asserted low. When the SCL pin issampled low, the Baud Rate Generator is loaded withthe contents of SSPADD<5:0> and begins counting.The SDA pin is released (brought high) for one BaudRate Generator count (TBRG). When the Baud RateGenerator times out, if SDA is sampled high, the SCLpin will be deasserted (brought high). When SCL issampled high, the Baud Rate Generator is reloadedwith the contents of SSPADD<6:0> and begins counting.SDA and SCL must be sampled high for one TBRG.This action is then followed by assertion of the SDA pin(SDA = 0) for one TBRG while SCL is high. Followingthis, the RSEN bit (SSPCON2<1>) will be automaticallycleared and the Baud Rate Generator will not bereloaded, leaving the SDA pin held low. As soon as aStart condition is detected on the SDA and SCL pins,the S bit (SSPSTAT<3>) will be set. The SSPIF bit will

Page 25: I2C Mode

not be set until the Baud Rate Generator has timed out.

El MODO MAESTRO 17.4.9 I2C REPITIÓLA OPORTUNIDAD DEL MOMENTO DE CONDICIÓN DE PRINCIPIOUna Repetida condición de Principio ocurre cuando el RSEN mordió(SSPCON2<1 > ) son alto programado y la lógica I2CEl módulo está en el estado Desocupado. Cuando el RSEN mordido está listo,El alfiler SCL está afirmado bajo. Cuando el alfiler SCL esEl punto bajo probado, el Baud Rate Generator está forrado conEl contenido de SSPADD < 5:0 > y empieza el conteo.El alfiler de CED es soltado (el alto traído) para un BaudioLa cuenta de tasa Generator (TBRG). Cuando la Velocidad en BaudiosEl generador cronometra fuera, si SDA fuera tomó muestras a gran altura, el SCLEl alfiler será deasserted (el alto traído). Cuando SCL esProbado alto, el Baud Rate Generator es vuelto a cargarCon el contenido de SSPADD < 6:0 > y empieza conteo.La CED y SCL deben ser alto probado para un TBRG.Esta acción es luego perseguida por aseveración del alfiler de CED(La CED = 0) para un TBRG mientras SCL está drogado. Después deEsto, el RSEN mordido (SSPCON2<1 > ) será automáticamenteAclarado y el Baud Rate Generator no seráVuelto a cargar, dejar el alfiler SDA sustentó punto bajo. Tan pronto como unoLa condición de principio detecta la CED y alfileres SCL,El pedacito de la S (SSPSTAT < 3 > ) estará colocado. El pedacito SSPIF lo haráNo está listo hasta que el Baud Rate Generator ha cronometrado fuera.

Note 1: If RSEN is programmed while any otherevent is in progress, it will not take effect.2: A bus collision during the Repeated Startcondition occurs if:• SDA is sampled low when SCL goesfrom low-to-high.• SCL goes low before SDA isasserted low. This may indicate thatanother master is attempting totransmit a data ‘1’.

Nota 1: Si RSEN es sistemático mientras cualquier otroEl acontecimiento es en curso, no se llevará a efecto.2: Una colisión del autobús durante el Repetido PrincipioLa condición ocurre si:•†La CED es punto bajo probado cuando SCL vaDe punto bajo para el alto.•†SCL se vuelve humilde antes de la CED esAfirmó punto bajo. Esto puede indicar esoOtro amo intenta paraTransmita una información _ 1.

Immediately following the SSPIF bit getting set, the usermay write the SSPBUF with the 7-bit address in 7-bitmode, or the default first address in 10-bit mode. Afterthe first eight bits are transmitted and an ACK isreceived, the user may then transmit an additional eightbits of address (10-bit mode) or eight bits of data (7-bitmode).

Inmediatamente después del pedacito SSPIF quedando determinado, el usuarioLe puede escribir al SSPBUF con la dirección de 7 pedacitos adentro de 7 pedacitosEl modo, o la dirección primera predeterminada en el modo de 10 pedacitos. DespuésLos primeros ocho pedacitos son transmitidos y un reconocimiento esAdmitido por la mayoría, el usuario luego puede transmitir uno adicional ochoLos pedacitos de dirección (de 7 pedacitos (el modo de 10 pedacitos) u ocho pedacitos de datosEl modo).

17.4.9.1 WCOL Status FlagIf the user writes the SSPBUF when a Repeated Startsequence is in progress, the WCOL is set and the

Page 26: I2C Mode

contents of the buffer are unchanged (the write doesn’toccur).

17.4.9.1 Bandera WCOL StatusSi el usuario le escribe al SSPBUF cuando un Repetido PrincipioLa secuencia es en curso, el WCOL está listo y loEl contenido del amortiguador está inalterado (el doesn t de escrituraOcurre).

Note: Because queueing of events is notallowed, writing of the lower 5 bits ofSSPCON2 is disabled until the RepeatedStart condition is complete.

Nota: Porque el queueing de acontecimientos no esLa escritura permitida, de los pedacitos 5 inferiores deEl SSPCON2 está deshabilitado hasta el RepeatedLa condición de principio es completa.

17.4.10 I2C MASTER MODE TRANSMISSIONTransmission of a data byte, a 7-bit address or the other half of a 10-bit address is accomplished by simply writing a value to the SSPBUF register. This action will set the Buffer Full flag bit, BF and allow the Baud Rate Generator to begin counting and start the next transmission. Each bit of address/data will be shifted out onto the SDA pin after the falling edge of SCL is asserted (see data hold time specificationparameter 106). SCL is held low for one Baud Rate Generator rollover count (TBRG). Data should be valid before SCL is released high (see data setup time specification parameter 107). When the SCL pin is released high, it is held that way for TBRG. The data on the SDA pin must remain stable for that duration and some hold time after the next falling edge of SCL. After the eighth bit is shifted out (the falling edge of the eighth clock), the BF flag is cleared and the master releases SDA. This allows the slave device being addressed to respond with an ACK bit during the ninth bit time if an address match occurred, or if data was received properly. The status of ACK is written into the ACKDT bit on the falling edge of the ninth clock. If the master receives an Acknowledge, the Acknowledge Status bit,ACKSTAT, is cleared. If not, the bit is set. After the ninth clock, the SSPIF bit is set and the master clock (Baud Rate Generator) is suspended until the next data byte is loaded into the SSPBUF, leaving SCL low and SDA unchanged (Figure 17-21).

17.4.10 I2C DOMINE CON MAESTRÍA TRANSMISIÓN de MODOLa transmisión de un byte de datos, una dirección de 7 pedacitos o la otra mitad de una dirección de 10 pedacitos está consumada por simplemente escribir un valor para el registro SSPBUF. Esta acción colocará el bit indicador del Amortiguador Full, BF y le permitirá a la Velocidad en Baudios Electrógena empezar conteo y empezar la siguiente transmisión. Cada pedacito de dirección /datos será intercambiado fuera encima del alfiler de CED después de que el borde descendente de SCL es al que se hizo valer (los datos de la sede sustentan especificación de tiempoEl parámetro 106). SCL es punto bajo sustentado para cuenta renovable de una (TBRG) Velocidad en Baudios de Electrógeno. Los datos deberían ser válidos antes de que SCL sea alto lanzado al mercado (vea parámetro de especificación de tiempo de instalación de datos 107). Cuándo el alfiler SCL es alto lanzado al mercado, lo es sustentado que muy para TBRG. Los datos en el alfiler de CED deben permanecer estables para esa duración y algún tiempo de retención después del siguiente borde

Page 27: I2C Mode

descendente de SCL. Después de que el octavo pedacito es intercambiado fuera (el borde descendente del octavo reloj), la bandera BF es despejada y la ama lanza al mercado CED. Esto consiente el dispositivo del esclavo siendo en el que se puso la dirección para responder con un pedacito de reconocimiento durante el noveno tiempo mordido si un encuentro de la dirección ocurrió, o si los datos fueron recibidos correctamente. El estatus de reconocimiento está escrito en el ACKDT mordido en el borde descendente del noveno reloj. Si el amo recibe a un Acknowledge, el Acknowledge Status mordió,ACKSTAT, es descongestionado. En caso de que no, el pedacito está colocado. Después del noveno reloj, el SSPIF mordido está listo y el reloj magistral (el Generador de Velocidad en Baudios) es suspendido hasta que el siguiente byte de datos sea cargado en el SSPBUFDejando tal cual punto bajo SCL y CED (la Figura 17-21).

After the write to the SSPBUF, each bit of the address will be shifted out on the falling edge of SCL until all seven address bits and the R/W bit are completed. On the falling edge of the eighth clock, the master will deassert the SDA pin, allowing the slave to respond with an Acknowledge. On the falling edge of the ninth clock, the master will sample the SDA pin to see if the address was recognized by a slave. The status of the ACK bit is loaded into the ACKSTAT status bit (SSPCON2<6>). Following the falling edge of the ninth clock transmission of the address, the SSPIF is set, the BF flag is cleared and the Baud Rate Generator is turned off until another write to the SSPBUF takes place, holding SCL low and allowing SDA to float.

Después de lo de escritura para el SSPBUF, cada pedacito de la dirección será intercambiado fuera en el borde descendente de SCL hasta que todos los siete pedacitos de la dirección y el pedacito de la / W de Acto Inapropiado sean completados. En el borde descendente del octavo reloj, el amo lega deassert el alfiler de CED, permitiéndole al esclavo responder con un Acknowledge. En el borde descendente del noveno reloj, el amo probará el alfiler de CED para ver si la dirección fue reconocida por un esclavo. El estatus del pedacito de reconocimiento es cargado en el pedacito de estatus ACKSTAT (SSPCON2<6 > ). Después del borde descendente de la novena transmisión del reloj de la dirección, el SSPIF está listo, la bandera BF es despejada y el Generador de Velocidad en Baudios está apagado hasta otro de escritura para el SSPBUF que las tomas colocan, sujetando a SCL muja y permitiéndole CED comanditar.

17.4.10.1 BF Status FlagIn Transmit mode, the BF bit (SSPSTAT<0>) is setwhen the CPU writes to SSPBUF and is cleared whenall 8 bits are shifted out.17.4.10.2 WCOL Status FlagIf the user writes the SSPBUF when a transmit isalready in progress (i.e., SSPSR is still shifting out adata byte), the WCOL flag is set and the contents of thebuffer are unchanged (the write doesn’t occur) after2 TCY after the SSPBUF write. If SSPBUF is rewrittenwithin 2 TCY, the WCOL bit is set and SSPBUF isupdated. This may result in a corrupted transfer. Theuser should verify that the WCOL flag is clear aftereach write to SSPBUF to ensure the transfer is correct.

17.4.10.1 Bandera BF StatusEn el modo Transmit, el pedacito BF (SSPSTAT < 0 > ) está colocadoCuando la UPC le escribe a SSPBUF y es despejado cuandoTodos los 8 pedacitos son intercambiados fuera.17.4.10.2 Bandera WCOL StatusSi el usuario le escribe al SSPBUF cuando uno transmita esYa en el progreso (i.e., SSPSR todavía cambia de posición fuera unoEl byte de datos), la bandera WCOL está colocada y el contenido de loEl amortiguador está inalterado (el doesn t de escritura ocurra) después2 TCY después del SSPBUF escriben. Si SSPBUF es reescritoDentro de 2 TCY, el WCOL mordido está listo y SSPBUF esActualizado. Esto puede dar como resultado un reembarque corrompido. LoEl usuario debería comprobar que la bandera WCOL es clara despuésCada uno le escribe a SSPBUF para asegurar el reembarque es correcto.

17.4.10.3 ACKSTAT Status FlagIn Transmit mode, the ACKSTAT bit (SSPCON2<6>) iscleared when the slave has sent an Acknowledge(ACK = 0) and is set when the slave does not Acknowledge(ACK = 1). A slave sends an Acknowledge whenit has recognized its address (including a general call),or when the slave has properly received its data.

Page 28: I2C Mode

17.4.11 I2C MASTER MODE RECEPTIONMaster mode reception is enabled by programming theReceive Enable bit, RCEN (SSPCON2<3>).

17.4.10.3 Bandera ACKSTAT StatusEn el modo Transmit, el pedacito ACKSTAT (SSPCON2<6 > ) esAclarado cuando el esclavo ha enviado a un Acknowledge(El reconocimiento = 0) y está listo cuando el esclavo no acusa recibo(ACK = 1). Un esclavo envía a un Acknowledge cuándoEso ha reconocido su dirección (incluyendo una llamada general)O cuándo el esclavo correctamente ha recibido sus datos.17.4.11 I2C DOMINE CON MAESTRÍA RECEPCIÓN de MODOLa recepción maestra de modo está habilitada programando loReciba al pedacito Enable, RCEN (SSPCON2<3 > ).

Note: The MSSP module must be in an Idle statebefore the RCEN bit is set or the RCEN bitwill be disregarded.

Nota: El módulo MSSP debe estar en un estado DesocupadoAntes del RCEN el pedacito está colocado o el RCEN mordióSerá de lo que se hizo caso omiso.

The Baud Rate Generator begins counting and on eachrollover, the state of the SCL pin changes (high-to-low/low-to-high) and data is shifted into the SSPSR. Afterthe falling edge of the eighth clock, the receive enableflag is automatically cleared, the contents of theSSPSR are loaded into the SSPBUF, the BF flag bit isset, the SSPIF flag bit is set and the Baud Rate Generatoris suspended from counting, holding SCL low. TheMSSP is now in Idle state awaiting the next command.When the buffer is read by the CPU, the BF flag bit isautomatically cleared. The user can then send anAcknowledge bit at the end of reception by setting theAcknowledge Sequence Enable bit, ACKEN(SSPCON2<4>).

El Baud Rate Generator empieza conteo y en cada unoLa refinanciación, el estado de los cambios del alfiler SCL (a gran altura para mugirEl punto bajo para el alto) y los datos son intercambiados en el SSPSR. DespuésEl borde descendente del octavo reloj, lo reciba permitaLa bandera es automáticamente aclarada, el contenido de loSSPSR está forrado en el SSPBUF, el bit indicador BF esCírculo, el bit indicador SSPIF está colocado y el Generador de Velocidad en BaudiosEs suspendido de contar, sustentar punto bajo SCL. LoMSSP está ahora en estado Desocupado esperando la siguiente orden.Cuándo el amortiguador es leído por la UPC, el bit indicador BF esAutomáticamente aclarado. El usuario luego puede enviar unoAcuse recibo pedacito al final de la recepción sedimentándose loAgradezca que la Secuencia Enable mordió, ACKEN(SSPCON2<4 > ).

17.4.11.1 BF Status FlagIn receive operation, the BF bit is set when an addressor data byte is loaded into SSPBUF from SSPSR. It iscleared when the SSPBUF register is read.17.4.11.2 SSPOV Status FlagIn receive operation, the SSPOV bit is set when 8 bitsare received into the SSPSR and the BF flag bit isalready set from a previous reception.17.4.11.3 WCOL Status FlagIf the user writes the SSPBUF when a receive isalready in progress (i.e., SSPSR is still shifting in a databyte), the WCOL bit is set and the contents of the bufferare unchanged (the write doesn’t occur).

Page 29: I2C Mode

17.4.11.1 Bandera BF StatusAdentro reciba operación, el BF mordido está listo cuando una direcciónO el byte de datos es cargado en SSPBUF de SSPSR. EsAclarado cuando el registro SSPBUF es leído.17.4.11.2 Bandera SSPOV StatusAdentro reciba operación, el SSPOV mordido está listo cuando 8 pedacitosEs recibido en el SSPSR y el bit indicador BF esYa sediméntese de una recepción previa.17.4.11.3 Bandera WCOL StatusSi el usuario le escribe al SSPBUF cuando uno reciba esYa en el progreso (i.e., SSPSR todavía cambia de posición en una informaciónEl byte), el pedacito WCOL está colocado y el contenido del amortiguadorEstá inalterado (el doesn t de escritura ocurra).

Page 30: I2C Mode

17.4.12 ACKNOWLEDGE SEQUENCETIMINGAn Acknowledge sequence is enabled by setting the Acknowledge Sequence Enable bit, ACKEN(SSPCON2<4>). When this bit is set, the SCL pin is pulled low and the contents of the Acknowledge data bit are presented on the SDA pin. If the user wishes to generatean Acknowledge, then the ACKDT bit should be cleared. If not, the user should set the ACKDT bit beforestarting an Acknowledge sequence. The Baud Rate Generator then counts for one rollover period (TBRG)and the SCL pin is deasserted (pulled high). When the SCL pin is sampled high (clock arbitration), the Baud Rate Generator counts for TBRG. The SCL pin is then pulled low. Following this, the ACKEN bit is automatically cleared, the Baud Rate Generator is turned off and the MSSP module then goes into Idle mode (Figure 17-23).17.4.12.1 WCOL Status FlagIf the user writes the SSPBUF when an Acknowledge sequence is in progress, then WCOL is set and thecontents of the buffer are unchanged (the write doesn’t occur).

17.4.12 ADMITE SECUENCIALa OPORTUNIDAD DEL MOMENTOUna secuencia Acknowledge está habilitada colocando la Secuencia Acknowledge Enable mordió, ACKEN(SSPCON2<4 > ). Cuando este pedacito está colocado, el alfiler SCL es punto bajo jalado y el contenido del bit de datos Acknowledge se replantea en el alfiler de CED. Si el usuario tiene el deseo de generarUn Acknowledge, luego el ACKDT mordido debería ser descongestionado. En caso de que no, el usuario debería sedimentarse que el ACKDT mordió antesIniciando una secuencia Acknowledge. El Baud Rate Generator luego vale por un período renovable (TBRG)Y el alfiler SCL es deasserted (el alto jalado). Cuándo el alfiler SCL es alto probado (el arbitraje del reloj), la Velocidad en Baudios Generator vale por TBRG. El alfiler SCL es luego punto bajo jalado. Después de esto, el ACKEN mordido es automáticamente aclarado, el Generador de Velocidad en Baudios es apagado y el módulo MSSP luego entra en modo Sin Valor (la Figura 17-23).17.4.12.1 Bandera WCOL StatusSi el usuario le escribe al SSPBUF cuando una secuencia Acknowledge es en curso, luego WCOL está listo y loEl contenido del amortiguador está inalterado (el doesn t de escritura ocurra).

17.4.13 STOP CONDITION TIMINGA Stop bit is asserted on the SDA pin at the end of a receive/transmit by setting the Stop Sequence Enable bit, PEN (SSPCON2<2>). At the end of a receive/ transmit, the SCL line is held low after the falling edge of the ninth clock. When the PEN bit is set, the master will assert the SDA line low. When the SDA line is sampled low, the Baud Rate Generator is reloaded and counts down to 0. When the Baud Rate Generator times out, the SCL pin will be brought high and one TBRG (Baud Rate Generator rollover count) later, the SDA pin will be deasserted. When the SDA pin is sampled high while SCL is high, the P bit (SSPSTAT<4>) is set. A TBRG later, the PEN bit is cleared and the SSPIF bit is set (Figure 17-24).17.4.13.1 WCOL Status FlagIf the user writes the SSPBUF when a Stop sequence is in progress, then the WCOL bit is set and thecontents of the buffer are unchanged (the write doesn’t occur).

LA OPORTUNIDAD DEL MOMENTO DE CONDICIÓN DE ALTO DEL 17.4.13Un bit de parada es afirmado en el alfiler de CED al final de uno reciba / transmita colocando el Secuencia de Alto Enable mordió, PLUMA (SSPCON2<2 > ). Al final de uno reciba / transmita, la línea SCL es punto bajo sustentado después del borde descendente del noveno reloj. Cuando el pedacito de la PLUMA está colocado, el amo afirmará el punto bajo de la línea de CED. Cuando la línea de CED es tomó muestras el punto bajo, el Generador de Velocidad en Baudios es vuelto a cargar y cuenta hacia atrás para 0. Cuando el Baud Rate Generator cronometra fuera, el alfiler a SCL le será traído alto y un TBRG (la cuenta de refinanciación del Generador de Velocidad en Baudios) más tarde, el alfiler de CED será deasserted. Cuándo el alfiler de CED es alto probado mientras SCL está drogado, el pedacito de la P (SSPSTAT < 4 > ) está colocado. Un TBRG más tarde, que la PLUMA mordió es descongestionado y el SSPIF mordido está listo (la Figura 17-24).17.4.13.1 Bandera WCOL StatusSi el usuario le escribe al SSPBUF cuando una secuencia de Alto es en curso, luego el WCOL mordido está listo y loEl contenido del amortiguador está inalterado (el doesn t de escritura ocurra).

Page 31: I2C Mode

17.4.14 SLEEP OPERATIONWhile in Sleep mode, the I2C module can receiveaddresses or data and when an address match orcomplete byte transfer occurs, wake the processorfrom Sleep (if the MSSP interrupt is enabled).17.4.15 EFFECTS OF A RESETA Reset disables the MSSP module and terminates thecurrent transfer.

LA OPERACIÓN DE SUEÑO DEL 17.4.14Mientras en el modo de Sueño, el módulo I2C puede recibirLas direcciones o los datos y cuando una dirección equivalen oEl reembarque completo de byte ocurre, despierte el procesadorDe Sueño (si la interrupción MSSP está habilitada).17.4.15 EFECTÚA DE UNA REANUDACIÓNUna Reanudación desactiva el módulo MSSP y termina la relación loEl reembarque actual.

17.4.16 MULTI-MASTER MODEIn Multi-Master mode, the interrupt generation on thedetection of the Start and Stop conditions allows thedetermination of when the bus is free. The Stop (P) andStart (S) bits are cleared from a Reset or when theMSSP module is disabled. Control of the I2C bus maybe taken when the P bit (SSPSTAT<4>) is set, or thebus is Idle, with both the S and P bits clear. When thebus is busy, enabling the MSSP interrupt will generatethe interrupt when the Stop condition occurs.In multi-master operation, the SDA line must bemonitored for arbitration to see if the signal level is theexpected output level. This check is performed inhardware with the result placed in the BCLIF bit.The states where arbitration can be lost are:

Page 32: I2C Mode

• Address Transfer• Data Transfer• A Start Condition• A Repeated Start Condition• An Acknowledge Condition

EL MODO DEL MULTIAMO DEL 17.4.16En el modo maestro a Multi, la generación de interrupción en loLa detección del Principio y las condiciones de Alto da rienda suelta a que loLa determinación de cuando el autobús es gratis. El Alto (P) yLos pedacitos de principio (S) son despejados de una Reanudación o cuando loEl módulo MSSP está deshabilitado. El control del autobús I2C puedeEstar ocupado cuando el pedacito de la P (SSPSTAT < 4 > ) está colocado, o loEl autobús está Desocupado, con ambos la S y los pedacitos P se descongestionan. Cuando loEl autobús está ocupado, habilitante que la interrupción MSSP generaráLa interrupción cuando la condición de Alto ocurra.En la operación multimaestra, la línea de CED debe serMonitoreado para el arbitraje ver si la señal nivel es loEsperó nivel de salida. Esta comprobación es realizado adentroEl hardware con el resultado colocó en el pedacito BCLIF.Los estados donde el arbitraje puede estar perdido son:•†El Reembarque de la Dirección•†Los Datos Se Trasladan•†Una Condición de Principio•†Una Repetida Condición de Principio•†Uno Admite Condición

17.4.17 MULTI -MASTER COMMUNICATION,BUS COLLISION AND BUSARBITRATIONMulti-Master mode support is achieved by bus arbitration.When the master outputs address/data bits ontothe SDA pin, arbitration takes place when the masteroutputs a ‘1’ on SDA, by letting SDA float high andanother master asserts a ‘0’. When the SCL pin floatshigh, data should be stable. If the expected data onSDA is a ‘1’ and the data sampled on the SDA pin = 0,then a bus collision has taken place. The master will setthe Bus Collision Interrupt Flag, BCLIF, and reset theI2C port to its Idle state (Figure 17-25).If a transmit was in progress when the bus collisionoccurred, the transmission is halted, the BF flag iscleared, the SDA and SCL lines are deasserted and theSSPBUF can be written to. When the user services thebus collision Interrupt Service Routine, and if the I2Cbus is free, the user can resume communication byasserting a Start condition.

17.4.17 MULTI - DOMINE CON MAESTRÍA COMUNICACIÓN,LA COLISIÓN DEL AUTOBÚS Y EL AUTOBÚSEl ARBITRAJEEl soporte maestro a Multi de modo es logrado por el arbitraje de bus.Cuando el amo devuelve bits de la dirección /datos encima deEl alfiler de CED, arbitraje el lugar de tomas cuando el amoDevuelve uno _ 1 _ en la CED, dejando CED comanditar a gran altura yOtro amo afirma uno _ 0. Cuando el alfiler SCL flotaEl alto, los datos debería ser estable. Si los datos esperados adelanteLa CED es una _ 1 _ y la información probadas en el alfiler de CED = 0,Luego una colisión del autobús ha tenido lugar. El master se sedimentaráLa Bandera de Interrupción de Colisión del Autobús, BCLIF, y reanudación loI2C ponga a babor para su estado Desocupado (la Figura 17-25).Si uno transmita fue en marcha cuando la colisión del autobúsOcurrida, la transmisión está suspendida, la bandera BF esAclaradas, la CED y líneas SCL son deasserted y loSe le escribió a SSPBUF. Cuando el usuario repara loLa rutina de servicio de Interrupción de colisión del autobús, y si el I2C

Page 33: I2C Mode

El autobús es gratis, el usuario puede reanudar comunicación por ahíAfirmando una condición de Principio.

If a Start, Repeated Start, Stop or Acknowledgecondition was in progress when the bus collisionoccurred, the condition is aborted, the SDA and SCLlines are deasserted and the respective control bits inthe SSPCON2 register are cleared. When the user servicesthe bus collision Interrupt Service Routine, and ifthe I2C bus is free, the user can resume communicationby asserting a Start condition.The master will continue to monitor the SDA and SCLpins. If a Stop condition occurs, the SSPIF bit will be set.A write to the SSPBUF will start the transmission ofdata at the first data bit, regardless of where thetransmitter left off when the bus collision occurred.In Multi-Master mode, the interrupt generation on thedetection of Start and Stop conditions allows thedetermination of when the bus is free. Control of the I2Cbus can be taken when the P bit is set in the SSPSTATregister, or the bus is Idle and the S and P bits arecleared.

Si Un Punto de Partida, Repeated Arranque, el Alto o AcknowledgeLa condición estaba en curso cuando la colisión del autobúsOcurrida, la condición es abortada, la CED y SCLLas líneas son deasserted y los pedacitos respectivos de control adentroEl registro del SSPCON2 es aclarado. Cuando el usuario reparaLa Rutina de Servicio de Interrupción de colisión del autobús, y siEl autobús I2C es gratis, el usuario puede reanudar comunicaciónAfirmando una condición de Principio.El amo continuará monitoreando la CED y SCLLos alfileres. Si un Alto que la condición ocurre, el SSPIF mordida estará listo.Uno de escritura para el SSPBUF iniciará la transmisión deLos datos en el primer bit de datos, a pesar de donde loEl transmisor dejó de cuando la colisión del autobús ocurrió.En el modo maestro a Multi, la generación de interrupción en loLa detección de condiciones de Principio y de Alto da rienda suelta a que loLa determinación de cuando el autobús es gratis. El control del I2CEl autobús puede estar ocupado cuando el pedacito de la P es incrustado en el SSPSTATEl registro, o el autobús es Idle y la S y P que los pedacitos sonAclarado.

17.4.17.1 Bus Collision During aStart ConditionDuring a Start condition, a bus collision occurs if:a) SDA or SCL are sampled low at the beginning ofthe Start condition (Figure 17-26).b) SCL is sampled low before SDA is asserted low(Figure 17-27).During a Start condition, both the SDA and the SCL

Page 34: I2C Mode

pins are monitored.If the SDA pin is already low, or the SCL pin is alreadylow, then all of the following occur:• the Start condition is aborted,• the BCLIF flag is set and• the MSSP module is reset to its Idle state(Figure 17-26).The Start condition begins with the SDA and SCL pins deasserted. When the SDA pin is sampled high, the Baud Rate Generator is loaded from SSPADD<6:0> and counts down to 0. If the SCL pin is sampled low while SDA is high, a bus collision occurs because it is assumed that another master is attempting to drive a data ‘1’ during the Start condition.

La Colisión del Autobús del 17.4.17.1 During UnoLa Condición de PrincipioDurante una condición de Principio, una colisión del autobús ocurre si:uno) La CED o SCL es punto bajo probado al principio deLa condición de Principio (la Figura 17-26).b) SCL es punto bajo probado antes de que la CED sea afirmada baja(La Figura 17-27).Durante una condición de Principio, ambos la CED y el SCLLos alfileres son monitoreados.Si el alfiler de CED está ya bajo, o el alfiler SCL está yaEl punto bajo, luego todos los siguiente ocurra:•†La condición de Principio es abortada,•†La bandera BCLIF está colocada y•†El módulo MSSP es puesto a cero para su estado Desocupado(La Figura 17-26).La condición de Principio comienza con la CED y SCL prende con alfileres deasserted. Cuándo el alfiler de CED es alto probado, el Generador de Velocidad en Baudios está cargado de SSPADD < 6:0 > y cuenta hacia atrás para 0. Si el alfiler SCL es probó muja mientras SDA está drogada, una colisión del autobús ocurre porque es asumida que otro amo trata de conducir una información _ 1 _ durante la condición de Principio.

If the SDA pin is sampled low during this count, theBRG is reset and the SDA line is asserted early(Figure 17-28). If, however, a ‘1’ is sampled on the SDApin, the SDA pin is asserted low at the end of the BRGcount. The Baud Rate Generator is then reloaded andcounts down to 0; if the SCL pin is sampled as ‘0’during this time, a bus collision does not occur. At theend of the BRG count, the SCL pin is asserted low.

Si el alfiler de CED es probó muja durante esta cuenta, loBRG es vuelto a arrancar y la línea de CED es afirmada tempranera(La Figura 17-28). Si, sin embargo, un 1 _ es probado en la CEDEl alfiler, el alfiler de CED está afirmado bajo al final del BRGLa cuenta. El Baud Rate Generator es entonces vuelto a cargar yLas cuentas regresivas para 0; Si el alfiler SCL es probado como _ 0Durante este tiempo, una colisión del autobús no ocurre. En loEl fin de la cuenta BRG, el alfiler SCL está afirmado bajo.

Note: The reason that bus collision is not a factorduring a Start condition is that no two busmasters can assert a Start condition at theexact same time. Therefore, one masterwill always assert SDA before the other.This condition does not cause a buscollision because the two masters must beallowed to arbitrate the first addressfollowing the Start condition. If the addressis the same, arbitration must be allowed tocontinue into the data portion, RepeatedStart or Stop conditions.

Nota: La razón por la que esa colisión del autobús no es un factorDurante un Principio la condición está ese no dos autobús

Page 35: I2C Mode

Los amos pueden afirmar una condición de Principio en loEl tiempo mismo exacto. Por consiguiente, un amoSiempre afirmará CED antes del otro.Esta condición no causa un autobúsLa colisión porque el dos amaestra debe serPermitido para arbitrar el primer discursoDespués de la condición de Principio. Si la direcciónEs lo mismo, el arbitraje debe ser admitido paraContinúe en la porción de datos, RepetidoEmpiece o Alto condiciones.

Page 36: I2C Mode

17.4.17.2 Bus Collision During a RepeatedStart ConditionDuring a Repeated Start condition, a bus collisionoccurs if:a) A low level is sampled on SDA when SCL goesfrom low level to high level.b) SCL goes low before SDA is asserted low,indicating that another master is attempting totransmit a data ‘1’.When the user deasserts SDA and the pin is allowed tofloat high, the BRG is loaded with SSPADD<6:0> andcounts down to 0. The SCL pin is then deasserted andwhen sampled high, the SDA pin is sampled.

La Colisión del Autobús del 17.4.17.2 Durante Un RepeatedLa Condición de PrincipioDurante una Repetida condición de Principio, una colisión del autobúsOcurre si:

Page 37: I2C Mode

uno) Un nivel bajo es probado en la CED cuando SCL vaDe nivel bajo para nivel alto.b) SCL se vuelve humilde antes de que la CED sea afirmada baja,Señalar que otro amo es intentar paraTransmita una información _ 1.Cuando la CED de deasserts del usuario y el alfiler son permitidosFlote a gran altura, el BRG está forrado con SSPADD < 6:0 > yLas cuentas regresivas para 0. El alfiler SCL es luego deasserted yCuando se prueba alto, el alfiler de CED es probado.

If SDA is low, a bus collision has occurred (i.e., anothermaster is attempting to transmit a data ‘0’, Figure 17-29).If SDA is sampled high, the BRG is reloaded and beginscounting. If SDA goes from high-to-low before the BRGtimes out, no bus collision occurs because no twomasters can assert SDA at exactly the same time.If SCL goes from high-to-low before the BRG times outand SDA has not already been asserted, a bus collisionoccurs. In this case, another master is attempting totransmit a data ‘1’ during the Repeated Start condition,see Figure 17-30.If, at the end of the BRG time-out, both SCL and SDAare still high, the SDA pin is driven low and the BRG isreloaded and begins counting. At the end of the count,regardless of the status of the SCL pin, the SCL pin isdriven low and the Repeated Start condition iscomplete.

Si SDA anda de capa caída, una colisión del autobús ha ocurrido (i.e., OtroEl amo trata de transmitir una información _ 0 _, Figure 17-29).Si la CED es probado a gran altura, el BRG es vuelto a cargar y comienzaEl conteo. Si SDA va de a gran altura a mugir antes del BRGCronometra fuera, ninguna colisión del autobús ocurre porque ningún dosLos amos pueden afirmar CED en el tiempo exactamente igual.Si SCL va de a gran altura a mugir antes de las veces BRG fueraY la CED ya no ha sido afirmada, una colisión del autobúsOcurre. En este caso, otro amo intenta paraTransmita una información _ 1 _ durante la Repetida condición de Principio,Vea 17-30 de la Figura.Si, al final de la interrupción BRG, ambos SCL y CEDEstá todavía drogado, el alfiler de CED es punto bajo conducido y el BRG esVuelto a cargar y empieza conteo. Al final de la cuenta,A pesar del estatus del alfiler SCL, el alfiler SCL esEl punto bajo conducido y el Principio Repeated que la condición esComplete.

Page 38: I2C Mode

17.4.17.3 Bus Collision During a StopConditionBus collision occurs during a Stop condition if:a) After the SDA pin has been deasserted andallowed to float high, SDA is sampled low afterthe BRG has timed out.b) After the SCL pin is deasserted, SCL is sampledlow before SDA goes high.

La Colisión del Autobús del 17.4.17.3 Durante Un AltoLa condiciónLa colisión del autobús ocurre durante una condición de Alto si:uno) Después de que el alfiler de CED haya sido deasserted yPermitido para flotar a gran altura, la CED es punto bajo probado despuésEl BRG ha cronometrado fuera.b) Después de que el alfiler SCL es deasserted, SCL es probadoMuja antes de que la CED se vuelva alta.

The Stop condition begins with SDA asserted low.When SDA is sampled low, the SCL pin is allowed tofloat. When the pin is sampled high (clock arbitration),the Baud Rate Generator is loaded with SSPADD<6:0>and counts down to 0. After the BRG times out, SDA issampled. If SDA is sampled low, a bus collision hasoccurred. This is due to another master attempting todrive a data ‘0’ (Figure 17-31). If the SCL pin issampled low before SDA is allowed to float high, a buscollision occurs. This is another case of another master

Page 39: I2C Mode

attempting to drive a data ‘0’ (Figure 17-32).

La condición de Alto comienza con CED afirmado baja.Cuando la CED es probado punto bajo, el alfiler SCL es permitidoFlote. Cuándo el alfiler es alto probado (el arbitraje del reloj)El Baud Rate Generator está forrado con SSPADD < 6:0Y las cuentas hasta 0. Después del BRG cronometra fuera, CED esProbado. Si la CED es probado punto bajo, una colisión del autobús lo ha hechoOcurrido. Esto es debido a otro amo intentando paraConduzca una información _ 0 _ (la Figura 17-31). Si el alfiler SCL esEl punto bajo probado antes de la CED es admitido para comanditar a gran altura, un autobúsLa colisión ocurre. Éste es otro caso de otro amoTratando de conducir una información _ 0 _ (la Figura 17-32).