
APPLICATION NOTE 78
030998 6/27
respond to high priority or interrupt driven events with a
minimum delay. The following sources can trigger a
switchback:
external interrupt 0/1/2/3/4/5,
serial start bit detected, Serial Port 0/1,
transmit buffer loaded, Serial Port 0/1,
watchdog timer reset,
power–on reset,
external reset.
Because of the intimate relationship between PMM,
switchback, external interrupts, timer/counters, and the
serial ports, it is highly recommended that the system
designer become familiar with these features before
attempting to use the switchback feature.
Status Register
A Status register (STATUS;C5h) has been added to the
DS87C5x0 to aid the software in determining whether a
speed change is appropriate. The Status register pro-
vides information on the status of both serial ports, and
high priority, low priority, and power fail interrupts, allow-
ing the device to determine whether or not the device
should be switched into PMM.
The benefits of the Status register become apparent
when using the switchback feature to exit or enter PMM.
A device executing an interrupt service routine in PMM
will not execute a switchback in response to an interrupt
of equal or lower priority. The Status register can be
used to test for an interrupt service routine in progress,
and can hold off entering PMM until finished, or take
another course of action.
Enabling/Initiating Switchback
Automatic switchback is enabled by setting the SWB bit
(PMR.5). When a qualified switchback event occurs,
the device will exit either PMM and return to the default
operating mode of 4 clocks per machine cycle. Clearing
the SWB bit will disable the ability of external interrupts
and serial ports to cause future switchbacks, but will not
affect the current speed of the DS87C5x0. Five condi-
tions must be met for an external interrupt to cause a
switchback:
1. The device must currently be in PMM1 or PMM2.
2. The SWB bit (PMR.5) must be set.
3. Global Interrupts must be enabled by setting the EA
bit (IE.7).
4. The specific interrupt must be enabled.
5. The specific interrupt occurs and is acknowledged.
Switchbacks via the serial port are slightly different. In
general, switchbacks are caused by interrupts. In the
case of the serial ports, this introduces a problem as
they generate interrupts only upon receipt or transmis-
sion of a complete word. For the serial port to properly
receive or transmit a word at standard baud rates, it
must be operating at full speed. If the DS87C5x0 is
operating in PMM, it would never complete a reception
to initiate an interrupt, or the corresponding switchback.
The DS87C5x0 solves this problem by initiating a
switchback, if enabled, upon the receipt of a falling edge
on the RX pin, not the receiver interrupt. This switches
the device back to full speed on the next internal
machine cycle, in time to capture the start bit, and the
rest of the transmission. Note that the ability of the serial
port to initiate a switchback is not dependent on the
Enable Serial Port Interrupt bits (IE.4 or IE.6), only the
specific Receiver Enable bit (SCON0.4 or SCON1.4).
Four conditions must be met for a serial port reception to
cause a switchback:
1. The device must currently be in PMM1 or PMM2.
2. The SWB bit (PMR.5) must be set.
3. The specific serial port must be enabled by setting
the specific Receiver Enable bit (SCON0.4 or
SCON1.4).
4. A falling edge is detected on the specific RX pin.
The switchback feature also works in conjunction with
the transmit function. If the appropriate conditions are
met, a device operating in a PMM will automatically
return to divide by 4 mode when a serial port buffer
(SBUF0;99h or SBUF1;C1h) is loaded. This removes
the need for the user to manually set the speed to divide
by 4 before initiating the transmission. The transmitter
interrupt can be used to signal when the transmission is
complete so that software can return the device to the
appropriate PMM. Three conditions must be met for a
serial port transmission to cause a switchback:
1. The device must currently be in PMM1 or PMM2.
2. The SWB bit (PMR.5) must be set.
3. A serial port transmission must be initiated by load-
ing the specific serial port buffer (SBUF0;99h or
SBUF1;C1h).