Anda di halaman 1dari 39

I2C 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.

17.4.1 REGISTERS
The MSSP module has six registers for I2C operation.
These are:
• 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 directly
accessible
• MSSP Address Register (SSPADD)
SSPCON1, SSPCON2 and SSPSTAT are the control
and status registers in I2C mode operation. The
SSPCON1 and SSPCON2 registers are readable and
writable. 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 or
out. SSPBUF is the buffer register to which data bytes
are written to or read from.
SSPADD register holds the slave device address when
the MSSP is configured in I2C Slave mode. When the
MSSP is configured in Master mode, the lower seven
bits of SSPADD act as the Baud Rate Generator reload
value.
In receive operations, SSPSR and SSPBUF together
create a double-buffered receiver. When SSPSR
receives a complete byte, it is transferred to SSPBUF
and the SSPIF interrupt is set.
During transmission, the SSPBUF is not doublebuffered.
A write to SSPBUF will write to both SSPBUF
and SSPSR

17.4.1 SE REGISTRA
El 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) directamente
Accesible
•†MSSP Ocúpese de Registro (SSPADD)
SSPCON1, SSPCON2 y SSPSTAT son el control
Y el estatus registra en la operación de modo I2C. Lo
El SSPCON1 y los registros SSPCON2 son legibles y
Escribible. 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 o
Fuera. SSPBUF es el registro intermedio para el cual los bytes de datos
Le escribió o leer de.
El registro SSPADD sujeta la dirección del dispositivo del esclavo cuándo
El MSSP es configurado en el modo I2C Slave. Cuando lo
MSSP es configurado en el modo amo, lo más bajo siete
Los pedacitos de acto SSPADD como el Generador de Velocidad en Baudios vuelven a cargar
El valor.
Adentro reciba operaciones, SSPSR y SSPBUF conjuntamente
Cree un aparato receptor de amortiguador doble. Cuando SSPSR
Recibe un byte completo, es transferido para SSPBUF
Y la interrupción SSPIF es determinada.
Durante la transmisión, el SSPBUF no es doublebuffered.
Uno de escritura para SSPBUF le escribirá a ambos SSPBUF
Y SSPSR
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 Velocidad
0 = Slew rate control enabled for High-Speed mode (400 kHz)
bit 6 CKE: SMBus Select bit
In Master or Slave mode:
1 = Enable SMBus specific inputs__Permita SMBus aportes específicos
0 = Disable SMBus specific inputs
bit 5 D/A: Data/Address bit
In 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ón
0 = Indicates that the last byte received or transmitted was address___ Señala que el último byte recibido
o transmitido fue dirección
bit 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
último
0 = Stop bit was not detected last
bit 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
último
0 = Start bit was not detected last
bit 2 R/W: Read/Write Information bit (I2C mode only)(2,3)
In Slave mode:
1 = Read
0 = Write
In Master mode:
1 = Transmit is in progress
0 = Transmit is not in progress
bit 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 registran
0 = Address does not need to be updated__ La dirección no necesita estar actualizada
bit 0 BF: Buffer Full Status bit
In Transmit mode:
1 = SSPBUF is full
0 = SSPBUF is empty__ Vacíese
In 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 the
address 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 lo
El 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
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 a
transmission 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 uno
La transmisión a ser iniciada (debe ser aclarado en software)
0 = No collision
In Slave Transmit mode:
1 = The SSPBUF register is written while it is still transmitting the previous word (must be cleared in
software)___ El registro SSPBUF está escrito mientras todavía transmite la palabra previa (debe ser
aclarado adentro
El software)
0 = No collision
In 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 Rebalse
In Receive mode:
1 = A byte is received while the SSPBUF register is still holding the previous byte (must be cleared in
software)___ Un byte es recibido mientras el registro SSPBUF todavía sustenta el byte previo (debe ser
aclarado en software)
0 = No overflow
In 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 pins
0 = Disables serial port and configures these pins as I/O port pins
bit 4 CKP: SCK Release Control bit___ SCK Suelte pedacito de Control
In Slave mode:
1 = Releases clock__ Las liberaciones registran el tiempo
0 = 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 datos
In 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 enabled
El modo I2C Slave, la dirección de 10 pedacitos con Principio e interrupciones del pedacito Stop
habilitadas
1110 = I2C Slave mode, 7-bit address with Start and Stop bit interrupts enabled
1011 = 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 address
0110 = I2C Slave mode, 7-bit address
Bit 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 SSPSR
Permite interrupción cuando una dirección general (0000h) de llamada es recibida en el SSPSR
0 = 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=reconocer
1 = Acknowledge was not received from slave
Acuse recibo no fue recibido de esclavo
0 = Acknowledge was received from slave
bit 5 ACKDT: Acknowledge Data bit (Master Receive mode only)(2)
Admito bit de datos (el modo Amo Receive sólo) (2)
1 = Not Acknowledge
No loreconoce no lo admite
0 = Acknowledge
bit 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. Automatically
cleared 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 terminada
bit 3 RCEN: Receive Enable bit (Master mode only)(1)
1 = Enables Receive mode for I2C
0 = Receive Idle
bit 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 Idle
bit 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 Idle
bit 0 SEN: Start Condition Enable/Stretch Enable bit(1)
La Condición de Principio Permite / Elasticidad Permita
In Master mode:
1 = Initiates Start condition on SDA and SCL pins. Automatically cleared by hardware.
0 = Start condition Idle
La condición de principio Idle
In 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 disabled
Stretching====estitamiento
Note 1: For bits ACKEN, RCEN, PEN, RSEN, SEN: If the I2C module is not in the Idle mode, these bits
may not be
set (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 receive
Nota 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 hacer
El 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 OPERATION
The MSSP module functions are enabled by setting
MSSP Enable bit, SSPEN (SSPCON1<5>).
The SSPCON1 register allows control of the I2C
operation. 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 and
Stop bit interrupts enabled
• I2C Slave mode (10-bit address) with Start and
Stop bit interrupts enabled
• I2C Firmware Controlled Master mode, slave is Idle
Selection 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
setting the appropriate TRISC bits. To ensure proper
operation of the module, pull-up resistors must be
provided externally to the SCL and SDA pins.

La OPERACIÓN del 17.4.2


Las funciones de módulo MSSP están habilitadas sedimentándose
MSSP Faculte pedacito, SSPEN (SSPCON1<5 > ).
El registro del SSPCON1 consiente control del I2C
La 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 y
Las interrupciones del bit de parada habilitadas
•†El modo I2C Slave (la dirección de 10 pedacitos) con Principio y
Las interrupciones del bit de parada habilitadas
•†I2C Firmware Controlled Domine con Maestría modo, el esclavo está ocioso
La 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 correcto
La operación del módulo, resistores de actuación debe ser
Siempre y cuando externamente para el SCL y alfileres de CED.

17.4.3 SLAVE MODE


In Slave mode, the SCL and SDA pins must be configured
as inputs (TRISC<4:3> set). The MSSP module
will override the input state with the output data when
required (slave-transmitter).
The I2C Slave mode hardware will always generate an
interrupt on an address match. Through the mode
select bits, the user can also choose to interrupt on
Start and Stop bits
When an address is matched, or the data transfer after
an address match is received, the hardware automatically
will generate the Acknowledge (ACK) pulse
and load the SSPBUF register with the received value
currently in the SSPSR register.
Any combination of the following conditions will cause
the MSSP module not to give this ACK pulse:
• The Buffer Full bit, BF (SSPSTAT<0>), was set
before the transfer was received.
• The overflow bit, SSPOV (SSPCON1<6>), was
set before the transfer was received.
In this case, the SSPSR register value is not loaded
into the SSPBUF, but bit, SSPIF (PIR1<3>), is set. The
BF bit is cleared by reading the SSPBUF register, while
bit, SSPOV, is cleared through software.
The SCL clock input must have a minimum high and
low for proper operation. The high and low times of the
I2C specification, as well as the requirement of the
MSSP module, are shown in timing parameter 100 and
parameter 101.

EL MODO DEL ESCLAVO DEL 17.4.3


En Esclavo el modo, el SCL y alfileres de CED deben ser configurados
Como los aportes (TRISC < 4:3 > se sedimentó). El módulo MSSP
Pasará sobre la disposición del aporte estatal con los datos de salida cuándo
Requerido (el transmisor de esclavo).
El hardware de modo I2C Slave siempre generará uno
Interrumpa en un fósforo de la dirección. A través del modo
Haga una selección pedacitos, el usuario también puede elegir interrumpir adelante
El principio y los bits de parada
Cuando una dirección es a la que se correspondió, o los datos se trasladan después
Un fósforo de la dirección es recibido, el hardware automáticamente
Generará el pulso Acknowledge (el reconocimiento)
Y la carga el registro SSPBUF con el valor recibido
Actualmente en el registro SSPSR.
Cualquier combinación de las siguientes condiciones dará lugar a que
El módulo MSSP para no dar este pulso de reconocimiento:
•†El Amortiguador Full pedacito, BF (SSPSTAT < 0 > ), estaba listo
Antes de que el reembarque fuese recibido.
•†El rebalse mordido, SSPOV (SSPCON1<6 > ), fue
Sediméntese antes de que el reembarque fuese recibido.
En este caso, el valor de registro SSPSR no es cargado
En el SSPBUF, pero se muerde, SSPIF (PIR1<3 > ), está listo. Lo
El pedacito BF es despejado leyendo el registro SSPBUF, mientras
El pedacito, SSPOV, es descongestionado a través de software.
El aporte del reloj SCL debe tener un mínimo a gran altura y
Muja para la operación correcta. Las veces altas y bajas de lo
La especificación I2C, así como también el requisito de lo
El módulo MSSP, es demostrado en parámetro de oportunidad del momento 100 y
El parámetro 101.

17.4.3.1 Addressing
Once the MSSP module has been enabled, it waits for
a Start condition to occur. Following the Start condition,
the 8 bits are shifted into the SSPSR register. All incoming
bits are sampled with the rising edge of the clock
(SCL) line. The value of register SSPSR<7:1> is
compared to the value of the SSPADD register. The
address is compared on the falling edge of the eighth
clock (SCL) pulse. If the addresses match and the BF
and SSPOV bits are clear, the following events occur:
1. The SSPSR register value is loaded into the
SSPBUF register.
2. The Buffer Full bit, BF, is set.
3. An ACK pulse is generated.
4. MSSP Interrupt Flag bit, SSPIF (PIR1<3>), is
set (interrupt is generated, if enabled) on the
falling edge of the ninth SCL pulse.
In 10-Bit Addressing mode, two address bytes need to
be received by the slave. The five Most Significant bits
(MSbs) of the first address byte specify if this is a 10-bit
address. Bit R/W (SSPSTAT<2>) must specify a write
so the slave device will receive the second address
byte. For a 10-bit address, the first byte would equal
‘11110 A9 A8 0’, where ‘A9’ and ‘A8’ are the
two MSbs of the address. The sequence of events for
10-bit addressing is as follows, with steps 7 through 9
for 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 the
SCL line).
3. Read the SSPBUF register (clears bit, BF) and
clear 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, this
will clear bit, UA.
6. Read the SSPBUF register (clears bit, BF) and
clear flag bit, SSPIF.
7. Receive Repeated Start condition.
8. Receive first (high) byte of address (bits, SSPIF
and BF, are set).
9. Read the SSPBUF register (clears bit, BF) and
clear flag bit, SSPIF.
El direccionamiento del 17.4.3.1
Una vez que el módulo MSSP ha estado habilitado, espera para
Una condición de Principio a ocurrir. Después de la condición de Principio,
Los 8 pedacitos son intercambiados en el registro SSPSR. Todo entrante
Los pedacitos son probados con el borde ascendente del reloj
(SCL) la línea. El valor de registro SSPSR < 7:1 > es
Comparado por valor del registro SSPADD. Lo
La dirección es comparada en el borde descendente del octavo
El pulso del reloj (SCL). Si las direcciones equivalen y el BF
Y los pedacitos SSPOV están claros, los siguientes acontecimientos ocurren:
1. El valor de registro SSPSR está forrado en lo
SSPBUF 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 > ), es
Sediméntese (la interrupción es generada, si es permitida) adelante lo
El borde descendente del noveno pulso SCL.
En modo de 10 pedacitos que Le Dirige la Palabra a, dos bytes de la dirección necesitan
Ser 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 pedacitos
La dirección. Acto Inapropiado mordido / W (SSPSTAT < 2 > ) debe especificar uno de escritura
Así es que el dispositivo del esclavo recibirá la segunda dirección
El byte. Para una dirección de 10 pedacitos, el primer byte igualaría
_ 11110 A9 A8 0 _, donde _ A9 _ y _ A8 _ son lo
Dos MSbs de la dirección. La secuencia de acontecimientos para
El direccionamiento de 10 pedacitos es como sigue, con pasos 7 a través de 9
Para el transmisor de esclavo:
1. Reciba primer (pedacitos SSPIF, (a gran altura) byte de dirección
BF 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 lo
La línea SCL).
3. Lea al SSPBUF el registro (los claros mordidos, BF) y
Aclare bit indicador, SSPIF.
4. Reciba segundo (los pedacitos, (el punto bajo) byte de dirección
SSPIF, 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, esto
Descongestionará mordido, UA.
6. Lea al SSPBUF el registro (los claros mordidos, BF) y
Aclare bit indicador, SSPIF.
7. Reciba Repetida condición de Principio.
8. Reciba primer (los pedacitos, SSPIF (a gran altura) byte de dirección
Y BF, estén listos).
9. Lea al SSPBUF el registro (los claros mordidos, BF) y
Aclare bit indicador, SSPIF.

17.4.3.2 Reception
When the R/W bit of the address byte is clear and an
address match occurs, the R/W bit of the SSPSTAT
register is cleared. The received address is loaded into
the SSPBUF register and the SDA line is held low
(ACK).
When the address byte overflow condition exists, then
the no Acknowledge (ACK) pulse is given. An overflow
condition is defined as either bit, BF (SSPSTAT<0>), is
set, or bit, SSPOV (SSPCON1<6>), is set.
An MSSP interrupt is generated for each data transfer
byte. Flag bit, SSPIF (PIR1<3>), must be cleared in
software. The SSPSTAT register is used to determine
the status of the byte.
If SEN is enabled (SSPCON2<0> = 1), RC3/SCK/SCL
will be held low (clock stretch) following each data
transfer. The clock must be released by setting bit,
CKP (SSPCON<4>). See Section 17.4.4 “Clock
Stretching” for more detail.
La recepción del 17.4.3.2
Cuando la / W de Acto Inapropiado mordida del byte de la dirección está clara y uno
La dirección que el fósforo ocurre, la / W de Acto Inapropiado mordida del SSPSTAT
El registro es aclarado. La dirección recibida está forrada en
El 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, luego
El ningún pulso Acknowledge (el reconocimiento) es dado. Un rebalse
La condición es definida como ya sea pedacito, BF (SSPSTAT < 0 > ), es
El pedacito determinado, o, SSPOV (SSPCON1<6 > ), está listo.
Una interrupción MSSP es generada para cada reembarque de datos
El byte. El bit indicador, SSPIF (PIR1<3 > ), debe ser descongestionado adentro
El software. El registro SSPSTAT se usa para determinar
El estatus del byte.
Si SEN es facultado (SSPCON2<0 > = 1), RC3/SCK/SCL
Será punto bajo sustentado (la elasticidad del reloj) siguiendo cada información
El reembarque. El reloj debe ser soltado por pedacito poniente,
CKP (SSPCON < 4 > ). Vea Sección 17.4.4 " el Reloj
El estiramiento " para más detalle.

17.4.3.3 Transmission
When the R/W bit of the incoming address byte is set
and an address match occurs, the R/W bit of the
SSPSTAT register is set. The received address is
loaded into the SSPBUF register. The ACK pulse will
be sent on the ninth bit and the RC3/SCK/SCL pin is
held low regardless of SEN (see Section 17.4.4
“Clock Stretching” for more detail). By stretching the
clock, the master will be unable to assert another clock
pulse until the slave is done preparing the transmit
data. The transmit data must be loaded into the
SSPBUF register which also loads the SSPSR register.
Then the RC3/SCK/SCL pin should be enabled by setting
bit, CKP (SSPCON1<4>). The eight data bits are
shifted out on the falling edge of the SCL input. This
ensures that the SDA signal is valid during the SCL
high time (Figure 17-9).

La transmisión del 17.4.3.3


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

The ACK pulse from the master-receiver is latched on


the rising edge of the ninth SCL input pulse. If the SDA
line is high (not ACK), then the data transfer is
complete. In this case, when the ACK is latched by the
slave, the slave logic is reset and the slave monitors for
another occurrence of the Start bit. If the SDA line was
low (ACK), the next transmit data must be loaded into
the SSPBUF register. Again, the RC3/SCK/SCL pin
must be enabled by setting bit CKP.
An MSSP interrupt is generated for each data transfer
byte. The SSPIF bit must be cleared in software and
the SSPSTAT register is used to determine the status
of the byte. The SSPIF bit is set on the falling edge of
the ninth clock pulse.

El pulso de reconocimiento del aparato receptor maestro es al que se puso el pasador adelante
El borde ascendente del noveno pulso de aporte SCL. Si la CED
La línea es alta (no el reconocimiento), luego los datos se trasladan es
Complete. En este caso, cuando el reconocimiento es al que se puso el pasador por ahí lo
Esclavo, la lógica del esclavo es reanudación y el esclavo monitorea para
Otra ocurrencia del bit de arranque. Si la línea de CED fue
El punto bajo (el reconocimiento), lo siguiente transmiten datos deben estar forrados en
El registro SSPBUF. Otra vez, el alfiler del RC3/SCK/SCL
Debe estar habilitado colocando a CKP mordido.
Una interrupción MSSP es generada para cada reembarque de datos
El byte. El pedacito SSPIF debe ser despejado en software y
El registro SSPSTAT se usa para determinar el estatus
Del byte. El pedacito SSPIF es colocado en el borde descendente de
El noveno pulso del reloj.
17.4.4 CLOCK STRETCHING
Both 7-bit and 10-bit Slave modes implement
automatic clock stretching during a transmit sequence.
The SEN bit (SSPCON2<0>) allows clock stretching to
be enabled during receives. Setting SEN will cause
the SCL pin to be held low at the end of each data
receive sequence.

EL RELOJ DEL 17.4.4 DESPEREZÁNDOSE


Ambos modos del Esclavo de 7 pedacitos y de 10 pedacitos implementan
El reloj automático desperezándose durante uno transmite secuencia.
El pedacito SEN (SSPCON2<0 > ) consiente reloj desperezándose para
Estar habilitado durante recibe. SEN poniente dará lugar a que
El alfiler SCL para ser sustentó punto bajo al final de cada datos
Reciba secuencia.

17.4.4.1 Clock Stretching for 7-Bit Slave


Receive Mode (SEN = 1)
In 7-Bit Slave Receive mode, on the falling edge of the
ninth clock at the end of the ACK sequence if the BF
bit is set, the CKP bit in the SSPCON1 register is
automatically cleared, forcing the SCL output to be
held low. The CKP being cleared to ‘0’ will assert the
SCL line low. The CKP bit must be set in the user’s
ISR before reception is allowed to continue. By holding
the SCL line low, the user has time to service the ISR
and read the contents of the SSPBUF before the
master device can initiate another receive sequence.
This will prevent buffer overruns from occurring (see
Figure 17-13).

17.4.4.1 Clock Desperezándose para Esclavo de 7 Pedacitos


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

Note 1: If the user reads the contents of the


SSPBUF before the falling edge of the
ninth clock, thus clearing the BF bit, the
CKP bit will not be cleared and clock
stretching will not occur.
2: The CKP bit can be set in software
regardless of the state of the BF bit. The
user should be careful to clear the BF bit
in the ISR before the next receive
sequence in order to prevent an overflow
condition.

Nota 1: Si el usuario lee el contenido de lo


SSPBUF antes del borde descendente de lo
El noveno reloj, así despejándose el BF mordió, lo
El pedacito CKP no será despejado y cronometrará
El estiramiento no ocurrirá.
2: El pedacito CKP puede ser incrustado en software
A pesar del estado del pedacito BF. Lo
El usuario debería tener el cuidado de despejarse el pedacito BF
En el ISR antes de lo siguiente reciba
La secuencia para impedir un rebalse
La condición.

17.4.4.2 Clock Stretching for 10-Bit Slave


Receive Mode (SEN = 1)
In 10-Bit Slave Receive mode during the address
sequence, clock stretching automatically takes place
but CKP is not cleared. During this time, if the UA bit is
set after the ninth clock, clock stretching is initiated.
The UA bit is set after receiving the upper byte of the
10-bit address and following the receive of the second
byte of the 10-bit address with the R/W bit cleared to
‘0’. The release of the clock line occurs upon updating
SSPADD. Clock stretching will occur on each data
receive sequence as described in 7-bit mode.

17.4.4.2 Clock Desperezándose para Esclavo de 10 Pedacitos


Reciba Modo (SEN = 1)
En el modo del Esclavo Receive de 10 pedacitos durante la dirección
La secuencia, el reloj desperezándose automáticamente toma lugar
Pero CKP no es descongestionado. Durante esta vez, si la UA mordió es
Sediméntese después del noveno reloj, el estirar relojes es iniciado.
El rato UA le siguió la pista a recibir el byte superior de lo
La dirección de 10 pedacitos y después de lo reciba del segundo
El 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 actualizar
SSPADD. El estirar relojes ocurrirá en cada datos
Reciba secuencia tan descrita en el modo de 7 pedacitos.

Note: If the user polls the UA bit and clears it by


updating the SSPADD register before the
falling edge of the ninth clock occurs and if
the user hasn’t cleared the BF bit by reading
the SSPBUF register before that time,
then the CKP bit will still NOT be asserted
low. Clock stretching on the basis of the
state of the BF bit only occurs during a
data 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 lo
El borde descendente del noveno reloj ocurre y si
El usuario hasn t se despejó que el BF mordió leyendo
El registro SSPBUF antes de esa vez,
Luego el pedacito CKP no aquietará sea a lo que se hizo valer
El punto bajo. El reloj desperezándose con base en lo
El estado del pedacito BF sólo ocurre durante uno
Los datos ponen en secuencia, no una secuencia de la dirección.

17.4.4.3 Clock Stretching for 7-Bit Slave


Transmit Mode
7-Bit Slave Transmit mode implements clock stretching
by clearing the CKP bit after the falling edge of the
ninth clock if the BF bit is clear. This occurs regardless
of the state of the SEN bit.
The user’s ISR must set the CKP bit before transmission
is allowed to continue. By holding the SCL line
low, the user has time to service the ISR and load the
contents of the SSPBUF before the master device can
initiate another transmit sequence (see Figure 17-9).

17.4.4.3 Clock Desperezándose para Esclavo de 7 Pedacitos


Transmita Modo
El reloj de implementos de modo del Esclavo Transmit de 7 pedacitos desperezándose
Despejándose el CKP mordió después del borde descendente de lo
El noveno reloj si el BF mordido está claro. Esto ocurre independientemente
Del estado del pedacito SEN.
La usuaria _ s ISR deben sedimentarse que el CKP mordió antes de la transmisión
Tiene permiso de continuar. Sujetando la línea SCL
El punto bajo, el usuario tiene tiempo para reparar al ISR y carga lo
El contenido del SSPBUF antes del dispositivo maestro puede
Inicie 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 of
the ninth clock, the CKP bit will not be
cleared and clock stretching will not occur.
2: The CKP bit can be set in software
regardless 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 de
El noveno reloj, el pedacito CKP no será
El estirar aclarado de relojes y no ocurrirá.
2: El pedacito CKP puede ser incrustado en software
A pesar del estado del pedacito BF.

17.4.4.4 Clock Stretching for 10-Bit Slave


Transmit Mode
In 10-Bit Slave Transmit mode, clock stretching is
controlled during the first two address sequences by
the state of the UA bit, just as it is in 10-Bit Slave
Receive mode. The first two addresses are followed
by a third address sequence which contains the highorder
bits of the 10-bit address and the R/W bit set to
‘1’. After the third address sequence is performed, the
UA bit is not set, the module is now configured in
Transmit mode and clock stretching is controlled by
the BF flag as in 7-Bit Slave Transmit mode (see
Figure 17-11).

17.4.4.4 Clock Desperezándose para Esclavo de 10 Pedacitos


Transmita Modo
En el modo del Esclavo Transmit de 10 pedacitos, el estirar relojes es
Controlado durante las primeras dos secuencias de la dirección por ahí
El estado de la UA mordió, tal como está en Esclavo de 10 pedacitos
Reciba modo. Las primeras dos direcciones son seguidas
Por una tercera secuencia de la dirección que contiene el highorder
Los 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, lo
El pedacito UA no está colocado, el módulo es ahora configurado adentro
Transmita modo y el estirar relojes se controla por ahí
La bandera BF tan en el modo del Esclavo Transmit de 7 pedacitos (vea
La Figura 17-11).

17.4.4.5 Clock Synchronization and


the CKP bit
When the CKP bit is cleared, the SCL output is forced
to ‘0’. However, clearing the CKP bit will not assert the
SCL output low until the SCL output is already
sampled low. Therefore, the CKP bit will not assert the
SCL line until an external I2C master device has already asserted the SCL line. The SCL output will
remain low until the CKP bit is set and all other
devices on the I2C bus have deasserted SCL. This
ensures that a write to the CKP bit will not violate the
minimum high time requirement for SCL (see
Figure 17-12).

La Sincronización del Reloj del 17.4.4.5 y


El CKP mordió
Cuando el CKP mordido es descongestionado, la salida SCL es obtenida a la fuerza
Para _ 0. Sin embargo, descongestionar al CKP mordido no afirmará lo
La salida SCL baja hasta la salida SCL está ya
El punto bajo probado. Por consiguiente, el pedacito CKP no afirmará lo
La 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 otro
Los dispositivos en el autobús I2C tienen a deasserted SCL. Esto
Asegura que uno de escritura para el pedacito CKP no violará lo
El requisito de tiempo alto mínimo para SCL (vea
La Figura 17-12).
17.4.5 GENERAL CALL ADDRESS
SUPPORT
The addressing procedure for the I2C bus is such that
the first byte after the Start condition usually
determines which device will be the slave addressed by
the master. The exception is the general call address
which can address all devices. When this address is
used, all devices should, in theory, respond with an
Acknowledge.
The general call address is one of eight addresses
reserved for specific purposes by the I2C protocol. It
consists of all ‘0’s with R/W = 0.
The general call address is recognized when the
General 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 is
compared against the SSPADD. It is also compared to
the general call address and fixed in hardware.

LA DIRECCIÓN DE LLAMADA DEL GENERAL DEL 17.4.5


El SOPORTE
El procedimiento de direccionamiento para el autobús I2C es tal que
El primer byte después de la condición de Principio usualmente
Determina cuál dispositivo será el esclavo tratado según
El amo. La excepción es la dirección general de llamada
Que pueda poner la dirección en todos los dispositivos. Cuando esta dirección es
Usados, todos los dispositivos, en teoría, deberían responder con uno
Acuse recibo.
La dirección general de llamada es una de ocho direcciones
Confidencial para los propósitos específicos por el protocolo I2C. Eso
Consta de todas las _ 0 _ s con Acto Inapropiado / W = 0.
La dirección general de llamada es reconocida cuando lo
La 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 es
Comparado 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 is


transferred to the SSPBUF, the BF flag bit is set (eighth
bit) and on the falling edge of the ninth bit (ACK bit), the
SSPIF interrupt flag bit is set.
When the interrupt is serviced, the source for the
interrupt can be checked by reading the contents of the
SSPBUF. The value can be used to determine if the
address was device specific or a general call address.
In 10-bit mode, the SSPADD is required to be updated
for the second half of the address to match and the UA
bit (SSPSTAT<1>) is set. If the general call address is
sampled when the GCEN bit is set, while the slave is
configured in 10-Bit Addressing mode, then the second
half of the address is not necessary, the UA bit will not
be set and the slave will begin receiving data after the
Acknowledge (Figure 17-15).

Si la dirección general de llamada equivale, el SSPSR es


Cedida para el SSPBUF, la bandera BF mordida está colocada (el octavo
El pedacito) y en el borde descendente del pedacito del noveno (el reconocimiento mordido), lo
El bit indicador de interrupción SSPIF está colocado.
Cuando la interrupción es reparada, la fuente para lo
La interrupción puede ser comprobada leyendo el contenido de lo
SSPBUF. El valor puede usarse para determinar si lo
La 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 corriente
Para que el segundo la mitad de dirección correspondan y la UA
El pedacito (SSPSTAT < 1 > ) está colocado. Si la dirección general de llamada es
Probado cuando el GCEN mordido está listo, mientras el esclavo lo hace
Configurado en modo de 10 pedacitos que Le Dirige la Palabra a, luego el segundo
La 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 lo
Acuse Recibo (la Figura 17-15).

17.4.6 MASTER MODE


Master mode is enabled by setting and clearing the
appropriate SSPM bits in SSPCON1 and by setting the
SSPEN bit. In Master mode, the SCL and SDA lines
are manipulated by the MSSP hardware.
Master mode of operation is supported by interrupt
generation on the detection of the Start and Stop
conditions. The Stop (P) and Start (S) bits are cleared
from a Reset or when the MSSP module is disabled.
Control of the I2C bus may be taken when the P bit is
set, or the bus is Idle, with both the S and P bits clear.
In Firmware Controlled Master mode, user code
conducts all I2C bus operations based on Start and
Stop bit conditions.
Once Master mode is enabled, the user has six
options.
1. Assert a Start condition on SDA and SCL.
2. Assert a Repeated Start condition on SDA and
SCL.
3. Write to the SSPBUF register initiating
transmission of data/address.
4. Configure the I2C port to receive data.
5. Generate an Acknowledge condition at the end
of a received byte of data.
6. Generate a Stop condition on SDA and SCL.

EL MODO DEL AMO DEL 17.4.6


El modo maestro está habilitado sedimentándose y despejándose lo
Asigne pedacitos SSPM en SSPCON1 y sedimentándose lo
SSPEN mordió. En el modo amo, el SCL y líneas de CED
Es manipulado por el hardware MSSP.
La modalidad de operación maestra es soportada por la interrupción
La generación en la detección del Principio y el Alto
Las condiciones. El Alto (P) y pedacitos de Principio (S) son despejados
De 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 es
El 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 usuario
Dirige todo I2C que las operaciones del autobús basaron en el Principio y
Las condiciones del bit de parada.
Una vez que el modo amo está habilitado, el usuario tiene seis
Las opciones.
1. Afirme una condición de Principio en la CED y SCL.
2. Afirme una Repetida condición de Principio en la CED y
SCL.
3. Escríbale al registrador SSPBUF iniciando
La transmisión de datos /dirección.
4. Configure el puerto I2C para recibir datos.
5. Genere una condición Acknowledge al final
De un byte recibido de datos.
6. Genere una condición de Alto en la CED y SCL

Note: The MSSP module, when configured in


I2C Master mode, does not allow queueing
of events. For instance, the user is not
allowed to initiate a Start condition and
immediately write the SSPBUF register to
initiate transmission before the Start
condition is complete. In this case, the
SSPBUF will not be written to and the
WCOL bit will be set, indicating that a write
to the SSPBUF did not occur.

Nota: El módulo MSSP, estando configurado adentro


I2C Domine con Maestría modo, no le permite queueing
De acontecimientos. Por ejemplo, el usuario no es
Permitido para iniciar una condición de Principio y
Inmediatamente escriba al SSPBUF el registro para
Inicie transmisión antes del Principio
La condición es completa. En este caso, lo
SSPBUF le escribió y lo
El pedacito WCOL estará colocado, indicando eso uno de escritura
Para el SSPBUF no ocurrió.

The following events will cause the MSSP Interrupt


Flag bit, SSPIF, to be set (MSSP interrupt, if enabled):
• Start condition
• Stop condition
• Data transfer byte transmitted/received
• Acknowledge transmit
• Repeated Start
Los siguientes acontecimientos causarán la Interrupción MSSP
El 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 Operation


The master device generates all of the serial clock
pulses and the Start and Stop conditions. A transfer is
ended with a Stop condition or with a Repeated Start
condition. Since the Repeated Start condition is also
the beginning of the next serial transfer, the I2C bus will
not be released.
In Master Transmitter mode, serial data is output
through SDA, while SCL outputs the serial clock. The
first byte transmitted contains the slave address of the
receiving device (7 bits) and the Read/Write (R/W) bit.
In this case, the R/W bit will be logic ‘0’. Serial data is
transmitted 8 bits at a time. After each byte is transmitted,
an Acknowledge bit is received. Start and Stop
conditions are output to indicate the beginning and the
end of a serial transfer.

17.4.6.1 I2C Master Mode Operation


El dispositivo maestro genera todo el reloj de la novela por entregas
Pulso y las condiciones de Principio y de Alto. Un reembarque es
Finalizado con una condición de Alto o con un Repetido Principio
La condición. Desde el Repetido Principio que la condición está también
El 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 salida
A través de la CED, mientras SCL devuelve el reloj serial. Lo
El primer byte transmitido contiene la dirección del esclavo de lo
Recibiendo 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 son
Pedacitos 8 transmitidos a la vez. Después de que cada byte sea transmitido,
Un pedacito Acknowledge es recibido. El Principio y el Alto
Las condiciones son salida para indicar el comienzo y lo
El fin de una transferencia secuencial.

In Master Receive mode, the first byte transmitted


contains the slave address of the transmitting device
(7 bits) and the R/W bit. In this case, the R/W bit will be
logic ‘1’. Thus, the first byte transmitted is a 7-bit slave
address followed by a ‘1’ to indicate the receive bit.
Serial data is received via SDA, while SCL outputs the
serial clock. Serial data is received 8 bits at a time. After
each byte is received, an Acknowledge bit is transmitted.
Start and Stop conditions indicate the beginning
and end of transmission.
The Baud Rate Generator used for the SPI mode
operation is used to set the SCL clock frequency for
either 100 kHz, 400 kHz or 1 MHz I2C operation. See
Section 17.4.7 “Baud Rate” for more detail.

En el modo Amo Receive, el primer byte transmitido


Contiene 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 pedacitos
La dirección seguida por uno _ 1 _ para indicar lo recibe mordido.
Los datos seriales son recibidos por la CED, mientras SCL devuelve lo
El reloj serial. Los datos seriales son recibidos 8 pedacitos a la vez. Después
Cada byte es recibido, un Acknowledge mordido es transmitido.
El principio y las condiciones de Alto indican el comienzo
Y la despedida del aire.
El Baud Rate Generator usó para el modo SPI
La operación se usa para establecer la frecuencia del reloj SCL para
Ya sea 100 kHz, 400 la operación kHz o 1 MHz I2C. Vea
Secció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 setting
the Start Enable bit, SEN (SSPCON2<0>).
2. SSPIF is set. The MSSP module will wait the
required start time before any other operation
takes place.
3. The user loads the SSPBUF with the slave
address to transmit.
4. Address is shifted out the SDA pin until all 8 bits
are transmitted.
5. The MSSP module shifts in the ACK bit from the
slave device and writes its value into the
SSPCON2 register.
6. The MSSP module generates an interrupt at the
end of the ninth clock cycle by setting the SSPIF
bit.
7. The user loads the SSPBUF with eight bits of
data.
8. Data is shifted out the SDA pin until all 8 bits are
transmitted.
9. The MSSP module shifts in the ACK bit from the
slave device and writes its value into the
SSPCON2 register.
10. The MSSP module generates an interrupt at the
end of the ninth clock cycle by setting the SSPIF
bit.
11. The user generates a Stop condition by setting
the Stop Enable bit, PEN (SSPCON2<2>).
12. Interrupt is generated once the Stop condition is
complete.

Uno típico transmite secuencia iría como sigue:


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

17.4.7 BAUD RATE


In I2C Master mode, the Baud Rate Generator (BRG)
reload value is placed in the lower 7 bits of the
SSPADD register (Figure 17-17). When a write occurs
to SSPBUF, the Baud Rate Generator will automatically
begin counting. The BRG counts down to ‘0’ and stops
until another reload has taken place. The BRG count is
decremented twice per instruction cycle (TCY) on the
Q2 and Q4 clocks. In I2C Master mode, the BRG is
reloaded automatically.

LA VELOCIDAD EN BAUDIOS DEL 17.4.7


En el modo Amo I2C, el Baud Rate Generator (BRG)
Vuelva a cargar valor es colocado en los pedacitos 7 inferiores de lo
SSPADD regístrese (la Figura 17-17). Cuando uno de escritura ocurre
Para SSPBUF, el Generador de Velocidad en Baudios lega automáticamente
Empiece conteo. El BRG cuenta hacia atrás para _ 0 _ y se detiene
Hasta otro vuelva a cargar ha tenido lugar. La cuenta BRG es
El decremented dos veces por el ciclo de búsqueda y ejecución (TCY) en lo
Los relojes Q2 y Q4. En el modo Amo I2C, el BRG es
Vuelto a cargar automáticamente.

Once the given operation is complete (i.e., transmission


of the last data bit is followed by ACK), the internal
clock will automatically stop counting and the SCL pin
will remain in its last state.
Table 17-3 demonstrates clock rates based on
instruction cycles and the BRG value loaded into
SSPADD.

Una vez que la operación dada es completa (i.e., La transmisión


De los últimos datos el pedacito es perseguido por reconocimiento), lo interno
El reloj automáticamente dejará de conteo y el alfiler SCL
Se quedará en su último estado.
El 17-3 de la mesa demuestra tasas del reloj basadas adelante
Los ciclos de búsqueda y ejecución y el valor BRG cargados en
SSPADD.
Note 1: The I2C interface does not conform to the 400 kHz I2C specification (which applies to rates greater
than
100 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 que
100 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 Arbitration


Clock arbitration occurs when the master, during any
receive, 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 Baud
Rate Generator (BRG) is suspended from counting
until 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> and
begins counting. This ensures that the SCL high time
will always be at least one BRG rollover count in the
event that the clock is held low by an external device
(Figure 17-18).

El Arbitraje del Reloj del 17.4.7.1


El arbitraje del reloj ocurre cuando el amo, durante cualquier
Reciba, 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 Baudio
El generador de tasa (BRG) es suspendido de contar
Hasta 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 > y
Empieza conteo. Esto asegura que el tiempo de alto SCL
Siempre estará en mínimo escrutinio de refinanciación BRG en lo
El acontecimiento que el reloj es sustentó punto bajo por un dispositivo externo
(La Figura 17-18).
17.4.8 I2C MASTER MODE START
CONDITION TIMING
To initiate a Start condition, the user sets the Start
Enable bit, SEN (SSPCON2<0>). If the SDA and SCL
pins are sampled high, the Baud Rate Generator is
reloaded with the contents of SSPADD<6:0> and starts
its count. If SCL and SDA are both sampled high when
the Baud Rate Generator times out (TBRG), the SDA
pin is driven low. The action of the SDA being driven
low while SCL is high is the Start condition and causes
the S bit (SSPSTAT<3>) to be set. Following this, the
Baud Rate Generator is reloaded with the contents of
SSPADD<6:0> and resumes its count. When the Baud
Rate Generator times out (TBRG), the SEN bit
(SSPCON2<0>) will be automatically cleared by
hardware; the Baud Rate Generator is suspended,
leaving the SDA line held low and the Start condition is
complete.

17.4.8 I2C DOMINE CON MAESTRÍA PRINCIPIO de MODO


CONDICIONE OPORTUNIDAD DEL MOMENTO
Para iniciar una condición de Principio, el usuario establece el Principio
Faculte pedacito, SEN (SSPCON2<0 > ). Si la CED y SCL
Los alfileres son alto probado, el Baud Rate Generator es
Vuelto a cargar con el contenido de SSPADD < 6:0 > y principios
Su cuenta. Si SCL y CED son ambos tomaron muestras a gran altura cuando
El Baud Rate Generator cronometra fuera (TBRG), la CED
El alfiler es punto bajo conducido. La acción de la CED siendo conducido
Muja mientras SCL está drogado es la condición de Principio y las causas
La S mordida (SSPSTAT < 3 > ) para ser determinada. Después de esto, lo
El generador de velocidad en baudios es vuelto a cargar con el contenido de
SSPADD < 6:0 > y curriculumes vitaes su cuenta. Cuando el Baudio
El 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 son
Complete.

Note: If at the beginning of the Start condition,


the SDA and SCL pins are already sampled
low, or if during the Start condition, the
SCL line is sampled low before the SDA
line is driven low, a bus collision occurs,
the Bus Collision Interrupt Flag, BCLIF, is
set, the Start condition is aborted and the
I2C 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
El punto bajo, o si durante el Principio pone en forma, lo
La línea SCL es punto bajo probado antes de la CED
La 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, es
Círculo, la condición de Principio es abortada y lo
El módulo I2C es puesto a cero en su estado Desocupado.

17.4.8.1 WCOL Status Flag


If the user writes the SSPBUF when a Start sequence
is in progress, the WCOL is set and the contents of the
buffer are unchanged (the write doesn’t occur).

17.4.8.1 Bandera WCOL Status


Si el usuario le escribe al SSPBUF cuando una secuencia de Principio
Es en curso, el WCOL está listo y el contenido de lo
El amortiguador está inalterado (el doesn t de escritura ocurra).

Note: Because queueing of events is not


allowed, writing to the lower 5 bits of
SSPCON2 is disabled until the Start
condition is complete.

Nota: Porque el queueing de acontecimientos no es


La escritura permitida, para los pedacitos 5 inferiores de
El SSPCON2 está deshabilitado hasta el Principio
La condición es completa.

17.4.9 I2C MASTER MODE REPEATED


START CONDITION TIMING
A Repeated Start condition occurs when the RSEN bit
(SSPCON2<1>) is programmed high and the I2C logic
module is in the Idle state. When the RSEN bit is set,
the SCL pin is asserted low. When the SCL pin is
sampled low, the Baud Rate Generator is loaded with
the contents of SSPADD<5:0> and begins counting.
The SDA pin is released (brought high) for one Baud
Rate Generator count (TBRG). When the Baud Rate
Generator times out, if SDA is sampled high, the SCL
pin will be deasserted (brought high). When SCL is
sampled high, the Baud Rate Generator is reloaded
with 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. Following
this, the RSEN bit (SSPCON2<1>) will be automatically
cleared and the Baud Rate Generator will not be
reloaded, leaving the SDA pin held low. As soon as a
Start condition is detected on the SDA and SCL pins,
the S bit (SSPSTAT<3>) will be set. The SSPIF bit will
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 PRINCIPIO
Una Repetida condición de Principio ocurre cuando el RSEN mordió
(SSPCON2<1 > ) son alto programado y la lógica I2C
El módulo está en el estado Desocupado. Cuando el RSEN mordido está listo,
El alfiler SCL está afirmado bajo. Cuando el alfiler SCL es
El punto bajo probado, el Baud Rate Generator está forrado con
El contenido de SSPADD < 5:0 > y empieza el conteo.
El alfiler de CED es soltado (el alto traído) para un Baudio
La cuenta de tasa Generator (TBRG). Cuando la Velocidad en Baudios
El generador cronometra fuera, si SDA fuera tomó muestras a gran altura, el SCL
El alfiler será deasserted (el alto traído). Cuando SCL es
Probado alto, el Baud Rate Generator es vuelto a cargar
Con 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 de
Esto, el RSEN mordido (SSPCON2<1 > ) será automáticamente
Aclarado y el Baud Rate Generator no será
Vuelto a cargar, dejar el alfiler SDA sustentó punto bajo. Tan pronto como uno
La 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 other


event is in progress, it will not take effect.
2: A bus collision during the Repeated Start
condition occurs if:
• SDA is sampled low when SCL goes
from low-to-high.
• SCL goes low before SDA is
asserted low. This may indicate that
another master is attempting to
transmit a data ‘1’.

Nota 1: Si RSEN es sistemático mientras cualquier otro


El acontecimiento es en curso, no se llevará a efecto.
2: Una colisión del autobús durante el Repetido Principio
La condición ocurre si:
•†La CED es punto bajo probado cuando SCL va
De punto bajo para el alto.
•†SCL se vuelve humilde antes de la CED es
Afirmó punto bajo. Esto puede indicar eso
Otro amo intenta para
Transmita una información _ 1.

Immediately following the SSPIF bit getting set, the user


may write the SSPBUF with the 7-bit address in 7-bit
mode, or the default first address in 10-bit mode. After
the first eight bits are transmitted and an ACK is
received, the user may then transmit an additional eight
bits of address (10-bit mode) or eight bits of data (7-bit
mode).

Inmediatamente después del pedacito SSPIF quedando determinado, el usuario


Le puede escribir al SSPBUF con la dirección de 7 pedacitos adentro de 7 pedacitos
El modo, o la dirección primera predeterminada en el modo de 10 pedacitos. Después
Los primeros ocho pedacitos son transmitidos y un reconocimiento es
Admitido por la mayoría, el usuario luego puede transmitir uno adicional ocho
Los pedacitos de dirección (de 7 pedacitos (el modo de 10 pedacitos) u ocho pedacitos de datos
El modo).

17.4.9.1 WCOL Status Flag


If the user writes the SSPBUF when a Repeated Start
sequence is in progress, the WCOL is set and the
contents of the buffer are unchanged (the write doesn’t
occur).

17.4.9.1 Bandera WCOL Status


Si el usuario le escribe al SSPBUF cuando un Repetido Principio
La secuencia es en curso, el WCOL está listo y lo
El contenido del amortiguador está inalterado (el doesn t de escritura
Ocurre).

Note: Because queueing of events is not


allowed, writing of the lower 5 bits of
SSPCON2 is disabled until the Repeated
Start condition is complete.

Nota: Porque el queueing de acontecimientos no es


La escritura permitida, de los pedacitos 5 inferiores de
El SSPCON2 está deshabilitado hasta el Repeated
La condición de principio es completa.

17.4.10 I2C MASTER MODE TRANSMISSION


Transmission 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 specification
parameter 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 MODO


La 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 tiempo
El 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
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 SSPBUF
Dejando 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 Flag


In Transmit mode, the BF bit (SSPSTAT<0>) is set
when the CPU writes to SSPBUF and is cleared when
all 8 bits are shifted out.
17.4.10.2 WCOL Status Flag
If the user writes the SSPBUF when a transmit is
already in progress (i.e., SSPSR is still shifting out a
data byte), the WCOL flag is set and the contents of the
buffer are unchanged (the write doesn’t occur) after
2 TCY after the SSPBUF write. If SSPBUF is rewritten
within 2 TCY, the WCOL bit is set and SSPBUF is
updated. This may result in a corrupted transfer. The
user should verify that the WCOL flag is clear after
each write to SSPBUF to ensure the transfer is correct.

17.4.10.1 Bandera BF Status


En el modo Transmit, el pedacito BF (SSPSTAT < 0 > ) está colocado
Cuando la UPC le escribe a SSPBUF y es despejado cuando
Todos los 8 pedacitos son intercambiados fuera.
17.4.10.2 Bandera WCOL Status
Si el usuario le escribe al SSPBUF cuando uno transmita es
Ya en el progreso (i.e., SSPSR todavía cambia de posición fuera uno
El byte de datos), la bandera WCOL está colocada y el contenido de lo
El amortiguador está inalterado (el doesn t de escritura ocurra) después
2 TCY después del SSPBUF escriben. Si SSPBUF es reescrito
Dentro de 2 TCY, el WCOL mordido está listo y SSPBUF es
Actualizado. Esto puede dar como resultado un reembarque corrompido. Lo
El usuario debería comprobar que la bandera WCOL es clara después
Cada uno le escribe a SSPBUF para asegurar el reembarque es correcto.

17.4.10.3 ACKSTAT Status Flag


In Transmit mode, the ACKSTAT bit (SSPCON2<6>) is
cleared 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 when
it has recognized its address (including a general call),
or when the slave has properly received its data.
17.4.11 I2C MASTER MODE RECEPTION
Master mode reception is enabled by programming the
Receive Enable bit, RCEN (SSPCON2<3>).

17.4.10.3 Bandera ACKSTAT Status


En el modo Transmit, el pedacito ACKSTAT (SSPCON2<6 > ) es
Aclarado 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ándo
Eso 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 MODO
La recepción maestra de modo está habilitada programando lo
Reciba al pedacito Enable, RCEN (SSPCON2<3 > ).

Note: The MSSP module must be in an Idle state


before the RCEN bit is set or the RCEN bit
will be disregarded.

Nota: El módulo MSSP debe estar en un estado Desocupado


Antes 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 each


rollover, the state of the SCL pin changes (high-to-low/
low-to-high) and data is shifted into the SSPSR. After
the falling edge of the eighth clock, the receive enable
flag is automatically cleared, the contents of the
SSPSR are loaded into the SSPBUF, the BF flag bit is
set, the SSPIF flag bit is set and the Baud Rate Generator
is suspended from counting, holding SCL low. The
MSSP is now in Idle state awaiting the next command.
When the buffer is read by the CPU, the BF flag bit is
automatically cleared. The user can then send an
Acknowledge bit at the end of reception by setting the
Acknowledge Sequence Enable bit, ACKEN
(SSPCON2<4>).

El Baud Rate Generator empieza conteo y en cada uno


La refinanciación, el estado de los cambios del alfiler SCL (a gran altura para mugir
El punto bajo para el alto) y los datos son intercambiados en el SSPSR. Después
El borde descendente del octavo reloj, lo reciba permita
La bandera es automáticamente aclarada, el contenido de lo
SSPSR está forrado en el SSPBUF, el bit indicador BF es
Círculo, el bit indicador SSPIF está colocado y el Generador de Velocidad en Baudios
Es suspendido de contar, sustentar punto bajo SCL. Lo
MSSP está ahora en estado Desocupado esperando la siguiente orden.
Cuándo el amortiguador es leído por la UPC, el bit indicador BF es
Automáticamente aclarado. El usuario luego puede enviar uno
Acuse recibo pedacito al final de la recepción sedimentándose lo
Agradezca que la Secuencia Enable mordió, ACKEN
(SSPCON2<4 > ).

17.4.11.1 BF Status Flag


In receive operation, the BF bit is set when an address
or data byte is loaded into SSPBUF from SSPSR. It is
cleared when the SSPBUF register is read.
17.4.11.2 SSPOV Status Flag
In receive operation, the SSPOV bit is set when 8 bits
are received into the SSPSR and the BF flag bit is
already set from a previous reception.
17.4.11.3 WCOL Status Flag
If the user writes the SSPBUF when a receive is
already in progress (i.e., SSPSR is still shifting in a data
byte), the WCOL bit is set and the contents of the buffer
are unchanged (the write doesn’t occur).
17.4.11.1 Bandera BF Status
Adentro reciba operación, el BF mordido está listo cuando una dirección
O el byte de datos es cargado en SSPBUF de SSPSR. Es
Aclarado cuando el registro SSPBUF es leído.
17.4.11.2 Bandera SSPOV Status
Adentro reciba operación, el SSPOV mordido está listo cuando 8 pedacitos
Es recibido en el SSPSR y el bit indicador BF es
Ya sediméntese de una recepción previa.
17.4.11.3 Bandera WCOL Status
Si el usuario le escribe al SSPBUF cuando uno reciba es
Ya en el progreso (i.e., SSPSR todavía cambia de posición en una información
El byte), el pedacito WCOL está colocado y el contenido del amortiguador
Está inalterado (el doesn t de escritura ocurra).
17.4.12 ACKNOWLEDGE SEQUENCE
TIMING
An 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 generate
an Acknowledge, then the ACKDT bit should be cleared. If not, the user should set the ACKDT bit before
starting 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 Flag
If the user writes the SSPBUF when an Acknowledge sequence is in progress, then WCOL is set and the
contents of the buffer are unchanged (the write doesn’t occur).

17.4.12 ADMITE SECUENCIA


La OPORTUNIDAD DEL MOMENTO
Una 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 generar
Un Acknowledge, luego el ACKDT mordido debería ser descongestionado. En caso de que no, el usuario
debería sedimentarse que el ACKDT mordió antes
Iniciando 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 Status
Si el usuario le escribe al SSPBUF cuando una secuencia Acknowledge es en curso, luego WCOL está
listo y lo
El contenido del amortiguador está inalterado (el doesn t de escritura ocurra).

17.4.13 STOP CONDITION TIMING


A 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 Flag
If the user writes the SSPBUF when a Stop sequence is in progress, then the WCOL bit is set and the
contents of the buffer are unchanged (the write doesn’t occur).

LA OPORTUNIDAD DEL MOMENTO DE CONDICIÓN DE ALTO DEL 17.4.13


Un 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 Status
Si el usuario le escribe al SSPBUF cuando una secuencia de Alto es en curso, luego el WCOL mordido
está listo y lo
El contenido del amortiguador está inalterado (el doesn t de escritura ocurra).
17.4.14 SLEEP OPERATION
While in Sleep mode, the I2C module can receive
addresses or data and when an address match or
complete byte transfer occurs, wake the processor
from Sleep (if the MSSP interrupt is enabled).
17.4.15 EFFECTS OF A RESET
A Reset disables the MSSP module and terminates the
current transfer.

LA OPERACIÓN DE SUEÑO DEL 17.4.14


Mientras en el modo de Sueño, el módulo I2C puede recibir
Las direcciones o los datos y cuando una dirección equivalen o
El reembarque completo de byte ocurre, despierte el procesador
De Sueño (si la interrupción MSSP está habilitada).
17.4.15 EFECTÚA DE UNA REANUDACIÓN
Una Reanudación desactiva el módulo MSSP y termina la relación lo
El reembarque actual.

17.4.16 MULTI-MASTER MODE


In Multi-Master mode, the interrupt generation on the
detection of the Start and Stop conditions allows the
determination of when the bus is free. The Stop (P) and
Start (S) bits are cleared from a Reset or when the
MSSP module is disabled. Control of the I2C bus may
be taken when the P bit (SSPSTAT<4>) is set, or the
bus is Idle, with both the S and P bits clear. When the
bus is busy, enabling the MSSP interrupt will generate
the interrupt when the Stop condition occurs.
In multi-master operation, the SDA line must be
monitored for arbitration to see if the signal level is the
expected output level. This check is performed in
hardware with the result placed in the BCLIF bit.
The states where arbitration can be lost are:
• Address Transfer
• Data Transfer
• A Start Condition
• A Repeated Start Condition
• An Acknowledge Condition

EL MODO DEL MULTIAMO DEL 17.4.16


En el modo maestro a Multi, la generación de interrupción en lo
La detección del Principio y las condiciones de Alto da rienda suelta a que lo
La determinación de cuando el autobús es gratis. El Alto (P) y
Los pedacitos de principio (S) son despejados de una Reanudación o cuando lo
El módulo MSSP está deshabilitado. El control del autobús I2C puede
Estar ocupado cuando el pedacito de la P (SSPSTAT < 4 > ) está colocado, o lo
El autobús está Desocupado, con ambos la S y los pedacitos P se descongestionan. Cuando lo
El 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 ser
Monitoreado para el arbitraje ver si la señal nivel es lo
Esperó nivel de salida. Esta comprobación es realizado adentro
El 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 BUS
ARBITRATION
Multi-Master mode support is achieved by bus arbitration.
When the master outputs address/data bits onto
the SDA pin, arbitration takes place when the master
outputs a ‘1’ on SDA, by letting SDA float high and
another master asserts a ‘0’. When the SCL pin floats
high, data should be stable. If the expected data on
SDA is a ‘1’ and the data sampled on the SDA pin = 0,
then a bus collision has taken place. The master will set
the Bus Collision Interrupt Flag, BCLIF, and reset the
I2C port to its Idle state (Figure 17-25).
If a transmit was in progress when the bus collision
occurred, the transmission is halted, the BF flag is
cleared, the SDA and SCL lines are deasserted and the
SSPBUF can be written to. When the user services the
bus collision Interrupt Service Routine, and if the I2C
bus is free, the user can resume communication by
asserting a Start condition.

17.4.17 MULTI - DOMINE CON MAESTRÍA COMUNICACIÓN,


LA COLISIÓN DEL AUTOBÚS Y EL AUTOBÚS
El ARBITRAJE
El soporte maestro a Multi de modo es logrado por el arbitraje de bus.
Cuando el amo devuelve bits de la dirección /datos encima de
El alfiler de CED, arbitraje el lugar de tomas cuando el amo
Devuelve uno _ 1 _ en la CED, dejando CED comanditar a gran altura y
Otro amo afirma uno _ 0. Cuando el alfiler SCL flota
El alto, los datos debería ser estable. Si los datos esperados adelante
La 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 lo
I2C ponga a babor para su estado Desocupado (la Figura 17-25).
Si uno transmita fue en marcha cuando la colisión del autobús
Ocurrida, la transmisión está suspendida, la bandera BF es
Aclaradas, la CED y líneas SCL son deasserted y lo
Se le escribió a SSPBUF. Cuando el usuario repara lo
La rutina de servicio de Interrupción de colisión del autobús, y si el I2C
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 Acknowledge


condition was in progress when the bus collision
occurred, the condition is aborted, the SDA and SCL
lines are deasserted and the respective control bits in
the SSPCON2 register are cleared. When the user services
the bus collision Interrupt Service Routine, and if
the I2C bus is free, the user can resume communication
by asserting a Start condition.
The master will continue to monitor the SDA and SCL
pins. If a Stop condition occurs, the SSPIF bit will be set.
A write to the SSPBUF will start the transmission of
data at the first data bit, regardless of where the
transmitter left off when the bus collision occurred.
In Multi-Master mode, the interrupt generation on the
detection of Start and Stop conditions allows the
determination of when the bus is free. Control of the I2C
bus can be taken when the P bit is set in the SSPSTAT
register, or the bus is Idle and the S and P bits are
cleared.

Si Un Punto de Partida, Repeated Arranque, el Alto o Acknowledge


La condición estaba en curso cuando la colisión del autobús
Ocurrida, la condición es abortada, la CED y SCL
Las líneas son deasserted y los pedacitos respectivos de control adentro
El registro del SSPCON2 es aclarado. Cuando el usuario repara
La Rutina de Servicio de Interrupción de colisión del autobús, y si
El autobús I2C es gratis, el usuario puede reanudar comunicación
Afirmando una condición de Principio.
El amo continuará monitoreando la CED y SCL
Los alfileres. Si un Alto que la condición ocurre, el SSPIF mordida estará listo.
Uno de escritura para el SSPBUF iniciará la transmisión de
Los datos en el primer bit de datos, a pesar de donde lo
El transmisor dejó de cuando la colisión del autobús ocurrió.
En el modo maestro a Multi, la generación de interrupción en lo
La detección de condiciones de Principio y de Alto da rienda suelta a que lo
La determinación de cuando el autobús es gratis. El control del I2C
El autobús puede estar ocupado cuando el pedacito de la P es incrustado en el SSPSTAT
El registro, o el autobús es Idle y la S y P que los pedacitos son
Aclarado.

17.4.17.1 Bus Collision During a


Start Condition
During a Start condition, a bus collision occurs if:
a) SDA or SCL are sampled low at the beginning of
the 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
pins are monitored.
If the SDA pin is already low, or the SCL pin is already
low, 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 Uno


La Condición de Principio
Durante una condición de Principio, una colisión del autobús ocurre si:
uno) La CED o SCL es punto bajo probado al principio de
La 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 SCL
Los alfileres son monitoreados.
Si el alfiler de CED está ya bajo, o el alfiler SCL está ya
El 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, the


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

