Emulator for 27C256 EPROM

  • View
    283

  • Download
    11

Embed Size (px)

Text of Emulator for 27C256 EPROM

MICROPROCESSOR

Elektor Electronics 1/2001

Emulator for 27C256 EPROM with RS232 control

Design by B. Legrand and D. Mautaulon

Going through ourarchives we discov-ered that its beenalmost ten yearssince we publishedan EPROM emula-tor. The version wepropose in this arti-cle should meettodays demands ofhobbyists wishing todebug microcon-troller systemsbased on anEPROM. We havechosen the 27C256because it is cheapand currently themost widely usedEPROM in thehobby area.

36

microcontroller is used. The main reason forchoosing this device is that it offers on-chipserial I/O as well as EPROM to store thefirmware that handles the code reception andcontrol of the emulator.

Practical circuit

By and large, the circuit diagram shown inFigure 2 follows the general structure of theblock diagram. In fact, all building blocks dis-cussed above are fairly easy to find back inthe schematic.

IC1, a MAX232, handles the classic func-tion of converting the 10-V signal levels onthe RS232 lines to logic levels (+5 V/0 V), intwo directions. The MAX232 allows themicrocontroller in the circuit to communicatewith the PC via the RS232 port. Althoughmany PCs these days are capable of handlingserial signals with a swing of 5 V, simplyomitting the MAX232 would require the RxDand TxD signals to be inverted!

IC2 is the microcontroller type AT89C2051.It controls latches IC3 and IC4 as well asbuffers IC6, IC7 and IC8. These integrated cir-cuits ensure the correct interfacing with RAMIC5. In this context, correct means that theRAM may be accessed by either the micro-controller or the external (i.e., target) circuit,but never at the same time.

The RAM in fact emulates (mimics) the(E)PROM which has been removed form thetarget circuit. When the target circuit hasaccess to the RAM, it will behave as if a sys-tem (E)PROM was installed, hence the termemulator. To be able to pull off this trick, theRAM requires two peripheral devices. From

An EPROM emulator is a develop-ment tool designed to facilitate codedebugging and code writing jobs oncircuits incorporating an EPROM(electrically erasable read only mem-ory). An EPROM, as most of you willknow, can not be reprogrammedbefore its previous contents hasbeen erased through exposure to acertain amount of ultraviolet (UV)light. So, even for the smallest modi-fication to the code in your EPROM,you need to do a complete erase-and-reprogram cycle, which istedious and costly given the timelost and the price of an UV eraserbox.

An EPROM emulator obviatesthese problems by allowing you todebug, rewrite and download codeas many times as you like, until thedesired system operation isachieved, all without having to erasea single EPROM. Having extensivelytested the target program, you needto program an EPROM just once yetrest assured that it will work asplanned.

Meanwhile, in this day and age ofFlash reprogrammable and ISP (in-system programmable) devices, it isfair to reflect on the advantages, ifany, of an EPROM emulator. Also,one can not fail to recognise thetrend towards ever larger memorycapacities.

Despite the above trends, there isstill a fair number of circuits based

on microcontrollers running codefrom an external EPROM. These con-trollers include devices from the 8051series, the 68HC11 and 80C5xx. It isprecisely in this area where the pre-sent emulator will be highly valued.

Principle of operation

The block diagram shown in Fig-ure 1 is classic and typical for thistype of application.

The underlying principle of anEPROM emulator is that it replacesdead memory like ROM or EPROMby live memory (RAM) with double(two-port) access. The RAM isflanked by two latches and sup-ported by a microcontroller.

As in any EPROM emulator thatsany good, the heart of the circuit is aRAM device (here, IC5) which essen-tially replaces the (E)PROM of thetarget (or host) system. The RAM issurrounded by latches (IC3 and IC4)and buffers (IC6, IC7 and IC8). Theexact function of these componentswill be discussed a bit further on.

The distinctive feature of the pre-sent EPROM emulator (as comparedwith traditional designs) is the pres-ence of a microcontroller (IC2). Thiscomponent looks after the control ofthe latches and the RAM, and alsohandles the correct reception (fromthe PC) and processing of the objectcode to be transferred to the targetsystem. Here, an Atmel 89AT2051

MICROPROCESSOR

