44 T89C51RD2 4243G–8051–05/03
Reset Re commendation
to Prevent Flash
Corruption
Since the product includes a software area (booloader) where the C51 core can operate
Flash wr ite o perat ions, if th e value of the Pr ogram Co unter is acciden tly i n the range of
the boot memor y add ress es th en a Fl as h a cces s (w rite or e rase ) ma y co rrup t th e F las h
on-chip memory.
It is recommended to use an external reset circuitry featuring power supply monitoring to
prevent system malfunction during periods of insufficient power supply voltage (power
supply failure, power supply switched off).
Idle Mode An ins tructi on that sets P CON.0 indica tes that it is the las t inst ructio n to b e execute d
before going into Id le mode. In Idle mode, the inte rnal clock s ignal is gated of f to the
CPU, but not to the interrupt, Timer, and Serial Port functions. The CPU status is pre-
served in its entirety: the Stack Pointer, Program Counter, Program Status Word,
Accumulator and all other registers maintain their data during idle. The port pins hold the
logica l states they had at the time Idl e was activ ated. ALE and PSEN hold at log ic high
level.
There are two ways to terminate the Idle mode. Activation of any enabled interrupt will
cause PCON.0 to be cleared by ha rdware, ter minat ing the Idl e mode. Th e interru pt will
be serviced, and following RETI the next instruction to be executed will be the one fol-
lowing the instruction that put the device into idle.
The flag bits GF0 and GF1 can be used to give an indication if an interrupt occurred dur-
ing normal operation or during idle. For example, an instruction that activates idle can
also set one or both flag bits. When idle is terminated by an interrupt, the interrupt ser-
vice routine can examine the flag bits.
The other way of terminating the Idle mode is with a hardware reset. Since the clock
oscillator is still running, the hardware reset needs to be held active for only two
machine cycles (24 oscillator periods) to complete the reset.
Power-down Mode To sav e maximum powe r, a Powe r-down mod e can be inv oked by so ftware (see Table
14, PCON register).
In Power-down mode, the oscillator is stopped and the instruction that invoked Power-
down mode is the last instruction executed. The internal RAM and SFRs retain their
value until the Power-down mode is terminated. VCC can be lowered to save further
power. Either a hardware reset or an external interrupt can cause an exit from Power-
down. To properly terminate Power-down, the reset or external interrupt should not be
executed befor e VCC i s restored to its normal operating level an d must be h eld activ e
long enough for the oscillator to restart and stabilize.
Only external interrupts INT0, INT1 and Key board Interr upts are useful to exit f ro m
Power-down. For that, i nter rupt m ust be en abl ed an d co nfi gur ed as lev el or ed ge sens i-
tive interrupt input. When Keyboard Interrupt occurs after a power down mode, 1024
clocks are necessary to exit to power down mode and enter in operating mode.
Holding th e pi n low r es tarts the o scil la tor bu t br in gin g the pi n hi gh completes the e xit as
detailed in Figure 19. When both interrupts are enabled, the oscillator restarts as soon
as one of the two inputs is held low and power down exit will be completed when the first
inpu t w ill be released . In this case , the higher prio rity interrup t s ervice routi ne is exe-
cuted. On ce the inter rupt is servi ced, the next instructio n to be execute d after RETI wil l
be the one following the instruction that puts the T89C51RD2 into Power-down mode.