Si el alfiler de CED es probó muja durante esta cuenta, lo


BRG 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 CED
El alfiler, el alfiler de CED está afirmado bajo al final del BRG
La cuenta. El Baud Rate Generator es entonces vuelto a cargar y
Las cuentas regresivas para 0; Si el alfiler SCL es probado como _ 0
Durante este tiempo, una colisión del autobús no ocurre. En lo
El fin de la cuenta BRG, el alfiler SCL está afirmado bajo.

Note: The reason that bus collision is not a factor


during a Start condition is that no two bus
masters can assert a Start condition at the
exact same time. Therefore, one master
will always assert SDA before the other.
This condition does not cause a bus
collision because the two masters must be
allowed to arbitrate the first address
following the Start condition. If the address
is the same, arbitration must be allowed to
continue into the data portion, Repeated
Start or Stop conditions.

Nota: La razón por la que esa colisión del autobús no es un factor


Durante un Principio la condición está ese no dos autobús
Los amos pueden afirmar una condición de Principio en lo
El tiempo mismo exacto. Por consiguiente, un amo
Siempre afirmará CED antes del otro.
Esta condición no causa un autobús
La colisión porque el dos amaestra debe ser
Permitido para arbitrar el primer discurso
Después de la condición de Principio. Si la dirección
Es lo mismo, el arbitraje debe ser admitido para
Continúe en la porción de datos, Repetido
Empiece o Alto condiciones.
17.4.17.2 Bus Collision During a Repeated
Start Condition
During a Repeated Start condition, a bus collision
occurs if:
a) A low level is sampled on SDA when SCL goes
from low level to high level.
b) SCL goes low before SDA is asserted low,
indicating that another master is attempting to
transmit a data ‘1’.
When the user deasserts SDA and the pin is allowed to
float high, the BRG is loaded with SSPADD<6:0> and
counts down to 0. The SCL pin is then deasserted and
when sampled high, the SDA pin is sampled.