371/2001 Elektor Electronics

Technicalfeatures Emulates the most widely used

EPROM type 27C256

RS232 controlled

Employs HyperTerminal for data

transfer between PC and

EPROM simulator.

Recognizes industry-standard

IntelHex format

May be adapted to suit 27C64

and 27C128 by modifying circuit

around pins 26 and 27. Support

for 27C512 also possible with

some hardware and software

modifications.Figure 1. Block diagram of the 27C256 EPROM emulator, with the Atmel microcontrollerclearly at the hub of things.

RAMIC5

EPROMIC9

Buffer

IC7

Buffer

IC8

Buffer

IC6

Data

D0...D7

D0...D7

D0...D7

D0...D7

D0...D7

D0...D7

000153- 11

A8...A14

A8...A14

A0...A7

A8...A14

A0...A14

A0...A7

A0...A7

D0...D6

ProcessorIC2

LatchIC3

RS232IC1

LatchIC4

one side, the emulator electronics enables theobject code under test to be written into theRAM, while from the other side the external(host) system can access the RAM to readcode which the host microcontroller willeventually execute.

Latches IC3 and IC4 connect the host sys-tem address lines to the RAM. Depending oncommands received from the microcontroller,these ICs transfer the data on the internaldatabus, D0-D7. Each of the latch enableinputs is controlled by an individual I/O lineof the central processor. This configurationallows the processor to control the RAMaddress bus. Once the target program isstored in RAM, the two latches go into high-

impedance mode to avoid contentionproblems when the system switchesto emulation mode, i.e., with theRAM effectively connected into thetarget system.

Buffers IC6, IC7 and IC8 ensurethe quasi-connection of the RAMaddress and datalines to the exter-nal (host) circuit.

Power supply

The 27C256 EPROM emulator maybe powered in two ways. The first,which we will treat as the standardmethod, consists of powering the cir-

cuit by means of a mains adapter.The on-board power supply con-

sists of a three-pin voltage regulatortype 7805 (IC10) in a classic config-uration. This component providesthe +5-V regulated supply voltage tothe emulator circuitry. Because only100 mA or so of output current isrequired, the 7805 has an unde-manding job in this circuit. Diode D1protects the circuit against reversepolarised input voltages. LED D2acts as a power on/off indicator.

The second method consists ofpowering the emulator from the tar-get (host) system, which will be pos-

MICROPROCESSOR

38 Elektor Electronics 1/2001

AT89C2051

P3.2

P3.3

P1.0

P1.1P3.0

P3.1

P3.4

P3.5

IC2

P1.2

P1.3

P1.4

P1.5

P1.6

P1.7

P3.7

RST

X1 X2

20

10

12

13

14

15

16

17

18

19

11

5 4

2

3

1

6

7

8

9

62256

IC5

A10

A11

A12

RAM

A13

A14

10A0

A1

A2

A3

A4

A5

A6

A725

A824

A921

23

1422

OE

20CS

28

11D0

12D1

13D2

15D3

16D4

17D5

18D6

19D7

27

WR

26

9

8

7

6

5

4

3

2

1

X1

12MHzC11

33p

C12

33p

C2

1035V

C1

1035V

MAX232A

T1OUT

T2OUT

R1OUT

R2OUT

R1IN

IC1

T1IN

T2IN

R2IN

C1

C1+

C2+

C2

11

12

10

13

14

15

16V+

V-

7

8 9

3

1

4

5

2

6

K1

1

2

3

4

5

6

7

8

9

5V

D0

D1

D2

D3

D4

D5

D6

D7

D0

D1

D2

D3

D4

D5

D6

D7

D0

D1

D2

D3

D4

D5

D6

A0

A1

A2

A3

A4

A5

A6

A7

A8

A9

A10

A11

A12

A13

A14

A15

A0

A1

A2

A3

A4

A5

A6

A7

A8

A9

A10

A11

A12

A13

A14

T1

BS170

R3

12

k

5V

74HCT573

IC3

12

13

14

15

16

17

18

19

EN

11C1

1D

2

3

4

7

8

9

5

6

1

74HCT573

IC4

12

13

14

15

16

17

18

19

EN

11C1

1D

2

3

4

7

8

9