Philips Semiconductors Product data
P89C660/P89C662/P89C664/
P89C668
80C51 8-bit Flash microcontroller family
16KB/32KB/64KB ISP/IAP Flash with 512B/1KB/2KB/8KB RAM
2002 Oct 28
28
Table 6. Slave Receiver mode (Continued)
STATUS
STATUS OF THE
APPLICATION SOFTWARE RESPONSE
STATUS
CODE
(S1STA)
STATUS
OF
THE
I
2
C BUS AND
SIO1 HARDWARE
TO/FROM S1DAT
TO S1CON
NEXT ACTION TAKEN BY SIO1 HARDWARE
(S1STA) SIO1 HARDWARE
TO/FROM
S1DAT
STA STO SI AA
A0H A STOP condition or
repeated START
di i h b
No STDAT action or 0 0 0 0 Switched to not addressed SLV mode; no recognition
of own SLA or General call address
condition has been
received while still
addressed as
SLV/REC or SLV/TRX
No STDAT action or 0 0 0 1 Switched to not addressed SLV mode; Own SLA will
be recognized; General call address will be
recognized if S1ADR.0 = logic 1
SLV/REC
or
SLV/TRX
No STDAT action or 1 0 0 0 Switched to not addressed SLV mode; no recognition
of own SLA or General call address. A START
condition will be transmitted when the bus becomes
free
No STDAT action 1 0 0 1 Switched to not addressed SLV mode; Own SLA will
be recognized; General call address will be
recognized if S1ADR.0 = logic 1. A START condition
will be transmitted when the bus becomes free.
Table 7. Slave Transmitter mode
STATUS
STATUS OF THE
APPLICATION SOFTWARE RESPONSE
STATUS
CODE
(S1STA)
STATUS
OF
THE
I
2
C BUS AND
SIO1 HARDWARE
TO/FROM S1DAT
TO S1CON
NEXT ACTION TAKEN BY SIO1 HARDWARE
(S1STA) SIO1 HARDWARE
TO/FROM
S1DAT
STA STO SI AA
A8H Own SLA+R has
been received; ACK
hb d
Load data byte or X 0 0 0 Last data byte will be transmitted and ACK bit will be
received
has been returned
load data byte X 0 0 1 Data byte will be transmitted; ACK will be received
B0H Arbitration lost in
SLA+R/W as master;
Own SLA+R has
Load data byte or X 0 0 0 Last data byte will be transmitted and ACK bit will be
received
been received, ACK
has been returned
load data byte X 0 0 1 Data byte will be transmitted; ACK bit will be received
B8H Data byte in S1DAT
has been transmitted;
ACK has been
Load data byte or X 0 0 0 Last data byte will be transmitted and ACK bit will be
received
ACK
has
been
received
load data byte X 0 0 1 Data byte will be transmitted; ACK bit will be received
C0H Data byte in S1DAT
has been transmitted;
NOT ACK h b
No S1DAT action or 0 0 0 01 Switched to not addressed SLV mode; no recognition
of own SLA or General call address
NOT ACK has been
received
no S1DAT action or 0 0 0 1 Switched to not addressed SLV mode; Own SLA will
be recognized; General call address will be
recognized if S1ADR.0 = logic 1
no S1DAT action or 1 0 0 0 Switched to not addressed SLV mode; no recognition
of own SLA or General call address. A START
condition will be transmitted when the bus becomes
free
no S1DAT action 1 0 0 1 Switched to not addressed SLV mode; Own SLA will
be recognized; General call address will be
recognized if S1ADR.0 = logic 1. A START condition
will be transmitted when the bus becomes free.
C8H Last data byte in
S1DAT has been
i d (AA 0)
No S1DAT action or 0 0 0 0 Switched to not addressed SLV mode; no recognition
of own SLA or General call address
transmitted (AA = 0);
ACK has been
received
no S1DAT action or 0 0 0 1 Switched to not addressed SLV mode; Own SLA will
be recognized; General call address will be
recognized if S1ADR.0 = logic 1
no S1DAT action or 1 0 0 0 Switched to not addressed SLV mode; no recognition
of own SLA or General call address. A START
condition will be transmitted when the bus becomes
free
no S1DAT action 1 0 0 1 Switched to not addressed SLV mode; Own SLA will
be recognized; General call address will be
recognized if S1ADR.0 = logic 1. A START condition
will be transmitted when the bus becomes free.
Philips Semiconductors Product data
P89C660/P89C662/P89C664/
P89C668
80C51 8-bit Flash microcontroller family
16KB/32KB/64KB ISP/IAP Flash with 512B/1KB/2KB/8KB RAM
2002 Oct 28
29
Table 8. Miscellaneous States
STATUS
STATUS OF THE
APPLICATION SOFTWARE RESPONSE
STATUS
CODE
(S1STA)
STATUS
OF
THE
I
2
C BUS AND
SIO1 HARDWARE
TO/FROM S1DAT
TO S1CON
NEXT ACTION TAKEN BY SIO1 HARDWARE
(S1STA) SIO1 HARDWARE
TO/FROM
S1DAT
STA STO SI AA
F8H No relevant state
information available;
SI = 0
No S1DAT action No S1CON action Wait or proceed current transfer
00H Bus error during MST
or selected Slave
modes, due to an
illegal START or
STOP condition. State
00H can also occur
when interference
causes SIO1 to enter
an undefined state.
No S1DAT action 0 1 0 X Only the internal hardware is affected in the MST or
addressed SLV modes. In all cases, the bus is
released and SIO1 is switched to the not addressed
SLV mode. STO is reset.
Slave Transmitter mode
In the Slave Transmitter mode, a number of data bytes are
transmitted to a master receiver (see Figure 11). Data transfer is
initialized as in the Slave Receiver mode. When S1ADR and
S1CON have been initialized, SIO1 waits until it is addressed by its
own slave address followed by the data direction bit which must be
“1” (R) for SIO1 to operate in the Slave Transmitter mode. After its
own slave address and the R bit have been received, the serial
interrupt flag (SI) is set and a valid status code can be read from
S1STA. This status code is used to vector to an interrupt service
routine, and the appropriate action to be taken for each of these
status codes is detailed in Table 7. The Slave Transmitter mode may
also be entered if arbitration is lost while SIO1 is in the Master mode
(see state B0H).
If the AA bit is reset during a transfer, SIO1 will transmit the last byte
of the transfer and enter state C0H or C8H. SIO1 is switched to the
“not addressed” Slave mode and will ignore the master receiver if it
continues the transfer. Thus the master receiver receives all 1s as
serial data. While AA is reset, SIO1 does not respond to its own
slave address or a general call address. However, the I
2
C bus is still
monitored, and address recognition may be resumed at any time by
setting AA. This means that the AA bit may be used to temporarily
isolate SIO1 from the I
2
C bus.
Miscellaneous States
There are two S1STA codes that do not correspond to a defined
SIO1 hardware state (see Table 8). These are discussed below.
S1STA = F8H
This status code indicates that no relevant information is available
because the serial interrupt flag, SI, is not yet set. This occurs
between other states and when SIO1 is not involved in a serial
transfer.
S1STA = 00H
This status code indicates that a bus error has occurred during an
SIO1 serial transfer. A bus error is caused when a START or STOP
condition occurs at an illegal position in the format frame. Examples
of such illegal positions are during the serial transfer of an address
byte, a data byte, or an acknowledge bit. A bus error may also be
caused when external interference disturbs the internal SIO1
signals. When a bus error occurs, SI is set. To recover from a bus
error, the STO flag must be set and SI must be cleared. This causes
SIO1 to enter the “not addressed” Slave mode (a defined state) and
to clear the STO flag (no other bits in S1CON are affected). The
SDA and SCL lines are released (a STOP condition is not
transmitted).
Some Special Cases
The SIO1 hardware has facilities to handle the following special
cases that may occur during a serial transfer.
Simultaneous Repeated START Conditions from Two Masters
A repeated START condition may be generated in the Master
Transmitter or Master Receiver modes. A special case occurs if
another master simultaneously generates a repeated START
condition (see Figure 12). Until this occurs, arbitration is not lost by
either master since they were both transmitting the same data.
If the SIO1 hardware detects a repeated START condition on the I
2
C
bus before generating a repeated START condition itself, it will
release the bus, and no interrupt request is generated. If another
master frees the bus by generating a STOP condition, SIO1 will
transmit a normal START condition (state 08H), and a retry of the
total serial data transfer can commence.
Data Transfer After Loss of Arbitration
Arbitration may be lost in the Master Transmitter and Master
Receiver modes (see Figure 4). Loss of arbitration is indicated by
the following states in S1STA: 38H, 68H, 78H, and B0H (see
Figures 8 and 9).
If the STA flag in S1CON is set by the routines which service these
states, then, if the bus is free again, a START condition (state 08H)
is transmitted without intervention by the CPU, and a retry of the
total serial transfer can commence.
Forced Access to the I
2
C Bus
In some applications, it may be possible for an uncontrolled source
to cause a bus hang-up. In such situations, the problem may be
caused by interference, temporary interruption of the bus or a
temporary short-circuit between SDA and SCL.
If an uncontrolled source generates a superfluous START or masks
a STOP condition, then the I
2
C bus stays busy indefinitely. If the
STA flag is set and bus access is not obtained within a reasonable
amount of time, then a forced access to the I
2
C bus is possible. This
is achieved by setting the STO flag while the STA flag is still set. No
STOP condition is transmitted. The SIO1 hardware behaves as if a
STOP condition was received and is able to transmit a START
condition. The ST0 flag is cleared by hardware (see Figure 13).
Philips Semiconductors Product data
P89C660/P89C662/P89C664/
P89C668
80C51 8-bit Flash microcontroller family
16KB/32KB/64KB ISP/IAP Flash with 512B/1KB/2KB/8KB RAM
2002 Oct 28
30
S
08H
SLA W A DATA A S
BOTH MASTERS CONTINUE
WITH SLA TRANSMISSION
18H 28H
OTHER MASTER SENDS REPEATED
START CONDITION EARLIER
SU00975
Figure 12. Simultaneous Repeated START Conditions from 2 Masters
STA FLAG
TIME OUT
SDA LINE
SCL LINE
START CONDITION
SU00976
Figure 13. Forced Access to a Busy I
2
C Bus
I
2
C Bus Obstructed by a Low Level on SCL or SDA
An I
2
C bus hang-up occurs if SDA or SCL is pulled LOW by an
uncontrolled source. If the SCL line is obstructed (pulled LOW) by a
device on the bus, no further serial transfer is possible, and the
SIO1 hardware cannot resolve this type of problem. When this
occurs, the problem must be resolved by the device that is pulling
the SCL bus line LOW.
If the SDA line is obstructed by another device on the bus (e.g., a
slave device out of bit synchronization), the problem can be solved
by transmitting additional clock pulses on the SCL line (see
Figure 14). The SIO1 hardware transmits additional clock pulses
when the STA flag is set, but no START condition can be generated
because the SDA line is pulled LOW while the I
2
C bus is considered
free. The SIO1 hardware attempts to generate a START condition
after every two additional clock pulses on the SCL line. When the
SDA line is eventually released, a normal START condition is
transmitted, state 08H is entered, and the serial transfer continues.
If a forced bus access occurs or a repeated START condition is
transmitted while SDA is obstructed (pulled LOW), the SIO1
hardware performs the same action as described above. In each
case, state 08H is entered after a successful START condition is
transmitted and normal serial transfer continues. Note that the CPU
is not involved in solving these bus hang-up problems.
Bus Error
A bus error occurs when a START or STOP condition is present at
an illegal position in the format frame. Examples of illegal positions
are during the serial transfer of an address byte, a data, or an
acknowledge bit.
The SIO1 hardware only reacts to a bus error when it is involved in
a serial transfer either as a master or an addressed slave. When a
bus error is detected, SIO1 immediately switches to the “not
addressed” Slave mode, releases the SDA and SCL lines, sets the
interrupt flag, and loads the status register with 00H. This status
code may be used to vector to a service routine which either
attempts the aborted serial transfer again or simply recovers from
the error condition as shown in Table 8.

P89C662HBA/00,512

Mfr. #:
Manufacturer:
NXP Semiconductors
Description:
IC MCU 8BIT 32KB FLASH 44PLCC
Lifecycle:
New from this manufacturer.
Delivery:
DHL FedEx Ups TNT EMS
Payment:
T/T Paypal Visa MoneyGram Western Union