La Colisión del Autobús del 17.4.17.2 Durante Un Repeated


La Condición de Principio
Durante una Repetida condición de Principio, una colisión del autobús
Ocurre si:
uno) Un nivel bajo es probado en la CED cuando SCL va
De 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 para
Transmita una información _ 1.
Cuando la CED de deasserts del usuario y el alfiler son permitidos
Flote a gran altura, el BRG está forrado con SSPADD < 6:0 > y
Las cuentas regresivas para 0. El alfiler SCL es luego deasserted y
Cuando se prueba alto, el alfiler de CED es probado.

If SDA is low, a bus collision has occurred (i.e., another


master is attempting to transmit a data ‘0’, Figure 17-29).
If SDA is sampled high, the BRG is reloaded and begins
counting. If SDA goes from high-to-low before the BRG
times out, no bus collision occurs because no two
masters can assert SDA at exactly the same time.
If SCL goes from high-to-low before the BRG times out
and SDA has not already been asserted, a bus collision
occurs. In this case, another master is attempting to
transmit a data ‘1’ during the Repeated Start condition,
see Figure 17-30.
If, at the end of the BRG time-out, both SCL and SDA
are still high, the SDA pin is driven low and the BRG is
reloaded and begins counting. At the end of the count,
regardless of the status of the SCL pin, the SCL pin is
driven low and the Repeated Start condition is
complete.

