English
Language : 

W78958B Datasheet, PDF (15/28 Pages) Winbond – 8-BIT EMULATION MICROCONTROLLER
W78958B
currently specified by the breakpoint. In this mode, all internal clocks are stopped and the primary I/O
pins of the W78958B are frozen in their previous states; only the oscillator continues to run. Also, the
contents of all the SFRs/PC and the scratchpad RAM remain as they were at the end of the last
instruction.
When the device is in the emulation mode, the internal SFR/PC/RAM can be accessed directly, and
the external ROM/RAM can also be accessed easily. The ESEL input is used to separate the two
access spaces (the internal SFR/PC/RAM and the external ROM/RAM). To access the internal
SFR/PC/RAM, hold ESEL at "L" level. DP4 then serves as a bidirectional data bus, AP5 and AP6<0>
as the address input bus, and AP7<0>/AP7<1> as the write/read control input signals, When AP6<0>
is "0," the SFR/PC can be accessed; when AP6<0> is "1," the internal RAM can be accessed. The
SFRs' addresses are the same as those specified in the W78C32. The HB (0A1H), EPMA (0A2H), P8
(0A6H), and XICON (0C0H) registers can be accessed only in the advanced type. The addresses of
the PC's low-byte (PCL) and high-byte (PCH) are 0A3H and 0A4H, respectively, which are not the
standard SFRs in the W78C32 and cannot be accessed in normal mode.
When ESEL is held at "H" level, DP4, AP5, AP6, and AP7 are in high impedance state, but the
functions of Port 0 and Port 2 depend on the type of W78958B. In the advanced type, Port 0 and Port
2 are in the original state. In the standard type, Port 0 is floating, and the individual bits of Port 2 are
either in the original state or in high impedance state, depending on the contents of the MP2 (Mask
Port 2) register. If the content of a particular bit in MP2 is "0," the corresponding pin of Port 2 is in the
original state; if the content of a particular bit in MP2 is "1," the corresponding pin of Port 2 is in the
high impedance state. For example, when 16 KB external program/data memory is needed and the
remaining two pins, P26 and P27, are used as the I/O, MP2 must be filled with 3FH before the
external program/data memory can be accessed. The MP2 register is a nonstandard 8-bit SFR at
address 0A5H in the W78C32, and its default value is 0FFH. It can be accessed only in the emulation
mode of the standard type.
After the W78958B enters the emulation mode, the code located on the breakpoint address is filled
into the IR register but is not decoded, and the content of PC is incremented by one. The content of
PC may be modified during the emulation mode, but the code within IR will not be modified
accordingly. For this reason, the W78958B clears the content of IR (00H is the opcode of instruction
NOP) before leaving the emulation mode. The emulation mode can be released by resetting the
ICESET pin to low. After the signal is acknowledged, the W78958B clears the content of IR, and then
the W78958B will resume operation from the S2 state. At this time, the W78958B runs an NOP
instruction to prevent improper code from being executed, because the content of PC may have been
changed. After the W78958B leaves the emulation mode, i.e., the internal clock and states start to
run, it takes four states to fetch the second (ignored) byte of NOP. EMU will go low until the complete
NOP instruction has been finished; that is, it will go low at the end of the S4 state. EMU goes low four
states after the device exits the emulation mode. For more information, see the Timing Diagram for
the emulation cycle.
The content of PC must be handled carefully. For example, if the W78958B enters emulation mode
after the content of PC has reached a user-defined breakpoint address, say 100H, the content of PC
will be incremented by 1, to 101H. To restart the program from the same address (100H) after the
device exits the emulation mode, 1 must be subtracted from the content of PC−that is, 100H must be
filled into PC before the device exits emulation mode. To restart the program from a new program
address (for example, 200H) after leaving the emulation mode, fill the new address value (200H) into
PC. If one breakpoint is set in the current PC, this breakpoint will be reached again after leaving the
emulation mode, however, so this breakpoint must be avoided carefully.
- 15 -
Publication Release Date: September 1997
Revision A3