Si SDA anda de capa caída, una colisión del autobús ha ocurrido (i.e., Otro
El 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 comienza
El conteo. Si SDA va de a gran altura a mugir antes del BRG
Cronometra fuera, ninguna colisión del autobús ocurre porque ningún dos
Los amos pueden afirmar CED en el tiempo exactamente igual.
Si SCL va de a gran altura a mugir antes de las veces BRG fuera
Y la CED ya no ha sido afirmada, una colisión del autobús
Ocurre. En este caso, otro amo intenta para
Transmita 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 CED
Está todavía drogado, el alfiler de CED es punto bajo conducido y el BRG es
Vuelto a cargar y empieza conteo. Al final de la cuenta,
A pesar del estatus del alfiler SCL, el alfiler SCL es
El punto bajo conducido y el Principio Repeated que la condición es
Complete.
17.4.17.3 Bus Collision During a Stop
Condition
Bus collision occurs during a Stop condition if:
a) After the SDA pin has been deasserted and
allowed to float high, SDA is sampled low after
the BRG has timed out.
b) After the SCL pin is deasserted, SCL is sampled
low before SDA goes high.

La Colisión del Autobús del 17.4.17.3 Durante Un Alto


La condición
La 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 y
Permitido para flotar a gran altura, la CED es punto bajo probado después
El BRG ha cronometrado fuera.
b) Después de que el alfiler SCL es deasserted, SCL es probado
Muja 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 to
float. 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 is
sampled. If SDA is sampled low, a bus collision has
occurred. This is due to another master attempting to
drive a data ‘0’ (Figure 17-31). If the SCL pin is
sampled low before SDA is allowed to float high, a bus
collision occurs. This is another case of another master
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 permitido
Flote. Cuándo el alfiler es alto probado (el arbitraje del reloj)
El Baud Rate Generator está forrado con SSPADD < 6:0
Y las cuentas hasta 0. Después del BRG cronometra fuera, CED es
Probado. Si la CED es probado punto bajo, una colisión del autobús lo ha hecho
Ocurrido. Esto es debido a otro amo intentando para
Conduzca una información _ 0 _ (la Figura 17-31). Si el alfiler SCL es
El punto bajo probado antes de la CED es admitido para comanditar a gran altura, un autobús
La colisión ocurre. Éste es otro caso de otro amo
Tratando de conducir una información _ 0 _ (la Figura 17-32).

Anda mungkin juga menyukai